Error when installing using pip
Asked Answered
C

7

16

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

Cammycamomile answered 19/7, 2015 at 6:8 Comment(1)
Is this happening with anything you try installing with pip?Sateen
D
14

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

Darryl answered 19/7, 2015 at 9:6 Comment(2)
This is what I get when reunning sudo pip install -U setuptools: The directory '/Users/Name/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. /Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available....Cammycamomile
Try this 'sudo -H pip install <app_name>'Darryl
Y
18

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

Yeomanry answered 21/2, 2017 at 19:22 Comment(0)
D
14

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

Darryl answered 19/7, 2015 at 9:6 Comment(2)
This is what I get when reunning sudo pip install -U setuptools: The directory '/Users/Name/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. /Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available....Cammycamomile
Try this 'sudo -H pip install <app_name>'Darryl
A
3

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
Aenea answered 23/7, 2017 at 18:5 Comment(0)
H
1

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.

Huda answered 31/8, 2018 at 22:54 Comment(0)
P
1

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>>

Portraiture answered 29/10, 2018 at 11:16 Comment(0)
F
0

first run as superuser:

sudo su

then :

pip install PyOpenGL PyOpenGL_accelerate
Featured answered 20/2, 2018 at 23:53 Comment(0)
U
0

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.

Unclothe answered 26/6, 2018 at 2:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.