Unable to upgrade python six package in mac osx 10.10.2
Asked Answered
B

10

22

I am trying to install latest version of six python package but I have following issues. Can't get rid of six 1.4.1 in mac OSX 10.10.2

sudo pip install six --upgrade
Requirement already up-to-date: six in /Library/Python/2.7/site-packages
Cleaning up...

pip search six
six - Python 2 and 3 compatibility utilities
INSTALLED: 1.9.0 (latest)

python -c "import six; print six.version"
1.4.1

which -a python
/usr/bin/python
which -a pip
/usr/local/bin/pip

What is wrong here? Can't upgrade six!

Bouldon answered 7/4, 2015 at 7:4 Comment(4)
Try uninstalling six: pip uninstall six. Then do an install.Housetop
It seems as if python and pip do not belong to the same interpreter. Try python -m pip install --upgrade six instead. If this does not help consider adding the output of which -a python and which -a pip to your question.Foliation
@DanielRoseman No, I am not in virtualenv.Bouldon
This is one of the reasons I largely switched to Node and NPM. These sick issues with Python dependencies.Ewell
I
11

Mac OS X's default python is installed as a framework. Under the framework directory, there is an 'Extras' directory and six package is already placed there.

/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six.py

According to the description (https://github.com/MacPython/wiki/wiki/Which-Python), /System/Library/Frameworks/Python.framework/Versions/2.7/Extras is listed before /Library/Python/2.7/site-packages in module search path. This means all packages already exists in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras can't upgrade.

Maybe you should install python manually and not to use default python.

Indignation answered 16/4, 2015 at 6:16 Comment(4)
Another solution is setting PYTHONPATH like export PYTHONPATH=/Library/Python/2.7/site-packages. All paths specified in PYTHONPATH is high priority than OS X framework python libraries.Indignation
This worked for me: python -m pip install --upgrade sixMonandrous
My six wouldn't update because the Caches library in my Library did not have the right permissions/ownership (according to pip). @Monandrous 's solution worked for me too (osx 10.11). Thanks!Tensible
this didn't work for me.. still getting the same error, can't upgrade the framework packages. As a newbie, would i find somewhere a step by step work around for this ? i have python 3 installed as well as python 2. could that be a problem ? i m on mac os x 10.11.1Winnah
K
24

I resolved the problem by the following method.

  1. Download the six-1.10.0.tar.gz package
  2. Use this command to install it.

python setup.py install

This works because it installs the new version of six to /Library/Python/2.7/site-packages/ which is searched before /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/

Kathrynekathy answered 4/5, 2016 at 11:19 Comment(2)
Cleanest solution if you want to leave the OS X python intact.Estrella
This should have been the best answer. Quick. Six Package 1.11.0 link=> [linuxfromscratch.org/blfs/view/basic/ch06s08.html]Louisalouisburg
F
17

Your pip binary belongs to /usr/local/bin/python, whereas python points to /usr/bin/python. As a consequence

pip install --upgrade six

will install to /usr/local/bin/python.

The command below will make sure that the right version of pip is used:

python -m pip install --upgrade six
Foliation answered 7/4, 2015 at 18:24 Comment(4)
your answer helped me. I'm using Mac os x 10.10.5Kinetic
i did the change, but still getting the same error message.. i m on 10.11.1Winnah
@Raghav, it's probably best if you document exactly what you did and the errors you get and then start a new question that links to my answer.Foliation
Trying to upgrade six is the objective, apparently, its part of the system packages, here's the message ---------------------------------- OSError: [Errno 1] Operation not permitted: '/var/folders/98/kcksn_cn7619mkjsmlgqt8lc0000gn/T/pip-mSyToD-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info' -------------- i have the same spec, --->$ which -a pip ==>/Library/Frameworks/Python.framework/Versions/3.4/bin/pip ===>/usr/local/bin/pip --->$ which -a python ===>/usr/bin/pythonWinnah
F
16

For me, just using homebrew fixed everything.

brew install python
Forefront answered 27/11, 2015 at 11:13 Comment(0)
H
16

What worked for me was to use easy_install instead of pip.

easy_install -U six

Easy_install managed to upgrade the package even when pip failed.

Headline answered 2/5, 2017 at 8:0 Comment(3)
Amazing. Things like this make me wonder why I use computers for anything. What's so wrong with pen and paper?Aurelea
I think this is what worked for me in MacOS 10.13.3 however it didn't take effect immediately, I think I just had to restart the terminal. six 1.4.0 is still in the /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python dir though, inactive.Crabbe
I ended up installing what I was ultimately trying to install that depended on six (awscli) with easy_install as well. Seems like pip install might be broken on Mac OS XMelancholia
I
11

Mac OS X's default python is installed as a framework. Under the framework directory, there is an 'Extras' directory and six package is already placed there.

/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six.py

According to the description (https://github.com/MacPython/wiki/wiki/Which-Python), /System/Library/Frameworks/Python.framework/Versions/2.7/Extras is listed before /Library/Python/2.7/site-packages in module search path. This means all packages already exists in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras can't upgrade.

Maybe you should install python manually and not to use default python.

Indignation answered 16/4, 2015 at 6:16 Comment(4)
Another solution is setting PYTHONPATH like export PYTHONPATH=/Library/Python/2.7/site-packages. All paths specified in PYTHONPATH is high priority than OS X framework python libraries.Indignation
This worked for me: python -m pip install --upgrade sixMonandrous
My six wouldn't update because the Caches library in my Library did not have the right permissions/ownership (according to pip). @Monandrous 's solution worked for me too (osx 10.11). Thanks!Tensible
this didn't work for me.. still getting the same error, can't upgrade the framework packages. As a newbie, would i find somewhere a step by step work around for this ? i have python 3 installed as well as python 2. could that be a problem ? i m on mac os x 10.11.1Winnah
R
4

I came across this exact issue when using pip to install the openstack client. My fix was to use easy_install instead of pip, as it utilizes /Library/Python/2.7/site-packages/ for module installation instead of the /System/Library/Frameworks/Python.framework/Versions/2.7/Extras. If this workaround is not an option for you, then I can confirm that @Masakazu Matsushita has the correct workaround of setting PYTHONPATH to /Library/Python/2.7/site-packages. To implement that workaround, add this line:

export PYTHON_PATH=/Library/Python/2.7/site-packages

to your ~/.bashrc and ~/.profile (if its a GUI Python application that you are trying to install).

Rectus answered 22/1, 2016 at 20:15 Comment(1)
Wait, is it PYTHONPATH or PYTHON_PATH?Pigeontoed
C
3

Try these steps

  1. Reinstall python using brew

    $ brew install python

  2. Resolve missing symlink problem

    $ brew link --overwrite python

  3. Reboot system or run

    $ hash -r python

Cultivar answered 22/4, 2016 at 11:43 Comment(0)
A
3

Try with pip2 its work for me pip2 install -U six

Athlete answered 3/10, 2017 at 22:31 Comment(0)
V
1

While one or another of the above solutions may work for you, I think it's important to understand what is going on and what are the options that you have. I found this (rather lengthy) description to be very useful: it starts with outlining the options and only then suggests solutions.

Virulence answered 20/4, 2016 at 16:11 Comment(0)
J
1

In the end, the problem for me was that I was using the IPython shell.

which ipython returned /usr/local/bin/ipython and upon inspection this file declared at the top #!/usr/bin/python, which seemed to be circumventing all my best efforts to use the correct python location.

Simply changing this line #!/usr/local/bin/python to point to the correct python version then meant IPython used the correct six module.

Jam answered 23/5, 2017 at 14:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.