14
votes

Not sure whats going on here but I am getting an error every time I try to install something using pip I get the following error:

Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/b0/5843zgyj1yz3b8q2l7wrtj8h0000gn/T/pip-build-V4hy8S/PySocks/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/b0/5843zgyj1yz3b8q2l7wrtj8h0000gn/T/pip-bIOl7C-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/b0/5843zgyj1yz3b8q2l7wrtj8h0000gn/T/pip-build-V4hy8S/PySocks

7
Is this happening with anything you try installing with pip?hugos

7 Answers

14
votes

Seems that your PiP can't access Setuptools as per the "import setuptools" in the error. Try the below first then try running your pip install again.

sudo pip install -U setuptools

Solution from Github Issue

15
votes

Try

sudo pip install -U setuptools

If this doesn't solve your problem then

Firstly, you need the python-dev package because Pillow needs compile headers defined.

sudo apt-get install python-dev

On Ubuntu 14.04 you need few extra packages to get pillow working. Install all of them with the command:

sudo apt-get install libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk

3
votes

Launch the command prompt with 'run as administrator' rights before installing. then try the script -

pip install package_name_here

if error is thrown,then import setup tools

pip install -U setuptools

if again error thrown then upgrade your pip installer using this script(personally worked for me)

python -m pip install --upgrade pip
1
votes

I had the same problem on Windows Git Bash but installing setuptools did not fix it. Then I noticed another error message further up:

building 'twisted.test.raiser' extension error: Microsoft Visual C++ 14.0 is 
required. Get it with "Microsoft Visual C++ Build Tools": 
http://landinghub.visualstudio.com/visual-cpp-build-tools

That link was dead but ultimately this page had a link to the correct download: https://wiki.python.org/moin/WindowsCompilers

I installed Microsoft Build Tools for Visual Studio 2017 and that resolved it.

0
votes

first run as superuser:

sudo su

then :

pip install PyOpenGL PyOpenGL_accelerate
0
votes

If you get this error on Windows, like I did, then just run the command-line tool (cmd.exe or Powershell) as Administrator and try again.

0
votes

It majorly depends on the type of packages you suppose to install. Frequently its failing due to the missing of libsasl2-dev a package for authentication abstraction library which use in the Ubuntu version

First, install:

sudo apt-get install libsasl2-dev

then run:

pip install <<\package_name>>