Windows 11 Python can't update pip - python

When I try to update pip on VS Code and also on cmd,
This appears and I have no idea why.
I have uninstalled and reinstalled pip and Python 3 times now. Help would be appreciated.

Have you tried to run the command suggested by pip itself?
"To update, run: python.exe -m pip install --upgrade pip"
Just paste it into cmd.

Try this:
Run your Command Prompt as administrator
Copy/Paste the line below in the terminal and press OK
C:\Users\your_username\AppData\Local\Programs\Python\Python310\python.exe -m pip install --upgrade pip
Note : Your Python installation folder may be different. Make sure to put the convenient path. You can get yours by running this code in any python interpreter :
import sys
locate_python = sys.exec_prefix
print(locate_python)

Related

"bash: pip: command not found" when using "pip install ..."

On Linux Ubuntu with python 3.6.9
When i try to download pip, it says i already have it. So when i try to pip install ... it gives me error "bash: pip: command not found".
When i type "which pip" in the terminal it gives me nothing and creates a new line.
(While also it doesn't work in the normal terminal) I should also say I'm trying to do this in a virualenv. It gives the same errors when trying to install pip (I already have it) and when trying to use pip ("bash: pip: command not found")
echo $PATH output: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
sorry if this doesn't make sense, kinda a noob
Try the following:
python -m pip install ....
python3 -m pip install ....
py3 -m pip install ....
As #S3DEV commented, there could be a problem with your path variables, so trying python before pip could solve. Those other variations (python3 and py) can also work.

Warning: pip is being invoked by an old script wrapper

WARNING: pip is being invoked by an old script wrapper. This will fail
in a future version of pip. Please see
https://github.com/pypa/pip/issues/5599 for advice on fixing the
underlying issue. To avoid this problem you can invoke Python with '-m
pip' instead of running pip directly.
When I directly type pip list to the terminal, I get the above warning. What does it mean exactly?
Should I always use it as python3 -m pip list? If I use it in that way, same output (list of packages) comes up without any warning.
p.s. : I am on ubuntu 18.10
I faced the same issue but on Windows. Reinstalling pip worked for me. You can force a reinstall of pip with:
python -m pip install --upgrade --force-reinstall pip
For Python3 Versions:
python3 -m pip install --upgrade --force-reinstall pip
I also faced the same problem when I switched to zsh shell from bash.
The solution was simple but I didn't notice it at first.
After I installed pip, I saw this warning
pip is being invoked by an old script wrapper
First I tried this solution
python3.8 -m pip install --upgrade --force-reinstall pip
But then I ran into this issue:
Then I searched how to add PYTHONPATH. I opened my .zshrc and say these lines were commented
# If you come from bash you might have to change your $PATH.
I uncommented the line that followed, and my misery vanished.
Now when I ran,
python3.8 -m pip install --upgrade --force-reinstall pip
Then the warnings of not in path disappeared in thin air, leaving me with a clean output.
I hope this would help anybody who ran into the same problem.
Let me preface this by saying I am still very green with python and linux in general so I may be off base with my guidance here but I digress...
You might want check the location of the pip module you are invoking when you use the pipcommand. for me, I found out that when I would update and modify the pip command, it would update the pip file on my ~/.local/bin directory but when I would run it, it would default to the pip command located in the /usr/local/bin directory.
run the command
pip install --upgrade pip
for me this command returned:
Defaulting to user installation because normal site-packages is not writeable
Requirement already up-to-date: pip in ./.local/lib/python3.6/site-packages (20.1.1)
Note the file location and version (in bold).
check your path variables and the default pip that executes default by running the these 2 commands respectively
echo $PATH
and
which pip
god willing, they'll be congruent otherwise you'll have to either alter your the path variable directories making sure that the directory for your desired pip module is first or you'll have to delete the pip file from the director that you dont want use (i.e. the directory that came up when you ran which pip if that is not the same as the directory listed when you updated pip)
For me, removing the pip files in the usr/local/bin worked like a charm. Also check that the pip files that you want to use are referencing the correct version of python at the top of their scripts
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from pip._internal.cli.main import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())
The other file originally referenced usr/bin/python (Python 2.7) instead of usr/bin/python3 (python 3.6.9) as I wanted initially.
Like I said before, I am just getting started with linux and python so take this with a grain of salt. Nevertheless, I no longer get this pip warning after taking these steps. Let me know if this helps at all.
I've encountered the same problem after I updated pip to 20.1.x version through Pycharm. I've found one way to ensure that you can use pip install xxx in emergency case:
Open the folder containing pip (e.g. C:\Program Files\Python37\Lib in my win10 laptop)
You may find two folders separately belongs to the old version pip and newly installed pip (e.g. ./pip19_xxx for your old one and ./pip for the newly installed one
Delete the folder of the new version pip (e.g. ./pip)
(IF NECESSARY) Change environment PATH in windows10
Test pip install xxx or python -m pip install xxx in cmd, it should work by now
After the PIP upgrade, because the boot file (/usr/bin/pip) has not been changed, the old boot file is still used,
Old PIP startup file:
#!/usr/bin/python3
# GENERATED BY DEBIAN
import sys
# Run the main entry point, similarly to how setuptools does it, but because
# we didn't install the actual entry point from setup.py, don't use the
# pkg_resources API.
from pip import main
if __name__ == '__main__':
sys.exit(main())
New PIP startup file:
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from pip._internal.cli.main import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())
The solution is as follows:
vi open /usr/bin/pip to add new code to save,
After this operation, there is no need to add "python -m" to run pip, and there will be no warning
You can solve it by upgrading pip:
pip install --upgrade pip
You can solve this by executing the following commands.
python -m pip install --upgrade --force-reninstall pip
Add python to the path in ~/.bash_profile.
like PATH=$PATH:/usr/local/bin
Just use
python -m pip install [module_name]
This will resolve warning issue
This worked for me.
python3 -m pip install <package name>
You can solve this problem by doing the following
1.Check that you are not having two versions of python.If you are having then uninstall one.
If the problem does not resolve after doing these then uninstall all the python installed in your pc and then again install it.
I ran into the same issue on Ubuntu 18.04 with python 3.6 after I ran pip3 install --upgrade pip. (The original pip version installed by apt install python3-pip was 9.0, but I wanted pip >= 10.0 so I could use pip list -v.)
Step 1: Check the pip paths
I found that there were several pips installed in various locations on my machine, and it was causing problems. Use these commands to see which pips are being executed.
pip --version
pip3 --version
type -a pip pip3 # show all the locations for pip and pip3
Step 2: Fix the pip paths
This step will be highly individual. You have to figure out for yourself which one to keep and which ones to remove. Here are some example commands that may be helpful:
# remove ~/.local/bin/pip
cd ~/.local/bin
mv pip pip.bak
hash -r # important, reset bash command cache!
# remove the old pip 9.0
sudo apt purge python3-pip
Step 3: Upgrade pip
Run the commands from Step 1 again to verify everything looks good. Then upgrade pip:
pip3 install --upgrade pip
# if you get permission denied above, the install for --user
pip3 install --user --upgrade pip
# validate everything looks right
pip --version
pip3 --version
type -a pip pip3 # show all the locations for pip and pip3

CMDER not finding sudo and pip commands

So I have been using regular windows command prompt and wanted to try using bash as most forums give commands in bash and it's a little cumbersome to try to find the translation to windows. Currently trying out Spotify API and I want to run a virtual environment.
I do the following windows command and everything runs fine:
[WINDOWS]
python -m pip install virtualenv
this, does not:
[BASH]
pip install virtualenv
and I get returned bash: pip: command not found
SO I go to install pip using sudo easy_install pip and get returned bash: sudo: command not found.
I am running CMDER as admin in bash so I thought ok, I will try easy_install pip and returned bash: easy_install: command not found. SO i went to the actual python directory and went to install pip again and no luck.
Any insight on how I can address this?
[Windows]]1[Bash]2
You can try to install pip by downloading the get-pip.py from here and then run it using python get-pip.py
After that
You might need to set your Environment Variable to include PIP in your path. you can use Environment Variables in Control Panel and add the path to System Variables.
I ran into this issue as well. Not sure what causes it, but switching to cmd.exe and running pip install ... worked without issue.

pip is not responding in python

I run python 2.7
I did as follow but still receiving the following strange feedback, not sure why.
Import pip
pip install pandas
can someone explain to me what's the error mean?
error message I receive trying to install
pip install pandas is not a command that you run from within your Python script. It is run at the command line.
Alternatively, you can do this from within your code:
pip.main(['install', 'pandas'])
Try running pip from the command line (bash/terminal on linux/osx or cmd.exe in Windows), not from a python script.
pip install pandas
If you're not using virtualenv, you might need administrative privileges.
On Linux/OSX use sudo:
sudo pip install pandas
On Windows run Command Prompt as Administrator:
https://technet.microsoft.com/en-us/library/cc947813%28v=ws.10%29.aspx

Cannot find packages installed with pip

I'm using Mac OS X 10.6.8 and python 2.7.3. I'm trying to use pip to install ipython, and running sudo pip install ipython installs successfully, but when I try to run ipython I get "command not found". I cannot find where pip installs packages, or why it's not linking correctly. I'm very new with this, please help!
I had this problem and fixed it by restarting my terminal.
For me, on an OS X 10.5, the default installation of Python is soft-linked to /Library/Frameworks/Python.framework/Versions/Current/, and ipython is at /Library/Frameworks/Python.framework/Versions/Current/bin/ipython. Make sure the bin directory it's sitting in is in your shell PATH. Type:
$ export PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:$PATH
, then try running ipython. If that works, edit your ~/.profile to update your PATH permanently.
I fixed this problem by using sudo. sudo will install the ipython in system folder.
pip uninstall ipython
and than
sudo pip install ipython
Similar to acjay, for me worked with:
/Library/Frameworks/Python.framework/Versions/Current/lib/python2.7/site-packages/
adding to path (10.12 Sierra).

Categories

Resources