failed: python -m pip install --upgrade pip [duplicate] - python

This question already has answers here:
pip upgrade issue using python -m pip install --upgrade pip
(3 answers)
Closed 7 months ago.
I get a long error message when i'm trying to manually upgrade my pip version running python -m pip install --upgrade pip but i'm not sure what is going wrong here..
ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\mitch\AppData\Roaming\Python\Python310\site-packages\pip\_internal\cli\base_command.py", line 167, in exc_logging_wrapper
status = run_func(*args)
File "C:\Users\mitch\AppData\Roaming\Python\Python310\site-packages\pip\_internal\cli\req_command.py", line 205, in wrapper
return func(self, options, args)
File "C:\Users\mitch\AppData\Roaming\Python\Python310\site-packages\pip\_internal\commands\install.py", line 407, in run
installed = install_given_reqs(
File "C:\Users\mitch\AppData\Roaming\Python\Python310\site-packages\pip\_internal\req\__init__.py", line 73, in install_given_reqs
requirement.install(
File "C:\Users\mitch\AppData\Roaming\Python\Python310\site-packages\pip\_internal\req\req_install.py", line 773, in install
install_wheel(
File "C:\Users\mitch\AppData\Roaming\Python\Python310\site-packages\pip\_internal\operations\install\wheel.py", line 730, in install_wheel
_install_wheel(
File "C:\Users\mitch\AppData\Roaming\Python\Python310\site-packages\pip\_internal\operations\install\wheel.py", line 647, in _install_wheel
generated_console_scripts = maker.make_multiple(scripts_to_generate)
File "C:\Users\mitch\AppData\Roaming\Python\Python310\site-packages\pip\_vendor\distlib\scripts.py", line 428, in make_multiple
filenames.extend(self.make(specification, options))
File "C:\Users\mitch\AppData\Roaming\Python\Python310\site-packages\pip\_internal\operations\install\wheel.py", line 428, in make
return super().make(specification, options)
File "C:\Users\mitch\AppData\Roaming\Python\Python310\site-packages\pip\_vendor\distlib\scripts.py", line 417, in make
self._make_script(entry, filenames, options=options)
File "C:\Users\mitch\AppData\Roaming\Python\Python310\site-packages\pip\_vendor\distlib\scripts.py", line 317, in _make_script
self._write_script(scriptnames, shebang, script, filenames, ext)
File "C:\Users\mitch\AppData\Roaming\Python\Python310\site-packages\pip\_vendor\distlib\scripts.py", line 247, in _write_script
launcher = self._get_launcher('t')
File "C:\Users\mitch\AppData\Roaming\Python\Python310\site-packages\pip\_vendor\distlib\scripts.py", line 396, in _get_launcher
raise ValueError(msg)
ValueError: Unable to find resource t64.exe in package pip._vendor.distlib

Try reinstalling pip following these directions.
uninstall current pip:
python -m pip uninstall pip setuptools
download get-pip.py from https://bootstrap.pypa.io/get-pip.py
execute get-pip script:
python get-pip.py

Related

Python pip - Cant update pip

I tried upgrading pip on python version 3.6 but failed
I used this command:
python -m pip install --upgrade pip
And got this error:
C:\Users\home>python -m pip install --upgrade pip
Collecting pip
Using cached https://files.pythonhosted.org/packages/cb/28/91f26bd088ce8e22169032100d4260614fc3da435025ff389ef1d396a433/pip-20.2.4-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 7.1.2
Uninstalling pip-7.1.2:
Successfully uninstalled pip-7.1.2
Rolling back uninstall of pip
Exception:
Traceback (most recent call last):
File "C:\Users\home\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\basecommand.py", line 211, in main
status = self.run(options, args)
File "C:\Users\home\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\commands\install.py", line 311, in run
root=options.root_path,
File "C:\Users\home\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\req\req_set.py", line 646, in install
**kwargs
File "C:\Users\home\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\req\req_install.py", line 803, in install
self.move_wheel_files(self.source_dir, root=root)
File "C:\Users\home\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\req\req_install.py", line 998, in move_wheel_files
isolated=self.isolated,
File "C:\Users\home\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\wheel.py", line 449, in move_wheel_files
generated.extend(maker.make(spec))
File "C:\Users\home\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_vendor\distlib\scripts.py", line 353, in make
self._make_script(entry, filenames, options=options)
File "C:\Users\home\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_vendor\distlib\scripts.py", line 257, in _make_script
self._write_script(scriptnames, shebang, script, filenames, ext)
File "C:\Users\home\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_vendor\distlib\scripts.py", line 193, in _write_script
launcher = self._get_launcher('t')
File "C:\Users\home\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_vendor\distlib\scripts.py", line 332, in _get_launcher
result = finder(distlib_package).find(name).bytes
File "C:\Users\home\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_vendor\distlib\resources.py", line 324, in finder
raise DistlibException('Unable to locate finder for %r' % package)
pip._vendor.distlib.DistlibException: Unable to locate finder for 'pip._vendor.distlib'
easy_install --upgrade pip solved it

How do I fix this error (unable to find resource t32.exe) that I get when I try to upgrade pip on Windows 10?

I am getting the following error:
ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_internal\cli\base_command.py", line 186, in _main
status = self.run(options, args)
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_internal\commands\install.py", line 395, in run
installed = install_given_reqs(
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_internal\req\__init__.py", line 67, in install_given_reqs
requirement.install(
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_internal\req\req_install.py", line 809, in install
install_wheel(
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_internal\operations\install\wheel.py", line 607, in install_wheel
install_unpacked_wheel(
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_internal\operations\install\wheel.py", line 548, in install_unpacked_wheel
generated_console_scripts = maker.make_multiple(scripts_to_generate)
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\distlib\scripts.py", line 415, in make_multiple
filenames.extend(self.make(specification, options))
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_internal\operations\install\wheel.py", line 280, in make
return super(PipScriptMaker, self).make(specification, options)
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\distlib\scripts.py", line 404, in make
self._make_script(entry, filenames, options=options)
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\distlib\scripts.py", line 304, in _make_script
self._write_script(scriptnames, shebang, script, filenames, ext)
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\distlib\scripts.py", line 239, in _write_script
launcher = self._get_launcher('t')
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\distlib\scripts.py", line 383, in _get_launcher
raise ValueError(msg)
ValueError: Unable to find resource t32.exe in package pip._vendor.distlib
Please take a look!
This one worked perfectly for me without any additional installations or 3rd party scripts:
python -m pip uninstall pip
python -m ensurepip
python -m pip install -U pip
TRY THIS:
uninstall current pip:
python -m pip uninstall pip setuptools
download get-pip.py from https://bootstrap.pypa.io/get-pip.py
execute get-pip script:
python get-pip.py
Don't forget to mark answer correct if you find it helpful.
Thanks
This worked for me. I visited this page and searched for the missing resource "t32.exe".
Scroll down the page and complete the capture, and click on download. t32.exe file download.
Before you download, make sure your antivirus is on to avoid any problems after the download.
After downloading, go to the directory
C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip_vendor\distlib\
Now copy and paste the downloaded t32.exe file and paste it into the directory and save it. Now run python -m pip install -–upgrade pip again.

Pip won't install anything or upgrade and can't be removed

I'm on Python 3.6 and trying to use py -m pip install discord.py to install the discord package to write a discord bot. However, that command works most of the way until it says Rolling back uninstall of pip and then it crashes like so:
Exception:
Traceback (most recent call last):
File "C:\Program Files\Python36\lib\site-packages\pip\basecommand.py", line 211, in main
status = self.run(options, args)
File "C:\Program Files\Python36\lib\site-packages\pip\commands\install.py", line 311, in run
root=options.root_path,
File "C:\Program Files\Python36\lib\site-packages\pip\req\req_set.py", line 646, in install
**kwargs
File "C:\Program Files\Python36\lib\site-packages\pip\req\req_install.py", line 803, in install
self.move_wheel_files(self.source_dir, root=root)
File "C:\Program Files\Python36\lib\site-packages\pip\req\req_install.py", line 998, in move_wheel_files
isolated=self.isolated,
File "C:\Program Files\Python36\lib\site-packages\pip\wheel.py", line 449, in move_wheel_files
generated.extend(maker.make(spec))
File "C:\Program Files\Python36\lib\site-packages\pip_vendor\distlib\scripts.py", line 353, in make
self._make_script(entry, filenames, options=options)
File "C:\Program Files\Python36\lib\site-packages\pip_vendor\distlib\scripts.py", line 257, in _make_script
self._write_script(scriptnames, shebang, script, filenames, ext)
File "C:\Program Files\Python36\lib\site-packages\pip_vendor\distlib\scripts.py", line 193, in _write_script
launcher = self._get_launcher('t')
File "C:\Program Files\Python36\lib\site-packages\pip_vendor\distlib\scripts.py", line 332, in _get_launcher
result = finder(distlib_package).find(name).bytes
File "C:\Program Files\Python36\lib\site-packages\pip_vendor\distlib\resources.py", line 324, in finder
raise DistlibException('Unable to locate finder for %r' % package)
pip._vendor.distlib.DistlibException: Unable to locate finder for 'pip._vendor.distlib'
You are using pip version 7.1.2, however version 9.0.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
So I try updating pip with py -m pip install --upgrade pip and it works most of the way until Rolling back uninstall of pip where it says:
Exception:
Traceback (most recent call last):
File "C:\Program Files\Python36\lib\site-packages\pip\basecommand.py", line 211, in main
status = self.run(options, args)
File "C:\Program Files\Python36\lib\site-packages\pip\commands\install.py", line 311, in run
root=options.root_path,
File "C:\Program Files\Python36\lib\site-packages\pip\req\req_set.py", line 646, in install
**kwargs
File "C:\Program Files\Python36\lib\site-packages\pip\req\req_install.py", line 803, in install
self.move_wheel_files(self.source_dir, root=root)
File "C:\Program Files\Python36\lib\site-packages\pip\req\req_install.py", line 998, in move_wheel_files
isolated=self.isolated,
File "C:\Program Files\Python36\lib\site-packages\pip\wheel.py", line 449, in move_wheel_files
generated.extend(maker.make(spec))
File "C:\Program Files\Python36\lib\site-packages\pip_vendor\distlib\scripts.py", line 353, in make
self._make_script(entry, filenames, options=options)
File "C:\Program Files\Python36\lib\site-packages\pip_vendor\distlib\scripts.py", line 257, in _make_script
self._write_script(scriptnames, shebang, script, filenames, ext)
File "C:\Program Files\Python36\lib\site-packages\pip_vendor\distlib\scripts.py", line 193, in _write_script
launcher = self._get_launcher('t')
File "C:\Program Files\Python36\lib\site-packages\pip_vendor\distlib\scripts.py", line 332, in _get_launcher
result = finder(distlib_package).find(name).bytes
File "C:\Program Files\Python36\lib\site-packages\pip_vendor\distlib\resources.py", line 324, in finder
raise DistlibException('Unable to locate finder for %r' % package)
pip._vendor.distlib.DistlibException: Unable to locate finder for 'pip._vendor.distlib'
You are using pip version 7.1.2, however version 9.0.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Oddly enough, trying to just run pip in the command prompt it gives me 'pip' is not recognized as an internal or external command,
operable program or batch file.
I've tried uninstalling with py -m pip uninstall pip setuptools and reinstalling by running py get-pip.py on the python file, none of which seem to do anything.
So I have no way of uninstalling, reinstalling, or upgrading pip, and I can't use the current version of pip to install anything. I've searched for hours and tried changing my PATH variable and looking at file path limits, but I'm completly stuck and very new to this type of thing. I'm on Windows 10.
EDIT: "pip", "pip3", "python" and "python3" commands don't work. "py" command works.
EDIT: I seem to have gotten around using pip this time. I downloaded the discord package from github then followed instructions here which say to run py setup.py install --user. Still, I'd like to be able to use pip in the future.
There are couple solutions. You can reinstall python and during installation add it to environmental variable. Another way would be adding scripts and python to environmental path. http://www.correlatedsolutions.com/support/index.php?/Knowledgebase/Article/View/85/1/running-python-scripts-from-anywhere-under-windows.

pip install permission error

I just recently re-installed Python 2 and Python 3 via homebrew and everything looked ok. However I updated pip3 as well as pip after installing python and then, when trying to install virtualenv, I get the below errors:
~> pip install virtualenv Collecting virtualenv Downloading virtualenv-13.1.2-py2.py3-none-any.whl (1.7MB) 100% |
████████████████████████████████| 1.7MB 361kB/s Installing collected
packages: virtualenv Exception: Traceback (most recent call last):
File "/usr/local/lib/python3.4/site-packages/pip/basecommand.py", line 211, in main status = self.run(options, args)
File "/usr/local/lib/python3.4/site-packages/pip/commands/install.py", line 311, in run root=options.root_path, File "/usr/local/lib/python3.4/site-packages/pip/req/req_set.py", line 646, in install **kwargs
File "/usr/local/lib/python3.4/site-packages/pip/req/req_install.py", line 803, in install self.move_wheel_files(self.source_dir, root=root)
File "/usr/local/lib/python3.4/site-packages/pip/req/req_install.py", line 998, in move_wheel_files isolated=self.isolated, File "/usr/local/lib/python3.4/site-packages/pip/wheel.py", line 479, in move_wheel_files maker.make_multiple(['%s = %s' % kv for kv in console.items()]) File "/usr/local/lib/python3.4/site-packages/pip/_vendor/distlib/scripts.py", line 364, in make_multiple filenames.extend(self.make(specification, options))
File "/usr/local/lib/python3.4/site-packages/pip/_vendor/distlib/scripts.py", line 353, in make self._make_script(entry, filenames, options=options)
File "/usr/local/lib/python3.4/site-packages/pip/_vendor/distlib/scripts.py", line 257, in _make_script self._write_script(scriptnames, shebang, script, filenames, ext) File "/usr/local/lib/python3.4/site-packages/pip/_vendor/distlib/scripts.py", line 231, in _write_script self._fileop.write_binary_file(outname, script_bytes)
File "/usr/local/lib/python3.4/site-packages/pip/_vendor/distlib/util.py", line 388, in write_binary_file with open(path, 'wb') as f:
PermissionError: [Errno 13] Permission denied: '/usr/local/bin/virtualenv'
pip freeze then seems to think virtualenv is installed but none of it's commands work.
Interestingly if I try to uninstall virtualenv it seems to have it attached to the Python 3 installed by brew installed of the Python 2 version brew installed.
Uninstalling virtualenv-13.1.2:
/usr/local/lib/python3.4/site-packages/__pycache__/virtualenv.cpython-34.pyc
/usr/local/lib/python3.4/site-packages/virtualenv-13.1.2.dist-info/DESCRIPTION.rst
/usr/local/lib/python3.4/site-packages/virtualenv-13.1.2.dist-info/METADATA
/usr/local/lib/python3.4/site-packages/virtualenv-13.1.2.dist-info/RECORD
/usr/local/lib/python3.4/site-packages/virtualenv-13.1.2.dist-info/WHEEL
/usr/local/lib/python3.4/site-packages/virtualenv-13.1.2.dist-info/entry_points.txt
/usr/local/lib/python3.4/site-packages/virtualenv-13.1.2.dist-info/metadata.json
/usr/local/lib/python3.4/site-packages/virtualenv-13.1.2.dist-info/pbr.json
/usr/local/lib/python3.4/site-packages/virtualenv-13.1.2.dist-info/top_level.txt
/usr/local/lib/python3.4/site-packages/virtualenv.py
/usr/local/lib/python3.4/site-packages/virtualenv_support/__init__.py
/usr/local/lib/python3.4/site-packages/virtualenv_support/__pycache__/__init__.cpython-34.pyc
/usr/local/lib/python3.4/site-packages/virtualenv_support/argparse-1.3.0-py2.py3-none-any.whl
/usr/local/lib/python3.4/site-packages/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl
/usr/local/lib/python3.4/site-packages/virtualenv_support/setuptools-18.2-py2.py3-none-any.whl
/usr/local/lib/python3.4/site-packages/virtualenv_support/wheel-0.24.0-py2.py3-none-any.whl
Proceed (y/n)?
pip freeze gives me:
~> pip freeze
pbr==1.6.0
virtualenv==13.1.2
virtualenv-clone==0.2.6
wheel==0.24.0
so virtualenv already installed but doesn't work for some reason.
For python 2.7 I believe pip is referenced by pip2. Your permission error is easily fixed by running the command as sudo.

Python Pip Install "Egg" Error (Pandas and other modules)

Having issues installing some python modules (for example pandas) and also had some issues installing ipython notebook.
This error seems to have come up before for other folks (Python pip install fails: invalid command egg_info), but they were using Python 2.7, whereas I'm using 2.6 (default with my Mac OS 10.6). Also I tried easy_install -U setuptools and pip install --upgrade setuptools but neither worked.
This is the error I get for installing pandas:
Command python setup.py egg_info failed with error code 1 in /private/var/folders/Wm/WmmbYincEnuCrAMtGBudAk+++TM/-Tmp-/pip_build_AWal/pandas
Storing debug log for failure in /Users/AWal/Library/Logs/pip.log
For installing iPython, this is the error that I get:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/req.py", line 1435, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/req.py", line 671, in install
self.move_wheel_files(self.source_dir, root=root)
File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/req.py", line 901, in move_wheel_files
pycompile=self.pycompile,
File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/wheel.py", line 341, in move_wheel_files
generated.extend(maker.make_multiple(['%s = %s' % kv for kv in console.items()]))
File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/_vendor/distlib/scripts.py", line 316, in make_multiple
filenames.extend(self.make(specification, options))
File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/_vendor/distlib/scripts.py", line 305, in make
self._make_script(entry, filenames, options=options)
File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/_vendor/distlib/scripts.py", line 209, in _make_script
self._write_script(scriptnames, shebang, script, filenames, ext)
File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/_vendor/distlib/scripts.py", line 189, in _write_script
self._fileop.write_binary_file(outname, script_bytes)
File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/_vendor/distlib/util.py", line 384, in write_binary_file
with open(path, 'wb') as f:
IOError: [Errno 13] Permission denied: '/usr/local/bin/sphinx-apidoc'
Storing debug log for failure in /Users/AWal/Library/Logs/pip.log
Any thoughts on what to do?
UPDATE:
When I do sudo pip install pandas (another module that I can't install), I get a long long traceback with the end error message:
RuntimeError: Broken toolchain: cannot link a simple C program
And traceback (a sample of it of the 100 or so lines) looks like this:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/private/tmp/pip_build_root/pandas/setup.py", line 619, in <module>
**setuptools_kwargs)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/core.py", line 113, in setup
File "build/bdist.macosx-10.6-universal/egg/setuptools/dist.py", line 266, in __init__
File "build/bdist.macosx-10.6-universal/egg/setuptools/dist.py", line 312, in fetch_build_eggs
File "build/bdist.macosx-10.6-universal/egg/pkg_resources/__init__.py", line 753, in resolve
File "build/bdist.macosx-10.6-universal/egg/pkg_resources/__init__.py", line 1005, in best_match
File "build/bdist.macosx-10.6-universal/egg/pkg_resources/__init__.py", line 1017, in obtain
File "build/bdist.macosx-10.6-universal/egg/setuptools/dist.py", line 379, in fetch_build_egg
File "build/bdist.macosx-10.6-universal/egg/setuptools/command/easy_install.py", line 619, in easy_install
A permission Denied message would suggest you to run your command as root as suggested by Hackaholic.
try sudo pip install YOUR_PACKAGE
You might also want to have a look at virtualenv to use a more isolated environment.
Under debian based distributions, you might install python-virtualenv package with apt-get install python-virtualenv.
Then create a virtual environment names whatever by typing virtualenv whatever (this will create a folder whatever inside your current folder.
Then cd to it and type bin/activate to enter this virtual environment.
From there try again your pip install command.
Might help
UPDATE :
You might try to use the suggested solutions available here
To sumup, try to add export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future inside ~/.bash_profile
This question comes first in Google, but the second one actually worked:
pip install -U setuptools
pip install ez_setup

Categories