pip told me, that i should update.
After i started the command
pip install --upgrade pip
when i use
pip3 --version
i get the following error:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 635, in _build_master
ws.require(__requires__)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 943, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 834, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (pip 8.1.1 (/usr/lib/python3/dist-packages), Requirement.parse('pip==10.0.1'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2927, in <module>
#_call_aside
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2913, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2940, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 637, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 650, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 829, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==10.0.1' distribution was not found and is required by the application
I tried to install pip again:
sudo apt install python3-pip
but it tells me
python3-pip is already the newest version (8.1.1-2ubuntu0.4).
How can i fix this problem?
Thanks.
Try to reinstall it.
apt install --reinstall python3-pip
Since there is still no real answer...
I also had this problem on Linux (CentOS 7) and managed to fix it.
Go to home folder.
$ cd ~
If you need the most recent version:
$ pip3 install --user --upgrade pip
If you need a specific version(like in the question)
$ pip3 install --user pip==10.0.1
Related
I am trying to install few packages and started getting an error. Then used multiple commands in ubuntu to update few things but errors are similar
pip install -U pip setuptools
or
python3 -m pip install --upgrade pip
or
sudo -H pip3 install --upgrade pip
Following is the error sample
user#machine:~$ pip install cryptography
Traceback (most recent call last):
File "/usr/bin/pip", line 11, in <module>
load_entry_point('pip==20.0.2', 'console_scripts', 'pip')()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 490, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2854, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2445, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2451, 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 <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
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 <module>
from pip._internal.cli import cmdoptions
File "/usr/lib/python3/dist-packages/pip/_internal/cli/cmdoptions.py", line 24, in <module>
from pip._internal.exceptions import CommandError
File "/usr/lib/python3/dist-packages/pip/_internal/exceptions.py", line 10, in <module>
from pip._vendor.six import iteritems
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 65, in <module>
vendored("cachecontrol")
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
__import__(modulename, globals(), locals(), level=0)
.
.
.
.
File "<frozen zipimport>", line 259, in load_module
File "/usr/share/python-wheels/urllib3-1.25.8-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py", line 46, in <module>
File "/home/dhome/.local/lib/python3.8/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import SSL, crypto
File "/home/dhome/.local/lib/python3.8/site-packages/OpenSSL/SSL.py", line 19, in <module>
from OpenSSL.crypto import (
File "/home/dhome/.local/lib/python3.8/site-packages/OpenSSL/crypto.py", line 3224, in <module>
utils.deprecated(
TypeError: deprecated() got an unexpected keyword argument 'name'
I have updated the system with apt-get install libffi-dev python-dev python3-dev and
apt-get install build-essential libssl-dev already as suggested in here
Something got broken down in OpenSSL and no command was working with pip afterwards. I was even unable uninstall pip.
I removed installation files manually (most likely not a recommended approach) with
sudo rm -rf /usr/local/lib/python3.8/dist-packages/OpenSSL
sudo rm -rf /usr/local/lib/python3.8/dist-packages/pyOpenSSL-22.1.0.dist-info/
and reinstalled using pip3 install pyOpenSSL==22.0.0. The other version was having some issue as described here.
For me even uninstall of pyOpenSSL was encountering same error TypeError: deprecated() got an unexpected keyword argument 'name'
so first I upgraded pip to 23.0 ,uninstall PyOpenSSL,manually deleted openSSL folder from /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages then installed PyOpenSSL 20.0.0, finally issue resolved.
In windows 10, I am running the terminal as an administrator,
It is giving an exception error.
I am trying to upgrade pip but it is giving an error:
python -m pip install --upgrade pip
Collecting pip
Using cached https://files.pythonhosted.org/packages/43/84/23ed6a1796480a6f1a2d38f2802901d078266bda38388954d01d3f2e821d/pip-20.1.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 19.3.1
Uninstalling pip-19.3.1:
Successfully uninstalled pip-19.3.1
Rolling back uninstall of pip
Moving to c:\users\user1\appdata\roaming\python\python38\scripts\
from C:\Users\user1\AppData\Roaming\Python\Python38\~cripts
Moving to c:\users\user1\appdata\roaming\python\python38\site-packages\pip-19.3.1.dist-info\
from C:\Users\user1\AppData\Roaming\Python\Python38\site-packages\~ip-19.3.1.dist-info
Moving to c:\users\user1\appdata\roaming\python\python38\site-packages\pip\
from C:\Users\user1\AppData\Roaming\Python\Python38\site-packages\~ip
ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\user1\AppData\Roaming\Python\Python38\site-packages\pip\_internal\cli\base_command.py", line 153, in _main
status = self.run(options, args)
File "C:\Users\user1\AppData\Roaming\Python\Python38\site-packages\pip\_internal\commands\install.py", line 446, in run
installed = install_given_reqs(
File "C:\Users\user1\AppData\Roaming\Python\Python38\site-packages\pip\_internal\req\__init__.py", line 58, in install_given_reqs
requirement.install(
File "C:\Users\user1\AppData\Roaming\Python\Python38\site-packages\pip\_internal\req\req_install.py", line 858, in install
self.move_wheel_files(
File "C:\Users\user1\AppData\Roaming\Python\Python38\site-packages\pip\_internal\req\req_install.py", line 487, in move_wheel_files
wheel.move_wheel_files(
File "C:\Users\user1\AppData\Roaming\Python\Python38\site-packages\pip\_internal\wheel.py", line 594, in move_wheel_files
generated_console_scripts = maker.make_multiple(scripts_to_generate)
File "C:\Users\user1\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\distlib\scripts.py", line 402, in make_multiple
filenames.extend(self.make(specification, options))
File "C:\Users\user1\AppData\Roaming\Python\Python38\site-packages\pip\_internal\wheel.py", line 330, in make
return super(PipScriptMaker, self).make(specification, options)
File "C:\Users\user1\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\distlib\scripts.py", line 391, in make
self._make_script(entry, filenames, options=options)
File "C:\Users\user1\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\distlib\scripts.py", line 295, in _make_script
self._write_script(scriptnames, shebang, script, filenames, ext)
File "C:\Users\user1\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\distlib\scripts.py", line 231, in _write_script
launcher = self._get_launcher('t')
File "C:\Users\user1\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\distlib\scripts.py", line 370, in _get_launcher
result = finder(distlib_package).find(name).bytes
AttributeError: 'NoneType' object has no attribute 'bytes'
WARNING: You are using pip version 19.3.1; however, version 20.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
What should I do to upgrade pip?
Thanks
Try this :
easy_install -U pip
If the above command doesn't work, try the following :
python -m pip install -U --force-reinstall pip
This question already has answers here:
Why Python 3.6.1 throws AttributeError: module 'enum' has no attribute 'IntFlag'?
(22 answers)
Closed 2 years ago.
Linux mint
I'm having trouble install python3 packages using pip3
do i need to use "pip install packagename" i think normal pip install's for python2 and pip3 for python3
sudo pip3 install pyinstaller or sudo pip3 install pyodbc
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 /usr/local/lib/python3.6/dist-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-7b88du29/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel
cwd: None
Complete output (39 lines):
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.6/dist-packages/pip/__main__.py", line 23, in <module>
from pip._internal.cli.main import main as _main # isort:skip # noqa
File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/main.py", line 5, in <module>
import locale
File "/usr/lib/python3.6/locale.py", line 16, in <module>
import re
File "/usr/lib/python3.6/re.py", line 142, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 53, in apport_excepthook
if not enabled():
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 24, in enabled
import re
File "/usr/lib/python3.6/re.py", line 142, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
Original exception was:
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.6/dist-packages/pip/__main__.py", line 23, in <module>
from pip._internal.cli.main import main as _main # isort:skip # noqa
File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/main.py", line 5, in <module>
import locale
File "/usr/lib/python3.6/locale.py", line 16, in <module>
import re
File "/usr/lib/python3.6/re.py", line 142, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 /usr/local/lib/python3.6/dist-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-7b88du29/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel Check the logs for full command output.
try this :
pip3 install --upgrade pip setuptools
and then carry on with your installation commands.
Mark this answer correct if your problem is solved.
Thanks
Installing python package failed with error.
I want to install 'tsfresh' package in Notebook VM. But it failed with error from both jupyter terminal and jupyter notebook cell.
from Notebook jupyter notebook cell
!pip install --upgrade tsfresh
error message
Exception:
Traceback (most recent call last):
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/pip/req/req_set.py", line 784, in install
**kwargs
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/pip/wheel.py", line 329, in clobber
os.utime(destfile, (st.st_atime, st.st_mtime))
PermissionError: [Errno 1] Operation not permitted
You are using pip version 9.0.1, however version 19.2.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
In my case following resolved the issue you described:
!pip install --upgrade pip
!pip install --upgrade tsfresh
I'm new to both python and linux. I have python 3.4 on a Uberstudent linux distribution(based on Ubuntu 14.04).
I'm trying to get a progress bar for scripts in python. So I run
pip install progressbar
in the command line. Then I get the error
Command python setup.py egg_info failed with error code 1
After searching for a while I find that this is because pip, setuptools and wheel are not up to date. So I run
python3 -m pip install --upgrade pip setuptools wheel
and I get the output
Downloading/unpacking pip from https://pypi.python.org/packages/b6/ac/7015eb97dc749283ffdec1c3a88ddb8ae03b8fad0f0e611408f196358da3/pip-9.0.1-py2.py3-none-any.whl#md5=297dbd16ef53bcef0447d245815f5144
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB): 1.3MB downloaded
Downloading/unpacking setuptools from https://pypi.python.org/packages/43/41/033a273f9a25cb63050a390ee8397acbc7eae2159195d85f06f17e7be45a/setuptools-38.5.1-py2.py3-none-any.whl#md5=908b8b5e50bf429e520b2b5fa1b350e5
Downloading setuptools-38.5.1-py2.py3-none-any.whl (489kB): 489kB downloaded
Requirement already up-to-date: wheel in /usr/local/lib/python3.4/dist-packages
Installing collected packages: pip, setuptools
Found existing installation: pip 1.5.4
Not uninstalling pip at /usr/lib/python3/dist-packages, owned by OS
Can't roll back pip; was not uninstalled
Cleaning up...
Exception:
Traceback (most recent call last):
File "/usr/lib/python3.4/shutil.py", line 523, in move
os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/tmp/pip_build_martin/pip/pip-9.0.1.dist-info/WHEEL' -> '/usr/local/lib/python3.4/dist-packages/pip-9.0.1.dist-info/WHEEL'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/usr/lib/python3/dist-packages/pip/req.py", line 1436, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/usr/lib/python3/dist-packages/pip/req.py", line 672, in install
self.move_wheel_files(self.source_dir, root=root)
File "/usr/lib/python3/dist-packages/pip/req.py", line 902, in move_wheel_files
pycompile=self.pycompile,
File "/usr/lib/python3/dist-packages/pip/wheel.py", line 206, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/lib/python3/dist-packages/pip/wheel.py", line 200, in clobber
shutil.move(srcfile, destfile)
File "/usr/lib/python3.4/shutil.py", line 535, in move
copy2(src, real_dst)
File "/usr/lib/python3.4/shutil.py", line 245, in copy2
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "/usr/lib/python3.4/shutil.py", line 109, in copyfile
with open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.4/dist-packages/pip-9.0.1.dist-info/WHEEL'
Storing debug log for failure in /home/martin/.pip/pip.log
After some further digging I find that i should try to uninstall it and install it again. But this gives the same permission denied error. And using get-pip.py also gives the same error.
I have no idea what any of this means or why I don't have permission to upgrade pip.
please help me
Try using virtualenv, maybe already installed, so skip the first 2 lines :
$ sudo apt update
$ sudo apt-get install python-virtualenv
$ mkdir test_virtualenv
$ cd test_virtualenv
$ virtualenv .
$ bin/pip install foobar