What does "error: option --single-version-externally-managed not recognized" indicate?
Asked Answered
F

7

122

I seem to have suddenly started to encounter the error error: option --single-version-externally-managed not recognized when using pip install with various packages (including PyObjC and astropy).

I've never seen this error before, but it's now also showing up on travis-ci builds for which nothing has changed.

Does this error indicate an out of date distribution?

Some incorrectly specified option in setup.py?

Something else entirely?

Fed answered 12/1, 2013 at 18:24 Comment(0)
G
114

New Update:

Install the latest version of setuptools. If you still get the error, install wheel as well.

pip install -U setuptools
pip install -U wheel

Original Answer / More Details:

--single-version-externally-managed is an option used for Python packages instructing the setuptools module to create a Python package which can be easily managed by the host's package manager if needed, like Yum or Apt.

If you're seeing this message, you may have an old version of setuptools or Python. Try using Distribute, which is a newer version of setuptools and is backwards compatible. These packages may expect that you have it already.

https://pypi.python.org/pypi/distribute

Edit: At this point, distribute has been merged into the main setuptools project. Just install the latest version of setuptools. As @wynemo indicated, you may wish to use the --egg option instead, as it's more appropriate for those doing manual installations where you're not intending to create a system package for distribution.

Goerke answered 6/3, 2013 at 21:41 Comment(10)
Can you add which version that showed up in? I'm using setuptools 0.6 and pip doesn't know about a newer version. distribute sounds right, but I can't import it...Fed
You don't import distribute. Distribute is a drop-in replacement and has the same module name. import setuptools is needed for it as well.Goerke
The thing to do, then, is to make sure setuptools is not overriding distribute, if you have both installed. You should install distribute with pip, and then remove setuptools. I imagine that should work.Goerke
It should be added: Don't use distribute anymore. Distribute has been merged back into the setuptools project, so now there is just one setuptools to rule them all.Weathersby
1) People should not be encouraged to use distribute. 2) this doesn't work, instead the --egg option worked for me, as suggested in @wynemo's answer.Benham
@johntex, this answer was made over a year ago, when distribute and setuptools had not yet merged (or if they had, I'd not heard of it). I have updated it now.Goerke
Besides the possibly old versions of setuptools or python, installing wheel as said in Seth's answer. Also solved the issue and it seems better than adding the --egg option.Viera
Neither works for me in 2020. --egg option is gone, and I have the latest setuptools and wheel installed, and still get this error :(. Maybe I need to recreate my conda environment.Lubricious
Same as LOST. --egg is no longer and setuptools and wheel are installed and up to date.Quass
it worked for me. i have pip 18.1 with python 3.7. upgrade setuptools then add wheel.Halfhour
S
135

Add --egg option

pip install --egg SCons

I use pip version 1.4.1

Spermatozoid answered 31/10, 2013 at 2:54 Comment(6)
That was the only solution that actually helped. Recent pip and setuptools were already installed, nevertheless I hat this error.Only
I had this problem with pyenv and this fixed it.Beachlamar
Can someone explain in detail what does this option mean and why does this work?Forbiddance
While this worked for me, I also got the error: "DEPRECATION: --egg has been deprecated and will be removed in the future. This flag is mutually exclusive with large parts of pip, and actually using it invalidates pip's ability to manage the installation process."Omnidirectional
Thanks for the tip. On older version of Ubuntu, mysql-connector-rf refused to insall using pip. None of the other answers worked, and since I had no way of upgrading the OS, I tryed --egg, and voila !Overflight
no such option: --egg in pip 18.1Selfcontradiction
G
114

New Update:

Install the latest version of setuptools. If you still get the error, install wheel as well.

pip install -U setuptools
pip install -U wheel

Original Answer / More Details:

--single-version-externally-managed is an option used for Python packages instructing the setuptools module to create a Python package which can be easily managed by the host's package manager if needed, like Yum or Apt.

If you're seeing this message, you may have an old version of setuptools or Python. Try using Distribute, which is a newer version of setuptools and is backwards compatible. These packages may expect that you have it already.

https://pypi.python.org/pypi/distribute

Edit: At this point, distribute has been merged into the main setuptools project. Just install the latest version of setuptools. As @wynemo indicated, you may wish to use the --egg option instead, as it's more appropriate for those doing manual installations where you're not intending to create a system package for distribution.

Goerke answered 6/3, 2013 at 21:41 Comment(10)
Can you add which version that showed up in? I'm using setuptools 0.6 and pip doesn't know about a newer version. distribute sounds right, but I can't import it...Fed
You don't import distribute. Distribute is a drop-in replacement and has the same module name. import setuptools is needed for it as well.Goerke
The thing to do, then, is to make sure setuptools is not overriding distribute, if you have both installed. You should install distribute with pip, and then remove setuptools. I imagine that should work.Goerke
It should be added: Don't use distribute anymore. Distribute has been merged back into the setuptools project, so now there is just one setuptools to rule them all.Weathersby
1) People should not be encouraged to use distribute. 2) this doesn't work, instead the --egg option worked for me, as suggested in @wynemo's answer.Benham
@johntex, this answer was made over a year ago, when distribute and setuptools had not yet merged (or if they had, I'd not heard of it). I have updated it now.Goerke
Besides the possibly old versions of setuptools or python, installing wheel as said in Seth's answer. Also solved the issue and it seems better than adding the --egg option.Viera
Neither works for me in 2020. --egg option is gone, and I have the latest setuptools and wheel installed, and still get this error :(. Maybe I need to recreate my conda environment.Lubricious
Same as LOST. --egg is no longer and setuptools and wheel are installed and up to date.Quass
it worked for me. i have pip 18.1 with python 3.7. upgrade setuptools then add wheel.Halfhour
P
50

Installing wheel resolved this issue with recent pip (I used 8.1.2):

pip install wheel
Pond answered 24/3, 2016 at 18:50 Comment(3)
You can revert to edit if you like, no problem. If you know the exact version of pip and wheel where it was fixed, it may worth to mention it in case it will be broken again. And also, the answer doesn't explain what is going on anyway.Purifoy
This plus answer from @sparrowt fixed my issueDiphyllous
Fixed the issue for me (python 3.10.2, pip 21.3.1, Win 10 20H2 build 19042.870)Buddhism
A
9

Try upgrading setuptools like this:

pip install --upgrade setuptools

Angioma answered 29/10, 2014 at 14:3 Comment(0)
S
5

I was having this problem. It turned out it was a problem with the file permissions on my pip cache.

If you see a message at the very beginning of your pip output like

The directory '/home/ubuntu/.cache/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.
The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

you might have the same problem. You can resolve it by either ensuring that you have proper file permissions on your pip cache (something like chown -R $(whoami) /home/ubuntu/.cache/pip) or, if you're on a UNIX, you can set the pip cache location with the XDG_CACHE_HOME env var to some folder you do own.

Serpens answered 3/11, 2016 at 4:23 Comment(1)
Surprisingly, it worked for me too (if you use sudo to install the package, make sure to add the -H flag)! I really do not see what the connection is between the cache and the command option error, but never mind.Ingrown
M
2

I tried the above solutions. However, I only can resolve the problem until I do:

sudo pip3 install -U pip (for python3)

Matazzoni answered 24/7, 2020 at 9:59 Comment(0)
C
0

I have this problem on my macbook also when I try to upgrade one python package. I check pip version in OS X, it's too old: 1.1. I use follow cmd to upgrade pip to 1.5.6

easy_install -U pip

Then this error is fixed.

Costanzia answered 24/9, 2014 at 6:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.