Pip install failure - Known Bug - pip

As of this week my vagrant builds are no longer working because of a pip error which is happening whenever I build a new machine, my existing machines have a working copy of pip. I'm provisioning `vagrant machines with ubuntu/trusty64 and the first command is:
sudo apt-get install python-pip
However after running sudo pip install something fails with the error
ImportError:No module packaging.version.
command/usr/binpython -c "import setuptools, tokenize;__file__=`/tmp/pip_build_root/defusexml/setup.py'; exec(compil(getattr(tokenize, 'open')(__file__).read().replace('\r\n', '\n'), __file__, 'exec')) install --record /tmp/pip-wVb4Du-record/install-record.txt --single-version-externally-managed --compile failed with erro code 1 in /tmp/pip_build_root/defusedxml Storing debug log for failure in /home/vagrant/.pip/pip.log
I've spun up a new machine and installed pip it installs with no errors. This is a new problem I've been provisioning machines with the same file for the past 6 months. Is there a way to fix this, have they changed a dependency?

After doing more research it turns out this is a known bug https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1658844 that has recently been introduced.
The workaround is to install pip with easy_install via python-setuptools and pip will work.

Related

Error installing requests_kerberos==0.12.0 in Azure DataBricks

I am trying to install requests_kerberos == 0.12.0 in Azure DataBricks, but trying to install it generates an error and does not install.
this is the cluster configuration where I am trying to install it: Databricks Runtime Version7.0 (includes Apache Spark 3.0.0, Scala 2.12)
also try installing the following,% sh sudo apt-get install gcc python-dev libkrb5-dev, but the installation never finishes.
This is the error installing in the databricks notebook
ERROR: Command errored out with exit status 1: /databricks/python3/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-k1b9yec8/pykerberos/setup.py'"'"'; file='"'"'/tmp/pip-install-k1b9yec8/pykerberos/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-tfttk2g6/install-record.txt --single-version-externally-managed --compile --install-headers /databricks/python3/include/site/python3.7/pykerberos Check the logs for full command output.
I appreciate any help
Tested on: Databricks Runtime Version7.0 (includes Apache Spark 3.0.0, Scala 2.12)
To install requests_kerberos==0.12.0 in Azure DataBricks:
%sh
pip install requests-kerberos
If you run an apt-get command without the -y option, you need to answer to all prompts that you get from that command interactively in order for the execution of the command to continue.
If you are using without “-y”, this command will be keep on running until we accept to answer to all prompts.
%sh
sudo apt-get install gcc python-dev libkrb5-dev
If you are using with “-y” it will automatically say yes to all the prompts and complete installation.
%sh
sudo apt-get install -y gcc python-dev libkrb5-dev

Error code (exit code 1) when installing netfilterqueue on macOS

When I try to install the module netfilterqueue for python via pip, I get the error:
"Command
"/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
-u -c "import setuptools, tokenize;file='/private/tmp/pip-install-Ut3XcJ/netfilterqueue/setup.py';f=getattr(tokenize,
'open', open)(file);code=f.read().replace('\r\n',
'\n');f.close();exec(compile(code, file, 'exec'))" install
--record /private/tmp/pip-record-teUDXs/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-install-Ut3XcJ/netfilterqueue/"
I installed the module scapy without any problems, so I'm confused why netfilterqueue isn't installing. I'm currently using macOS High Sierra.
According to these issue on their Github page, it is not supported on macOS.
https://github.com/kti/python-netfilterqueue/issues/14:
libnetfilterqueue is a Linux-only feature, so you won't be able to
install python-netfilterqueue on Mac OS.
https://github.com/kti/python-netfilterqueue/issues/2:
Sorry, python-netfilterqueue will not work on Mac because nfqueue is Linux-only: http://www.netfilter.org/projects/libnetfilter_queue/index.html
error code 1 means operation not permitted, so it is a problem of authorization.
Try with sudo before the command:
sudo pip install python-netfilterqueue

Installing Spyder (updated for 2018)

I would really like to install Spyder3 for Python 3.6 on Ubuntu 16.04. I don't want Anaconda, I just want Spyder 3.
I've been looking around and all the solutions seem out of date. I have tried the following but no success...
sudo apt install spyder3
sudo apt install python3-pyqt4 python3-pyqt5 python3-pyqt5.qtsvg python3-pyqt5.qtwebkit
sudo pip3 install -U spyder
The last command gives me this error at the end, which I don't understand:
Can't rollback psutil, nothing uninstalled.
Command "/usr/bin/python3 -u -c "import setuptools,tokenize;__file__='/tmp/pip-build-479pjggv/psutil/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-i3_5xsal-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-479pjggv/psutil/
Any help would be deeply appreciated, I am desperate to install Spyder3, all other IDLEs look far too complicated (I come from an R background).
Try to install Anaconda (anaconda.org) - spyder is included, also almost all packages you'll need

installation of vpython using pip in High Sierra

I am having issue with installing vpython using pip. During the installation I get and error as if I do not have stdio.h, which I do
In file included from _scandir.c:14:
/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:33:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
Command "/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/var/folders/mf/h7c_zhyd7yl6t7nkgx10j6pw0000gq/T/pip-build-czavCr/scandir/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/mf/h7c_zhyd7yl6t7nkgx10j6pw0000gq/T/pip-is5WM1-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/mf/h7c_zhyd7yl6t7nkgx10j6pw0000gq/T/pip-build-czavCr/scandir/
I am running High Sierra, latest Xcode
Most posts on the web suggest to install the command line tools with
xcode-select --install but I did and I can compile some of my codes just fine.
Other things I have tried:
removing and reinstalling xcode+command line tools
remove the /Library/Developer/CommandLineTools/
CFLAGS=-stdlib=libc++ pip install vpython
MACOSX_DEPLOYMENT_TARGET=10.13 pip install vpython
but nothing works. I am completely out of ideas
I was unable to understand the problem above, but I have managed to find two workarounds to get a working version of vpython. Somehow the issue seems to be related to python package I installed from python.org and the pip included. I removed it and installed instead python2 and python3 using Homebrew and both pip2 and pip3 managed to install successfully the vpython and other modules.
Another alternative, which seems even better is to install Anaconda Python and then use conda to get vphyton.

"error code 1" Installing usaddress with Anaconda on Windows 7 32-bit

I am running Windows 7 and Anaconda. Attempting to install usaddress library found here: https://github.com/datamade/usaddress I have attempted this installation using a virtual env of Python 2.7 in my Anaconda3 installation, and a separately installed Anaconda 2.
I installed pip for Conda and navigated to my Scripts directory to attempt an install using pip install usaddress. It does not work, neither do many of the solutions that I have found on the internet. The error I get is this:
Command "C:\Users\User\Anaconda2\python.exe -u -c "import setuptools, tokenize;__file__='c:\users\user\appdata\local\temp\pip-build-0a_vd7\python-crfsuite\setup.py';exec(compile(getattr(tokenize, 'open'
, open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\user\appdata\local\temp\pip-mtrojm-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\user\appdata\local\temp\pip-build-0a_vd7\python-crfsuite
This is another error that seems to pop up:
Failed building wheel for python-crfsuite
Running setup.py clean for python-crfsuite
Failed to build python-crfsuite
I have also attempted to fix this error with no luck by searching Stack and other places on the internet.

Resources