394

I'm trying to install some packages with pip.

But pip install unroll gives me

Command "python setup.py egg_info" failed with error code 1 in C:\Users\MARKAN~1\AppData\Local\Temp\pip-build-wa7uco0k\unroll\

How can I solve this?

starball
  • 20,030
  • 7
  • 43
  • 238
benjaminh
  • 3,949
  • 3
  • 10
  • 3
  • 1
    What version of windows are you running? As @hackndo says, this is a permissions problem, try running the same again with the command prompt as administrator. – Hayden Crocker Aug 28 '16 at 10:14
  • @alaye Do you have a stack trace for the error? – Peter Brittain Aug 28 '16 at 22:27
  • I recommend everyone to follow this url for installing https://www.digitalocean.com/community/tutorials/how-to-install-the-django-web-framework-on-ubuntu-14-04 rather than following the official site. I got the same error but when I followed the methods in this site it worked. – Krishnadas PC Jun 24 '17 at 16:25
  • 2
    use `sudo pip ` – EsmaeelE Dec 08 '17 at 14:00
  • 07/2021 answer: https://stackoverflow.com/a/68458775/8718377 – veben Jul 20 '21 at 17:02

32 Answers32

223

About the error code

According to the Python documentation:

This module makes available standard errno system symbols. The value of each symbol is the corresponding integer value. The names and descriptions are borrowed from linux/include/errno.h, which should be pretty all-inclusive.

Error code 1 is defined in errno.h and means Operation not permitted.

About your error

Your setuptools do not appear to be installed. Just follow the Installation Instructions from the PyPI website.

If it's already installed, try

pip install --upgrade setuptools

If it's already up to date, check that the module ez_setup is not missing. If it is, then

pip install ez_setup

Then try again

pip install unroll

If it's still not working, maybe pip didn't install/upgrade setup_tools properly so you might want to try

easy_install -U setuptools

And again

pip install unroll
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
pixis
  • 2,761
  • 1
  • 11
  • 26
  • 352
    I have the same problem and that did not fix it. – Manu Masson Jul 24 '16 at 07:20
  • 19
    I have the same issue on windows and it is still not working – TsTeaTime Aug 11 '16 at 04:07
  • I get the same error when running in command window running as administrator. I also get the same error when I run pip install ez_setup as suggested as a fix to the first error. Any additional assistance would be greatly appreciated. – Nelda.techspiress Oct 24 '16 at 21:04
  • 4
    Hopefully this will be indexed and returned if someone searches for it... This resolved my issue when trying to install `pylint`. `lazy-object-proxy` was failing to be installed: "`error: [Errno 2] No such file or directory: 'examples'`" "`Command "python setup.py egg_info" failed with error code 1`". Updating `setuptools` fixed it. – OdinX Feb 26 '17 at 13:12
  • Had this problem on ubuntu; this mostly worked. I needed to do: `sudo apt-get install python-setuptools` followed by `sudo easy_install -U setuptools` – Azmisov Aug 30 '17 at 19:38
  • Tried running with sudo as a workaround and it worked – Ivan_ug Nov 29 '17 at 14:12
  • `pip install --upgrade pip` was also epic – Evhz Jan 26 '18 at 17:52
  • 3
    `pip install ez_setup` was the solution for me :) – ivanleoncz Mar 06 '18 at 21:14
  • 1
    Perfectly worked. Given Permission error, hence just add "sudo -H" i.e sudo -H pip install ez_setup – Vishal Dalve May 22 '18 at 11:14
  • 1
    `pip install --upgrade setuptools --user python` worked for me (https://stackoverflow.com/a/36996892/4465464) – chocolate cake Jul 24 '18 at 07:12
  • 2
    I tried upgrading pip without success. So I then tried this solution. When trying to install unroll via pip, I get the following error: `Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/5v/vpmg1hf51cv8cxvkhw5t7s000000gn/T/pip-install-rn3yl6lt/unroll/`. Any ideas what to try next? In case it's relevant, my actual use case is trying to install mySQL for mac OSX as suggested [here](https://github.com/worldveil/dejavu/blob/master/INSTALLATION.md). –  Apr 14 '19 at 09:57
  • 1
    didn't help for me. – Vineesh TP Jul 14 '19 at 13:41
  • @VineeshTP Did you figure it out ? – pixis Jul 16 '19 at 09:13
  • @pixis: I was tried to install 'textract' . I could n't run textract on windows but, in Mac it is working fine. Then tried with 'tika' for reading pdf . It is good. – Vineesh TP Jul 17 '19 at 12:19
  • I faced the same issue while installing `mysqlclient` on *Ubuntu 22.04*. This is what I had to install in addition in order to get going `sudo apt-get install libmysqlclient-dev libpython3-dev build-essential` – Muhammad Zubair Jan 03 '23 at 14:32
93

Here's a little guide explaining a little bit how I usually install new packages on Python + Windows. It seems you're using Windows paths, so this answer will stick to that particular SO:

  • I never use a system-wide Python installation. I only use virtualenvs, and usually I try to have the latest version of 2.x & 3.x.
  • My first attempt is always doing pip install package_i_want in some of my Visual Studio command prompts. What Visual Studio command prompt? Well, ideally the Visual Studio which matches the one which was used to build Python. For instance, let's say your Python installation says Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)] on win32. The version of Visual Studio used to compile Python can be found here, so v1500 means I'd be using vs2008 x64 command prompt
  • If the previous step failed for some reason I just try using easy_install package_i_want
  • If the previous step failed for some reason I go to gohlke website and I check whether my package is available over there. If it's so, I'm lucky, I just download it into my virtualenv and then I just go to that location using a command prompt and I do pip install package_i_want.whl
  • If the previous step didn't succeed I'll just try to build the wheel myself and once it's generated I'll try to install it with pip install package_i_want.whl

Now, if we focus in your specific problem, where you're having a hard time installing the unroll package. It seems the fastest way to install it is doing something like this:

  • git clone https://github.com/Zulko/unroll
  • cd unroll && python setup.py bdist_wheel
  • Copy the generated unroll-0.1.0-py2-none-any.whl file from the created dist folder into your virtualenv.
  • pip install unroll-0.1.0-py2-none-any.whl

That way it will install without any problems. To check it really works, just login into the Python installation and try import unroll, it shouldn't complain.

One last note: This method works almost 99% of the time, and sometimes you'll find some pip packages which are specific to Unix or Mac OS X, in that case, when that happens I'm afraid the best way to get a Windows version is either posting some issues to the main developers or having some fun by yourself porting to Windows (typically a few hours if you're not lucky) :)

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
BPL
  • 9,632
  • 9
  • 59
  • 117
  • 2
    What do you mean by "build the wheel myself"? Could you give an example please? Cheers – Uncle Ben Ben Feb 08 '18 at 16:37
  • Sry its not working for me, it says unroll-0.1.0-py2-none-any.whl is not supported wheel on this platform – Devashish Prasad Mar 18 '18 at 13:13
  • To build a wheel: 'pip install wheel', then 'python setup.py bdist_wheel'. If bdist_wheel is not found, go into the setup.py file and comment out 'from distutils.core import setup' and import the following instead: 'from setuptools import setup'. Then cd into the dist folder and 'pip install wheel_name.whl' – Sol Jun 16 '18 at 00:52
  • Try to update setuptools through pip first `pip install --upgrade setuptools`. This will help in most of the cases. – Fa11enAngel Jun 06 '19 at 15:12
  • I followed your steps of : git clone But no luck. I'm trying to install django channels. Still getting the same error. Failed building wheel for cryptography Could not build wheels for cryptography which use PEP 517 and cannot be installed directly – rahim.nagori Dec 23 '19 at 11:51
74

It was resolved after upgrading pip:

python -m pip install --upgrade pip
pip install "package-name"
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Lil Ari
  • 741
  • 5
  • 3
35

I got stuck exactly with the same error with psycopg2. It looks like I skipped a few steps while installing Python and related packages.

  1. sudo apt-get install python-dev libpq-dev
  2. Go to your virtual env
  3. pip install psycopg2

(In your case you need to replace psycopg2 with the package you have an issue with.)

It worked seamlessly.

Felipe Augusto
  • 7,733
  • 10
  • 39
  • 73
SriSri
  • 393
  • 4
  • 10
  • 1
    Installed those packages on Ubuntu, the issue persists. Maybe if you shared your process, we could install the relevant packages on our systems. – Nagev Sep 06 '17 at 12:46
  • Hi Nagev, sorry, I didn't look at my messages. hope you figured it out. I followed standard python installation process. I will be installing on a new VM shortly and will get back. – SriSri Mar 18 '18 at 14:11
  • I sorted it out a long time ago @SriSri just using "apt-get install", thanks. – Nagev Mar 20 '18 at 07:48
  • @SriSri I too am getting the error for psycopg2. Is sudo apt-get install python-dev libpq-dev supposed to be done outside the venv? And do you know what the equivalent command for windows is? Thanks! – rahs Feb 17 '19 at 15:36
  • `sudo apt-get install python-dev` did the trick. Thank you. The obnoxious attitudes of other people who answered with invalid solutions is sickening. – Daniel Soutar May 17 '19 at 16:47
24

I got this same error while installing mitmproxy using pip3. The below command fixed this:

pip3 install --upgrade setuptools
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
rashok
  • 12,790
  • 16
  • 88
  • 100
8
  • Download and install the Microsoft Visual C++ Compiler for Python 2.7 from https://www.microsoft.com/en-in/download/details.aspx?id=44266 - this package contains the compiler and set of system headers necessary for producing binary wheels for Python 2.7 packages.
  • Open a command prompt in elevated mode (run as administrator)
  • Firstly do pip install ez_setup
  • Then do pip install unroll (It will start installing numpy, music21, decorator, imageio, tqdm, moviepy, unroll) # Please be patient for music21 installation

Python 2.7.11 64 bit used

Community
  • 1
  • 1
be_good_do_good
  • 4,311
  • 3
  • 28
  • 42
  • 1
    I just get the same error: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-QRMQDo/ez-setup/ – Nagev Sep 06 '17 at 11:53
  • 1
    @Nagev, what is the OS type you are working on? And is possible to post complete traceback link? – be_good_do_good Sep 06 '17 at 13:18
  • I'm on Ubuntu 16.04. It's too long, I've only added the end, when doing "pip install ez_setup": return eval(compiled_marker, environment) File "", line 1, in NameError: name 'sys_platform' is not defined ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-NRUrS7/HTML/ – Nagev Sep 06 '17 at 13:22
5

Other way:

sudo apt-get install python-psycopg2 python-mysqldb
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • That's the only solution on this page that worked for me so far. I used "apt-get install python-pycurl". However, doing "pip install http://www.decalage.info/files/HTML.py-0.04.zip" brings back the issue. So pip install is still needed... – Nagev Sep 06 '17 at 13:17
  • For me I did realize that I had not installed an important dependency which is python-mysqldb. After installing the two it worked just like magic. :) – Muema Mar 10 '18 at 10:04
  • I am getting this error: `Package 'python-psycopg2' has no installation candidate`. I tried updating: `sudo apt-get update` – Hafiz Temuri Dec 19 '22 at 18:51
5

It's a dependency issue.

I tried running the following commands helped me sorting out the dependencies, in my case the dependency was

grpcio

pip3 install --upgrade pip

python3 -m pip install --upgrade setuptools

pip3 install --no-cache-dir  --force-reinstall -Iv grpcio==1.36.1

pip3 install pulsar-client==2.7.0

remember you must have python3 installed in your system.

Grigory Zhadko
  • 1,484
  • 1
  • 19
  • 33
Kanak Sharma
  • 51
  • 1
  • 3
4

First try:

pip install unroll

For sure not work :)

Then Try:

pip2 install unroll

Still get error Try:

pip3 install unroll

If pip3 Worked then suggest to change configuration to use pip3 as pip because you will get a lot of issues as the modern now is Python3 = pip3 if you execute a script files.

vvvvv
  • 25,404
  • 19
  • 49
  • 81
Zaman
  • 811
  • 7
  • 15
4

I had the same issue when installing the "Twisted" library and solved it by running the following command on Ubuntu 16.04 (Xenial Xerus):

sudo apt-get install python-setuptools python-dev build-essential
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Adrian Onu
  • 671
  • 7
  • 13
4
pip3 install --upgrade setuptools
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.

To avoid this problem you can invoke Python with -m pip instead of running pip directly.

Use python3 -m pip "command", eg:

python3 -m pip install --user pyqt5 
vvvvv
  • 25,404
  • 19
  • 49
  • 81
Sreekanth
  • 66
  • 2
4

For me this worked

python3 -m pip3 install -U pip

you can also try

python -m pip install -U pip
officialrahulmandal
  • 2,473
  • 1
  • 23
  • 31
3

I had the same problem.

The problem was:

pyparsing 2.2 was already installed and my requirements.txt was trying to install pyparsing 2.0.1 which throw this error

Context: I was using virtualenv, and it seems the 2.2 came from my global OS Python site-packages, but even with --no-site-packages flag (now by default in last virtualenv) the 2.2 was still present. Surely because I installed Python from their website and it added Python libraries to my $PATH.

Maybe a pip install --ignore-installed would have worked.

Solution: as I needed to move forwards, I just removed the pyparsing==2.0.1 from my requirements.txt.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
fadomire
  • 1,865
  • 1
  • 15
  • 23
3

I ran into the same error code when trying to install a Python module with pip. @Hackndo noted that the documentation indicate a security issue.

Based on that answer, my problem was solved by running the pip install command with sudo prefixed:

sudo pip install python-mpd2
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
NP83
  • 172
  • 1
  • 8
2

I tried all of the above with no success. I then updated my Python version from 2.7.10 to 2.7.13, and it resolved the problems that I was experiencing.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
J_Heywood
  • 51
  • 6
  • 1
    And how did you upgrade, manually downloading and building? I'd prefer not to do that as I like it to be managed. When I try "sudo apt-get install python2.7" it tells me that I'm already using the latest version (2.7.12). – Nagev Sep 06 '17 at 12:52
  • @Nagev What version are you on right now? Here is a link that gives instructions on how to specify version. I don't remember exactly how I did it. [link](https://askubuntu.com/questions/101591/how-do-i-install-the-latest-python-2-7-x-or-3-x-on-ubuntu) – J_Heywood Oct 06 '17 at 17:31
  • I'm still on 2.7.12, my original issue is resolved, thanks for the link. I still find that installing via the repositories leads to fewer issues down the road. – Nagev Oct 09 '17 at 07:44
2

That means some packages in pip are old or not correctly installed.

  1. Try checking version and then upgrading pip.Use auto remove if that works.

  2. If the pip command shows an error all the time for any command or it freezes, etc.

  3. The best solution is to uninstall it or remove it completely.

  4. Install a fresh pip and then update and upgrade your system.

  5. I have given a solution to installing pip fresh here - python: can't open file get-pip.py error 2] no such file or directory

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
jack_1729
  • 382
  • 1
  • 3
  • 14
1

next installation helps me:

pip3 install cython
zzfima
  • 1,528
  • 1
  • 14
  • 21
0

I downloaded the .whl file from http://www.lfd.uci.edu/~gohlke/pythonlibs/ and then did:

pip install scipy-0.19.1-cp27-cp27m-win32.whl

Note that the version you need to use (win32/win_amd-64) depends on the version of Python and not that of Windows.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Vysh
  • 718
  • 1
  • 7
  • 20
0

This worked for me:

sudo xcodebuild -license
0

I had this problem using virtualenvs (with pipenv) on my new development setup.

I could only solve it by upgrading the psycopg2 version from 2.6.2 to 2.7.3. More information is at https://github.com/psycopg/psycopg2/issues/594

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Marco Silva
  • 639
  • 7
  • 8
0

Upgrading Python to version 3 fixed my problem. Nothing else did.

Juniper Jones
  • 779
  • 6
  • 10
0

I faced the same problem with the same error message but on Ubuntu 16.04 LTS (Xenial Xerus) instead:

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-w71uo1rg/poster/

I tested all the solutions provided above and none of them worked for me. I read the full TraceBack and found out I had to create the virtual environment with Python version 2.7 instead (the default one uses Python 3.5 instead):

virtualenv --python=/usr/bin/python2.7 my_venv

Once I activated it, I run pip install unirest successfully.

Billal Begueradj
  • 20,717
  • 43
  • 112
  • 130
0

I had the same problem and was able to fix by doing the following.

Windows Python needs Visual C++ libraries installed via the SDK to build code, such as via setuptools.extension.Extension or numpy.distutils.core.Extension. For example, building f2py modules in Windows with Python requires Visual C++ SDK as installed above. On Linux and Mac, the C++ libraries are installed with the compiler.

https://www.scivision.co/python-windows-visual-c++-14-required/

Barrie Reader
  • 10,647
  • 11
  • 71
  • 139
Prometheus
  • 1,148
  • 14
  • 21
0

try on linux:

sudo apt install python-pip python-bluez libbluetooth-dev libboost-python-dev libboost-thread-dev libglib2.0-dev bluez bluez-hcidump
Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
0

Had the same problem on my Win10 PC with different packages and tried everything mentioned so far.

Finally solved it by disabling Comodo Auto-Containment.

Since nobody has mentioned it yet, I hope it helps someone.

DaBrain
  • 3,065
  • 4
  • 21
  • 28
0

Following below command worked for me

[root@sandbox ~]# pip install google-api-python-client==1.6.4
BigData-Guru
  • 1,161
  • 1
  • 15
  • 20
0

Methods to solve setup.pu egg_info issue when updating setuptools or not other methods doesnot works.

  1. If CONDA version of the library is available to install use conda instead of pip.
  2. Clone the library repo and then try installation by pip install -e . or by python setup.py install
Shaurya Uppal
  • 3,410
  • 31
  • 31
0

upgrading python's version did the work for me.

Livne Rosenblum
  • 196
  • 1
  • 12
0

I have just encountered the same problem when trying to pip install -e . a new repo. I did not notice that the contents of setup.py haven't been saved properly and I was effectively running the command with an empty setup.py.

Hence you may experience the same error message if the setup.py of the target package is either empty or malformed.

0

If pip install --upgrade setuptools did not work, try the following instead (python3):

python3 -m pip install --upgrade setuptools

It resolved the issue and now I am able to install unroll via:

python3 -m pip install unroll
Moradnejad
  • 3,466
  • 2
  • 30
  • 52
-1

I solved it on Centos 7 by using:

sudo yum install libcurl-devel
Ingenium
  • 19
  • 1
  • 3
-2

Also, check that you have the package name spelled correctly. If you have the wrong name or misspelled, you will get this error.