how can i fix this problem with pip on osx? - python

I am trying all day to reinstall pip or pip3
I always have the same problem when i try to run it:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/bin/pip", line 6, in <module>
from pkg_resources import load_entry_point
ImportError: cannot import name 'load_entry_point'
I tried to uninstall and reinstall pip with curl and then with easy_install and now it's a big mess.
I am on the last Mac-osx release
I guess i should remove pip and pip3 completely, but how?

Related

Can't install pip3 for python 3.9

I've tried everything, I've tried doing the following:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.9 get-pip.py
But that just gives me the following error:
root#ubuntu18:~# python3.9 get-pip.py
Traceback (most recent call last):
File "/root/get-pip.py", line 24184, in <module>
main()
File "/root/get-pip.py", line 139, in main
bootstrap(tmpdir=tmpdir)
File "/root/get-pip.py", line 120, in bootstrap
args = determine_pip_install_arguments()
File "/root/get-pip.py", line 65, in determine_pip_install_arguments
import setuptools # noqa
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 14, in <module>
from setuptools.dist import Distribution, Feature
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 24, in <module>
from setuptools.depends import Require
File "/usr/lib/python3/dist-packages/setuptools/depends.py", line 7, in <module>
from .py33compat import Bytecode
File "/usr/lib/python3/dist-packages/setuptools/py33compat.py", line 54, in <module>
unescape = getattr(html, 'unescape', html_parser.HTMLParser().unescape)
AttributeError: 'HTMLParser' object has no attribute 'unescape'
And i've sat hours trying different fixes, when i do pip3 --version it shows that its using python 3.6
And your thinking, why do i need to install it for python 3.9, well the py app im using only supports that and when i try to run it using python3.9 app.py it says that there is missing pip3 modules even though its installed.
I hope someone can tell me a fix, or what's causing the error.
Thanks.
This same thing happened to me, my installation wouldn’t compile correctly because a file in python wasn’t updating from a older version. Just reinstall python 3.9 and retry installing pip3 then it should work. It sucks to do but solves more issues down the road.
Try this command to upgrade setuptools
pip3 install --upgrade setuptools
If that doesnt work , try these
pip3 install --upgrade pip
pip3 install --upgrade distlib

pip install - NameError:name __main__ is not defined

I'm currently having some trouble installing the pygments-package. I tried to run:
pip install pygments
But, however, I get the following Error:
Traceback (most recent call last):
File "/usr/bin/pip", line 11, in <module>
sys.exit(__main__._main())
NameError: name '__main__' is not defined
What's the problem?
Edit: My pip version is 9.0.3
I don't remember exactly what it is, but for me it helped simple sudo pip install pygments or pip3 install pygments

How do I fix this error I'm getting when I try to install this package with pip install?

I'm new to Python and I've been trying to start a Discord bot on my computer, but whenever I try to install sudo pip install discord.py I get the following error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-QOFKFs/aiohttp/setup.py", line 60, in <module>
raise RuntimeError("aiohttp requires Python 3.4.2+")
RuntimeError: aiohttp requires Python 3.4.2+
I'm running Linux Mint 18.2 and I'm almost 100% positive I've got Python and Pip up to date.
Have you check pip is really pip for python3 and python's version?
You could using pip for python2.
Like this link

ImportError for `python-six` package on Arch Linux

>pip
Traceback (most recent call last):
File "/usr/bin/pip", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 49, in <module>
from pkg_resources.extern import six
File "/usr/lib/python3.6/site-packages/pkg_resources/extern/__init__.py", line 61, in load_module
"distribution.".format(**locals())
ImportError: The 'six' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.
I did reinstall with pacman -S python as well as pacman -S python-setuptools, pacman -S python-packaging, and pacman -S python-six, nothing helps.
Almost every other python applications follow the same pattern now (such as qutebrowser and buku.
I think it happened right after I installed vmware-vcli manually following the ArchWiki guide on the topic (I know its perl and might be unrelated though).
Downgrading python-setuptools as suggesting in similar posts by installing the earlier version in /var/cache/pacman/pkg did not fix the problem.
I faced exactly the same problem running pip3 install --upgrade pip.
However, pip3.5 install --upgrade pip worked for me. After this upgrade the error message of pip3 disappeared.

Python 2.7 cannot install modules after El Capitan upgrade

After upgrading my MacOS to El Capita 10.11.6, I cannot run my code because of missing imports.
This one works
$ python -m pip install --user six
But this one fails to install the module.
$ sudo pip install six
Traceback (most recent call last):
File "/usr/local/bin/pip", line 6, in <module>
from pkg_resources import load_entry_point
File "/Users/mpme/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 48, in <module>
import six
ImportError: No module named six
Could someone let me know the differences ? Why one works and the other does not?
$ python --version
Python 2.7.13

Categories