1 - Environment
pip version: 20.1.1-2
Python version: 2.x, 3.0, 3.8.
OS: linux
2 - How to Reproduce
Just try to use pip.
NOTE: pythonx -m pip does not exist
PIP WORK USING python3.9 -m pip
3 - Command
pip
4 - Output
Traceback (most recent call last):
File “/usr/bin/pip”, line 11, in
load_entry_point(‘pip==20.1.1’, ‘console_scripts’, ‘pip’)()
File “/usr/lib/python3/dist-packages/pkg_resources/ init .py”, line 473, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File “/usr/lib/python3/dist-packages/pkg_resources/ init .py”, line 2843, in load_entry_point
return ep.load()
File “/usr/lib/python3/dist-packages/pkg_resources/ init .py”, line 2447, in load
return self.resolve()
File “/usr/lib/python3/dist-packages/pkg_resources/ init .py”, line 2453, in resolve
module = import (self.module_name, fromlist=[’ name '], level=0)
File “/usr/lib/python3/dist-packages/pip/_internal/cli/main.py”, line 10, in
from pip._internal.cli.autocompletion import autocomplete
File “/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py”, line 9, in
from pip._internal.cli.main_parser import create_main_parser
File “/usr/lib/python3/dist-packages/pip/_internal/cli/main_parser.py”, line 7, in
from pip._internal.cli import cmdoptions
File “/usr/lib/python3/dist-packages/pip/_internal/cli/cmdoptions.py”, line 24, in
from pip._internal.cli.progress_bars import BAR_TYPES
File “/usr/lib/python3/dist-packages/pip/_internal/cli/progress_bars.py”, line 7, in
from pip._vendor import six
File “/usr/lib/python3/dist-packages/pip/_vendor/ init .py”, line 93, in
vendored(“requests.packages.urllib3.contrib.ntlmpool”)
File “/usr/lib/python3/dist-packages/pip/_vendor/ init .py”, line 36, in vendored
import (modulename, globals(), locals(), level=0)
File “”, line 991, in _find_and_load
File “”, line 975, in _find_and_load_unlocked
File “”, line 655, in _load_unlocked
File “”, line 618, in _load_backward_compatible
File “”, line 259, in load_module
File “/usr/share/python-wheels/urllib3-1.25.9-py2.py3-none-any.whl/urllib3/contrib/ntlmpool.py”, line 9, in
File “/usr/local/lib/python3.8/dist-packages/ntlm/ntlm.py”, line 112
print “NTLM_NegotiateUnicode set”
^
SyntaxError: Missing parentheses in call to ‘print’. Did you mean print(“NTLM_NegotiateUnicode set”)?
I really need help :
I’ve been trying --reinstall and does not work.
I believe that you are using the wrong pip with the wrong python version.
From what I am seeing, you are trying to use the pip for python2.x with python3.x. The most simple solution is to use the corresponding pip versions with the python version.
For example:
pip -> python2.7
pip3 -> python3 - python3.7 most usually python3.6
pip3.8 -> python3.8
and so on ...
Alternative Solutions include ...
Solution #1:
Go to your .bashrc file and add
alias pip=python3.8 -m pip # 3.8 can be replaced with pip version
Save and restart your terminal.
Solution #2:
Uninstall python3.8 and build it from source. Check this tutorial on how to do that.
Thanks to Deep_Thoughts to try help me, dude i solve the error and conflites manually installing pip in each python version using get-pip.py script.
https://bootstrap.pypa.io/get-pip.py
I download it and run for every python version. now
pip
is run right.
Related
I would like to install this library with pip: ikpy library. However pip gives the error below:
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
IOError: [Errno 2] No such file or directory: '/tmp/pip-build-oYTjdr/ikpy/setup.py'
What I understand from the error, pip cannot find setup.py, becuase library has setup.cfg instead. I tried to upgrade pip and got a different error.
$ pip install --upgrade pip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-KCnfi9/pip/setup.py", line 7
def read(rel_path: str) -> str:
^
SyntaxError: invalid syntax
I also tried pip3:
$ pip3 install ikpy
ModuleNotFoundError: No module named 'pip._vendor.pkg_resources'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 13, in <module>
from pip.exceptions import InstallationError, CommandError, PipError
File "/usr/lib/python3/dist-packages/pip/exceptions.py", line 6, in <module>
from pip._vendor.six import iteritems
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 75, in <module>
vendored("pkg_resources")
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
__import__(modulename, globals(), locals(), level=0)
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2927, in <module>
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2913, in _call_aside
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2952, in _initialize_master_working_set
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 956, in subscribe
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2952, in <lambda>
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2515, in activate
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2097, in declare_namespace
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2047, in _handle_ns
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2066, in _rebuild_mod_path
AttributeError: '_NamespacePath' object has no attribute 'sort'
What should I do?
Python 3.7.10, python3-pip: (8.1.1-2ubuntu0.6).
Note:
I solved with these commands, now it can be installed with pip3:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
pip3 install --upgrade setuptools
(this message was created before the question was updated with pip3)
It's likely that the pip command you use is for Python 2. Can you try with pip3 instead?
From ikpy library:
Starting with IKPy v3.1, only Python 3 is supported.
For versions before v3.1, the library can work with both versions of Python (2.7 and 3.x).
You can download the latest version compatible with python 2 here:
https://github.com/Phylliade/ikpy/releases/tag/v3.0.1
note: using python 2.7 is not recommended because support for Python version 2.7 will end on January 1, 2020
Upgrade Your Pip
pip install --upgrade pip
then install ikpy Now it's should up and running ;-)
pip install ikpy
Installed and Checked now on: Ubuntu 20.04, Pip 21.3, Python 3.8.10
When every I try to use pip3, either with pip3 install package or pip3 list, or any other command that includes pip3 I get this error
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 33, in vendored
__import__(vendored_name, globals(), locals(), level=0)
ImportError: No module named 'pip._vendor.pkg_resources'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 13, in <module>
from pip.exceptions import InstallationError, CommandError, PipError
File "/usr/lib/python3/dist-packages/pip/exceptions.py", line 6, in <module>
from pip._vendor.six import iteritems
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 75, in <module>
vendored("pkg_resources")
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
__import__(modulename, globals(), locals(), level=0)
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2927, in <module>
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2913, in _call_aside
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2952, in _initialize_master_working_set
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 956, in subscribe
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2952, in <lambda>
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2515, in activate
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2097, in declare_namespace
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2047, in _handle_ns
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2066, in _rebuild_mod_path
AttributeError: '_NamespacePath' object has no attribute 'sort'
So far I have already tried to run sudo apt remove python3-pip then running sudo apt install python3-pip but that doesnt work. And I also looked at doing this, look at the code portion below, to try and uninstall and then reinstall pip3, but nothing I have done so far seems to be working.
sudo apt purge python3-pip
sudo rm -rf '/usr/lib/python3/dist-packages/pip'
sudo apt install python3-pip
cd
cd .local/lib/python3/site-packages
sudo rm -rf pip*
cd
cd .local/lib/python3.5/site-packages
sudo rm -rf pip*
sudo pip3 install xlwt
Are you sure that installed pip is linked to pip3? I had a similar error some time ago. The installed pip for my python version was simply linked to pip, while there was an old version liked to pip3. Just try run:
pip --version
This shows you if its pip for python 2 or 3.
Using debian 8(jessie) amd64 with python 2.7.9. I tried following commands:
pip install --upgrade pip
pip install --upgrade scrapy
after that, I am getting following pip error
root#debian:~# pip
Traceback (most recent call last):
File "/usr/local/bin/pip", line 11, in <module>
load_entry_point('pip==8.1.2', 'console_scripts', 'pip')()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 567, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2604, in load_entry_point
return ep.load()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2264, in load
return self.resolve()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2270, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/local/lib/python2.7/dist-packages/pip/__init__.py", line 16, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/local/lib/python2.7/dist-packages/pip/vcs/mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 39, in <module>
from pip._vendor import requests, six
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py", line 53, in <module>
from .packages.urllib3.contrib import pyopenssl
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py", line 54, in <module>
import OpenSSL.SSL
File "/usr/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/usr/lib/python2.7/dist-packages/OpenSSL/rand.py", line 11, in <module>
from OpenSSL._util import (
File "/usr/lib/python2.7/dist-packages/OpenSSL/_util.py", line 4, in <module>
binding = Binding()
File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 89, in __init__
self._ensure_ffi_initialized()
File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 113, in _ensure_ffi_initialized
libraries=libraries,
File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/bindings/utils.py", line 80, in build_ffi
extra_link_args=extra_link_args,
File "/usr/local/lib/python2.7/dist-packages/cffi/api.py", line 437, in verify
lib = self.verifier.load_library()
File "/usr/local/lib/python2.7/dist-packages/cffi/verifier.py", line 114, in load_library
return self._load_library()
File "/usr/local/lib/python2.7/dist-packages/cffi/verifier.py", line 225, in _load_library
return self._vengine.load_library()
File "/usr/local/lib/python2.7/dist-packages/cffi/vengine_cpy.py", line 174, in load_library
lst = list(map(self.ffi._get_cached_btype, lst))
File "/usr/local/lib/python2.7/dist-packages/cffi/api.py", line 409, in _get_cached_btype
BType = type.get_cached_btype(self, finishlist)
File "/usr/local/lib/python2.7/dist-packages/cffi/model.py", line 61, in get_cached_btype
BType = self.build_backend_type(ffi, finishlist)
File "/usr/local/lib/python2.7/dist-packages/cffi/model.py", line 507, in build_backend_type
base_btype = self.build_baseinttype(ffi, finishlist)
File "/usr/local/lib/python2.7/dist-packages/cffi/model.py", line 525, in build_baseinttype
% self._get_c_name())
cffi.api.CDefError: 'point_conversion_form_t' has no values explicitly defined: refusing to guess which integer type it is meant to be (unsigned/signed, int/long)
googled for several similar problem, cffi or cryptography may cause this problem, but i can't find any clear way to fix it.
Got the exact same error today, but in a different situation. I suspect this is related to cryptography module.
What helped me was to install a specific version of cffi package:
pip install cffi==1.7.0
i removed cffi and tried this command to install cffi 1.7.0:
pip install cffi==1.7.0
it worked, thank you, alecxe and moeseth :)
My situation was like #alecxe
This works:
pip install cffi==1.7.0
Had the same problem as moeseth: the pip install something answers are pretty useless when all pip commands throw the original exception. Installing cffi v. 1.7.0 also solved the problem and this is how I managed to do it in Debian Jessie without relying on pip:
Temporarily add testing repos to /etc/apt/sources.list, e.g.,
deb http://ftp.fi.debian.org/debian/ testing main contrib non-free
deb-src http://ftp.fi.debian.org/debian/ testing main contrib non-free
Run sudo apt-get update
Use aptitude or apt-get to upgrade python-cffi and python-cffi-backend to v. 1.7.0
Remove the lines added in step 1. from /etc/apt/sources.list and run sudo apt-get update
So I was in a situation where pip was failing. I had to remove python-cffi and then install it from pip with a correct version
sudo apt-get remove python-cffi
pip install cffi==1.7.0
Works like a charm.
It is a tough situation I am dealing with. Here is short version of my problem:
I am working on Ubuntu 12.04
I would like to install Python 3.5.x with openCV library. I would also like to use pip3 for managing package installation of python.
Here is how the version of my pythons looks like
$ python --version
Python 2.7.3
$ python3 --version
Python 3.5.2
So far it looks I have achieved my goal.
When I use virtualenv to manage python3 libraries:
virtualenv -p /usr/bin/python3 py3env
source py3env/bin/activate
I see the version of my python as follows:
(py3env)yxxxxa#yxxxxa-Precision-M4800:~$ python3 --version
Python 3.2.3
I seems there is another version of python in my machine 3.2.3 messing up with the version 3.5.2 that I have installed. This is my first problem.
The second related problem is that I am unable to install pip 3. There is this error I receive due to the same python version conflict:
$ pip
/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/_vendor /pkg_resources/__init__.py:80: UserWarning: Support for Python 3.0-3.2 has been dropped. Future versions will fail here.
warnings.warn(msg)
Traceback (most recent call last):
File "/usr/local/bin/pip", line 9, in <module>
load_entry_point('pip==8.1.2', 'console_scripts', 'pip')()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 337, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2280, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 1990, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/__init__.py", line 16, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/vcs/mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/download.py", line 36, in <module>
from pip.utils.ui import DownloadProgressBar, DownloadProgressSpinner
File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/utils/ui.py", line 15, in <module>
from pip._vendor.progress.bar import Bar, IncrementalBar
File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/_vendor/progress/bar.py", line 48
empty_fill = u'∙'
^
SyntaxError: invalid syntax
yasharatena#yasharatena-Precision-M4800:~$ pip3
/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/_vendor/pkg_resources/__init__.py:80: UserWarning: Support for Python 3.0-3.2 has been dropped. Future versions will fail here.
warnings.warn(msg)
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 9, in <module>
load_entry_point('pip==8.1.2', 'console_scripts', 'pip3')()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 337, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2280, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 1990, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/__init__.py", line 16, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/vcs/mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/download.py", line 36, in <module>
from pip.utils.ui import DownloadProgressBar, DownloadProgressSpinner
File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/utils/ui.py", line 15, in <module>
from pip._vendor.progress.bar import Bar, IncrementalBar
File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/_vendor/progress/bar.py", line 48
empty_fill = u'∙'
^
SyntaxError: invalid syntax
What are your expert opinions about the stated problem? Any cool idea to handle this? Thanks alot in advance
This solved my first problem. Now the second problem aslo remains, how
can I install pip3 under python 3.5.2 (preferably using viretualenv) ?
Here is answer:
python3 -m virtualenv py3env
source py3env/bin/activate
Python 3.5 should have pip by default, also after above commands You can use pip:)
For example :
python -m pip install requests
EDIT:
Here You could find very good explainations if You still need install pip after create virtualenv.
I first installed distribute, then pip with easy_install but when I run:
sudo pip install virtualenv
I get these error messages:
Traceback (most recent call last):
File "/usr/bin/pip", line 8, in ? sys.exit(
File "/usr/lib/python2.4/site-packages/distribute-0.6.49-py2.4.egg/pkg_resources.py", line 345, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.4/site-packages/distribute-0.6.49-py2.4.egg/pkg_resources.py", line 2381, in load_entry_point
return ep.load()
File "/usr/lib/python2.4/site-packages/distribute-0.6.49-py2.4.egg/pkg_resources.py", line 2087, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/lib/python2.4/site-packages/pip-1.4-py2.4.egg/pip/__init__.py", line 10, in ?
from pip.util import get_installed_distributions, get_prog
File "/usr/lib/python2.4/site-packages/pip-1.4-py2.4.egg/pip/util.py", line 17, in ?
from pip.vendor.distlib import version
File "/usr/lib/python2.4/site-packages/pip-1.4-py2.4.egg/pip/vendor/__init__.py", line 8
from __future__ import absolute_importSyntaxError: from __future__ imports must occur at the beginning of the file
I do not know what to do to install virtualenv properly now?
You appear to be using Python 2.4 - try creating the virtualenv with a version of Python which includes from __future__ import absolute_import (Python 2.5 or later).
You can specify which Python to use like this:
virtualenv -p /usr/bin/python2.7