pip 10 isn't working
shigabeev opened this issue · 7 comments
- Pip version: 10
- Python version: 3.6.4
- Operating system: Mac OS X High Sierra
Description:
I was installing packages for itorch and pip stated that new version available.
Since then it cannot install new packages.
I run:
$ pip install --upgrade pip
And it was successfully installed. But seems like something doesn't installed well as
What I've run:
$ pip install --upgrade numpy
Traceback (most recent call last):
File "/usr/local/opt/python/libexec/bin/pip", line 7, in
from pip import main
ImportError: cannot import name 'main'
$ pip install torch
Traceback (most recent call last):
File "/usr/local/opt/python/libexec/bin/pip", line 7, in
from pip import main
ImportError: cannot import name 'main'
See this comment.
Hey @shigabeev!
It seems you're facing a similar issue as #5221. You can find a summary for resolving your problems in #5221 (comment).
If that helps, please feel free to close this issue. :)
you can upgrade pip using pip install --user --upgrade pip
but then make sure you are using the upgraded version of pip (not your distro version) from ~/.local/bin/pip
you can do this by editing your ~/.bashrc
to have
export PATH="~/.local/bin:$PATH"
just edit pip entrance file like this (worked for me):
change main
to __main__
.
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from pip import __main__
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(__main__._main())
@OIdiotLin That's not a good way to fix this problem and might break at some point in the future.
As I mentioned in the linked comment above, this issue can be resolved in much better, supported ways.
Anyways, since OP hasn't responded for a week, I'll close this issue as resolved.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.