Python pip - Cant update pip - python

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

Related

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

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

pip install packages in Python runing into errors

I am trying to install a few packages in Python. For example trying to install quantmod but was told to upgrade my pip which I did through Anaconda prompt but when I go to try and install quantmod again I get the same error message. This happens with all packages I am trying to install...
I am running pip install quantmod and to upgrade pip this python -m pip install --upgrade pip
(base) C:\Users\USER\AppData\Local\Programs\Python\Python36-32>pip install quantmod
Collecting quantmod
Could not find a version that satisfies the requirement quantmod (from versions: )
No matching distribution found for quantmod
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
(base) C:\Users\USER\AppData\Local\Programs\Python\Python36-32>python -m pip install --upgrade pip
Requirement already up-to-date: pip in c:\users\USER\appdata\local\programs\python\python36-32\lib\site-packages (10.0.1)
(base) C:\Users\USER\AppData\Local\Programs\Python\Python36-32>pip install quantmod
Collecting quantmod
Could not find a version that satisfies the requirement quantmod (from versions: )
No matching distribution found for quantmod
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
EDIT 1 with pip install --upgrade pip:
Exception:
Traceback (most recent call last):
File "C:\Users\USER\Anaconda3\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Users\USER\Anaconda3\lib\site-packages\pip\commands\install.py", line 335, in run
wb.build(autobuilding=True)
File "C:\Users\USER\Anaconda3\lib\site-packages\pip\wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "C:\Users\USER\Anaconda3\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\Users\USER\Anaconda3\lib\site-packages\pip\req\req_set.py", line 487, in _prepare_file
req_to_install, finder)
File "C:\Users\USER\Anaconda3\lib\site-packages\pip\req\req_set.py", line 428, in _check_skip_installed
req_to_install, upgrade_allowed)
File "C:\Users\USER\Anaconda3\lib\site-packages\pip\index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "C:\Users\USER\Anaconda3\lib\site-packages\pip\index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "C:\Users\USER\Anaconda3\lib\site-packages\pip\index.py", line 568, in _get_pages
page = self._get_page(location)
File "C:\Users\USERR\Anaconda3\lib\site-packages\pip\index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "C:\Users\USER\Anaconda3\lib\site-packages\pip\index.py", line 811, in get_page
inst = cls(resp.content, resp.url, resp.headers)
File "C:\Users\USER\Anaconda3\lib\site-packages\pip\index.py", line 731, in __init__
namespaceHTMLElements=False,
TypeError: parse() got an unexpected keyword argument 'transport_encoding'
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
(base) C:\Users\USER\AppData\Local\Programs\Python\Python36-32>
EDIT:
(base) C:\Users\USER\AppData\Local\Programs\Python\Python36-32>pip install Gensim
Collecting Gensim
Exception:
Traceback (most recent call last):
File "C:\Users\USER\Anaconda3\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Users\USER\Anaconda3\lib\site-packages\pip\commands\install.py", line 335, in run
wb.build(autobuilding=True)
File "C:\Users\USER\Anaconda3\lib\site-packages\pip\wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "C:\Users\USER\Anaconda3\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\Users\USER\Anaconda3\lib\site-packages\pip\req\req_set.py", line 554, in _prepare_file
require_hashes
File "C:\Users\USER\Anaconda3\lib\site-packages\pip\req\req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "C:\Users\USER\Anaconda3\lib\site-packages\pip\index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "C:\Users\USER\Anaconda3\lib\site-packages\pip\index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "C:\Users\USER\Anaconda3\lib\site-packages\pip\index.py", line 568, in _get_pages
page = self._get_page(location)
File "C:\Users\USER\Anaconda3\lib\site-packages\pip\index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "C:\Users\USER\Anaconda3\lib\site-packages\pip\index.py", line 811, in get_page
inst = cls(resp.content, resp.url, resp.headers)
File "C:\Users\USER\Anaconda3\lib\site-packages\pip\index.py", line 731, in __init__
namespaceHTMLElements=False,
TypeError: parse() got an unexpected keyword argument 'transport_encoding'
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

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.

Error upgrading pip on Mac: IOError: [Errno 1] Operation not permitted: '/bin/pip'

I'm on OS X El Capitan 10.11.6 with homebrew installed python 2.7. I've removed and re-installed python via homebrew with no joy. pip can neither install site-packages or update itself.
Trying to upgrade pip and receive the following error:
$ pip install --upgrade pip
Collecting pip
Using cached pip-9.0.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 8.1.2
Uninstalling pip-8.1.2:
Successfully uninstalled pip-8.1.2
Rolling back uninstall of pip
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/site-packages/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 742, in install
**kwargs
File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 831, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 1032, in move_wheel_files
isolated=self.isolated,
File "/usr/local/lib/python2.7/site-packages/pip/wheel.py", line 463, in move_wheel_files
generated.extend(maker.make(spec))
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.py", line 372, in make
self._make_script(entry, filenames, options=options)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.py", line 276, in _make_script
self._write_script(scriptnames, shebang, script, filenames, ext)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.py", line 250, in _write_script
self._fileop.write_binary_file(outname, script_bytes)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/distlib/util.py", line 405, in write_binary_file
with open(path, 'wb') as f:
IOError: [Errno 1] Operation not permitted: '/bin/pip'
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Found the answer here: Python: pip tries to install to /bin directory
I had a .pydistutils.cfg file in my home directory that was a workaround for something else (I forget what) and once removed it solved all my pip problems.

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.

Categories