Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

pip 6 is out #35194

Closed
tdsmith opened this issue Dec 22, 2014 · 27 comments
Closed

pip 6 is out #35194

tdsmith opened this issue Dec 22, 2014 · 27 comments
Assignees
Labels

Comments

@tdsmith
Copy link
Contributor

tdsmith commented Dec 22, 2014

pip 6 will solve a lot of problems Homebrew python users have reported, which is great! I want to wait a few days to see if any bugfix releases emerge, migrate CPython 3 away from ensurepip, and bundle the pip and setuptools sdists into the bottles for CPython3, pypy, and pypy3 like we do for CPython 2.

@tdsmith tdsmith added the python label Dec 22, 2014
@tdsmith tdsmith self-assigned this Dec 22, 2014
@tdsmith
Copy link
Contributor Author

tdsmith commented Dec 22, 2014

NB, users that want to upgrade pip don't need us to take any action and should just pip install --upgrade --no-use-wheel pip. Making this change on our end will only affect users who reinstall Python.

[ed 2014-12-24 15:02 utc-5: add --no-use-wheel]

@Mx-Glitter
Copy link

Upgrading pip with pip install --upgrade pip breaks it on my computer:

$ pip install --upgrade pip
Downloading/unpacking pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-6.0.2-py2.py3-none-any.whl#md5=26404d27a64a40d4c358a2405b16d043
  Downloading pip-6.0.2-py2.py3-none-any.whl (1.3MB): 1.3MB downloaded
Installing collected packages: pip
  Found existing installation: pip 1.5.6
    Uninstalling pip:
      Successfully uninstalled pip
Successfully installed pip
Cleaning up...
$ pip
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
  File "build/bdist.macosx-10.10-x86_64/egg/pkg_resources.py", line 2951, in <module>
    working_set = WorkingSet._build_master()
  File "build/bdist.macosx-10.10-x86_64/egg/pkg_resources.py", line 563, in _build_master
    return cls._build_from_requirements(__requires__)
  File "build/bdist.macosx-10.10-x86_64/egg/pkg_resources.py", line 576, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "build/bdist.macosx-10.10-x86_64/egg/pkg_resources.py", line 755, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pip==1.5.6

Changing 1.5.6 to 6.0.2 in /usr/local/Cellar/python/2.7.9/bin/pip fixes it though.

#!/usr/local/opt/python/bin/python2.7
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==6.0.2','console_scripts','pip'
__requires__ = 'pip==6.0.2'
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.exit(
        load_entry_point('pip==6.0.2', 'console_scripts', 'pip')()
    )

@tdsmith
Copy link
Contributor Author

tdsmith commented Dec 23, 2014

Upgrading pip should have overwritten /usr/local/bin/pip. Any idea why it didn't? 😬

@DomT4
Copy link
Member

DomT4 commented Dec 23, 2014

I needed to sudo to upgrade my pip. It failed repeatedly without sudo, where every other upgrade works without sudo. Not sure if that's expected or not.

@tdsmith
Copy link
Contributor Author

tdsmith commented Dec 23, 2014

That's probably a symptom of having sudo pip installed something in the
past; judicious application of the chown hammer is probably the "right"
solution.

@DomT4
Copy link
Member

DomT4 commented Dec 23, 2014

Yeah, I seem to recall having to sudo pip a couple of times before. I try not to, but sometimes things bork.

sudo chown -R `whoami` /usr/local
sudo chown -R `whoami` ~/.pip
sudo chown -R `whoami` ~/.python-eggs
sudo chown -R `whoami` ~/.python_history

Should do the job, I presume?

@Mx-Glitter
Copy link

@tdsmith I'll take a look tomorrow at my installation (I'm not on the right computer now) to let you know if I find something interesting. I can reproduce my problem with brew reinstall python && pip install --upgrade pip, and from what I recall, my brew installation is really vanilla (brew doctor outputs nothing).

@xu-cheng
Copy link
Member

Also, for the heads up. pip3 install --upgrade pip would overwrite /usr/local/bin/pip. It's a bit of strange as pip3 upgrade overwrote the file it shouldn't have, while pip upgrade doesn't overwrite the right file.

@tdsmith
Copy link
Contributor Author

tdsmith commented Dec 24, 2014

Thanks for pointing that out, @xu-cheng; that looks hard to avoid since python and python3 (and system python, in fact) share a script directory. I don't think there's a "--install-suffix" option or similar that we can pass to prevent that. It's probably worth a note in caveats.

@DomT4
Copy link
Member

DomT4 commented Dec 24, 2014

Still getting some weird errors. Fresh install of Python, and chowned everything even slightly Python related. Hit the exact same problem as Triiistan did above.

What am I doing wrong? 😸.

@tdsmith
Copy link
Contributor Author

tdsmith commented Dec 24, 2014

Ah: @Triiistan, this is an old pip bug. It should be fixed in the pip we're all trying to install. ;) Dominyk, you've actually just hit two of those in a row.

The workaround for @Triiistan's issue (which I can repro on a clean VM) is pip install --upgrade --no-use-wheel pip. I'll edit my comment above.

Previously, previously, resolution.

Dominyk, you should chown everything back and delete anything that find /private -name pip_build* 2>/dev/null finds. sudo worked because the pip_build directories are named by user.

@DomT4
Copy link
Member

DomT4 commented Dec 24, 2014

you should chown everything back

My Python lib/python2.7 directory matches the permissions of the lib/python3.4 directory:

 ls -l /usr/local/lib/python3.4
drwxr-xr-x  18 Dominyk  wheel  612 Dec 21 16:13 site-packages

ls -l /usr/local/lib/python2.7
drwxr-xr-x  122 Dominyk  wheel  4148 Dec 24 19:57 site-packages

Is that okay?

Thanks for the find hint, that removed the need to sudo anything. pip installed fine without sudo after that. Still getting the traceback pkg_resources.DistributionNotFound: error when I call pip though 😿.

@DomT4
Copy link
Member

DomT4 commented Dec 24, 2014

I seem to be hitting the same thing as @Triiistan with the

# EASY-INSTALL-ENTRY-SCRIPT: 'pip==1.5.6','console_scripts','pip'
__requires__ = 'pip==1.5.6'

problem.

@DomT4
Copy link
Member

DomT4 commented Dec 24, 2014

Bingo. pip install --upgrade --no-use-wheel pip did the trick. Cheers Tim. I'll stop spamming up your thread with errors now, Apologies. (And Merry Christmas).

@Mx-Glitter
Copy link

Thanks a lot @tdsmith!

@xu-cheng
Copy link
Member

Also, for the heads up. pip3 install --upgrade pip would overwrite /usr/local/bin/pip.

I found the things get worse. The new pip3 also overwrote the scripts like /usr/local/bin/ipython as well. This becomes a serious issue now.

@tdsmith
Copy link
Contributor Author

tdsmith commented Dec 25, 2014

That's not new behavior but I appreciate that it's annoying. Invoking modules like python -m ipython is an alternative. I don't think there's a configuration change Homebrew can make to mitigate the conflict without separating the script paths for the pythons.

@xu-cheng
Copy link
Member

While, this is an old bug resurfacing. At least, it used to work fine. I have reported it to pip: pypa/pip#2274.

@wfdd
Copy link

wfdd commented Dec 26, 2014

Also, for the heads up. pip3 install --upgrade pip would overwrite /usr/local/bin/pip.

Actually, pip3 install --upgrade pip won't overwrite the pip exec; pip3 install --upgrade --no-use-wheel pip, on the other hand, will.

~> pip3 install --upgrade pip
Downloading/unpacking pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-6.0.3-py2.py3-none-any.whl#md5=1ac546485f75a8cf257a8f1a40aa51f5
  Downloading pip-6.0.3-py2.py3-none-any.whl (1.3MB): 1.3MB downloaded
Installing collected packages: pip
  Found existing installation: pip 1.5.6
    Uninstalling pip:
      Successfully uninstalled pip
Successfully installed pip
Cleaning up...
~> cat (which pip)
#!/usr/local/opt/python/bin/python2.7
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==1.5.6','console_scripts','pip'
__requires__ = 'pip==1.5.6'
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.exit(
        load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
    )

@tdsmith
Copy link
Contributor Author

tdsmith commented Dec 26, 2014

Oh, that was a use case that worked because of the pip bug that's been fixed. :/ C'est la guerre.

@wfdd
Copy link

wfdd commented Dec 26, 2014

The easiest thing to do to update both pips properly, I've found, is to update python2 pip last.

~> python3 -m pip install --upgrade --no-use-wheel pip
...
~> python -m pip install --upgrade --no-use-wheel pip   # overwrites pip3's `pip`
...

Verifying it's worked:

~> for val in (ls -1 (brew --prefix)/bin/pip*)
       echo -n "$val: "; eval $val --version
   end
/usr/local/bin/pip: pip 6.0.3 from /usr/local/lib/python2.7/site-packages (python 2.7)
/usr/local/bin/pip2: pip 6.0.3 from /usr/local/lib/python2.7/site-packages (python 2.7)
/usr/local/bin/pip2.7: pip 6.0.3 from /usr/local/lib/python2.7/site-packages (python 2.7)
/usr/local/bin/pip3: pip 6.0.3 from /usr/local/lib/python3.4/site-packages (python 3.4)
/usr/local/bin/pip3.4: pip 6.0.3 from /usr/local/lib/python3.4/site-packages (python 3.4)

[Updated on 2014-12-31 to use python -m. Doh.]

@xu-cheng
Copy link
Member

Actually, pip3 install --upgrade pip won't overwrite the pip exec;

While, in my case:

$ head -1 /usr/local/bin/pip
#!/usr/local/opt/python/bin/python2.7

$ pip3 install pip --upgrade --force
Collecting pip
  Using cached pip-6.0.3-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 6.0.3
    Uninstalling pip-6.0.3:
      Successfully uninstalled pip-6.0.3

Successfully installed pip-6.0.3

$ head -1 /usr/local/bin/pip
#!/usr/local/opt/python3/bin/python3.4

@methane
Copy link
Contributor

methane commented Dec 31, 2014

Python 2's pip and Python 3's are conflict.
One solution is using pip2 or pip3.
Another solution is like @wfdd said. Upgrade your prefer pip at last.

FYI, python -m pip is safer than pip command.

$ python3 -m pip install -U pip setuptools   # pip is pip3
$ python2 -m pip install -U pip setuptools   # pip is pip2

@bcomnes
Copy link
Contributor

bcomnes commented Jan 1, 2015

Should the formula Caveats be updated to reflect pip install --upgrade --no-use-wheel pip?

@methane
Copy link
Contributor

methane commented Jan 1, 2015

@bcomnes I think it's a bit late. --no-use-wheel is not required after pip6 is installed.

@bcomnes
Copy link
Contributor

bcomnes commented Jan 1, 2015

The bottle and the source install still come with pip 1.5.6.

@tdsmith tdsmith closed this as completed in 3776c35 Jan 1, 2015
@DomT4
Copy link
Member

DomT4 commented Jan 1, 2015

All the Python formulae should now come with the new major pip and setuptools releases. brew update && brew reinstall xyz will get you them immediately.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants