I am trying to get started with python on VS Code but I keep getting this error when I want to install the matplotlib library.
7 Answers
Consider using the --user
option or check the permissions.
pip install -U --upgrade pip
-
My upvote. I was getting the same message in
Azure Databricks
. I ran the command you suggested and it successfully upgraded pip from20.2.4
to latest version122.0.3
– namMar 2, 2022 at 23:58
I tried a lot of different ones but the one below worked for me
pip3 install --upgrade pip --user
Three things to do:
- Run this in your bash terminal
python3 pip install --upgrade pip
Configure your VS Code environment for python 3.x
Run your file using
python3 [filename.py]
If the above suggestion fails, you should try:
pip install --upgrade pip
-
I run tried this. It gives me
Requirement already satisfied: pip in /Users/xxx
– wzsoJan 19, 2022 at 9:18 -
Collecting pip Using cached files.pythonhosted.org/packages/46/28/… Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-build-86IKY3/pip/setup.py", line 7 def read(rel_path: str) -> str: ^ SyntaxError: invalid syntax ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-86IKY3/pip– AlexisAug 1, 2022 at 4:34
I added the folder than tried pip install --upgrade pip and it worked. You may have to show your hidden folders to follow the path.
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases. To fix this problem, I'm trying to install it using this command: python -m pip install --upgrade pip setuptools virtualenv)
You should use the command behind:
python3 install --upgrade pip
python3.9
instead ofpython
in your terminal andpython3.9 -m pip
instead ofpip
python3
because you're trying to run your Python code on the Linux machine, not your Windows machine, so even though VS Code is set to the correct Python version, the subsytem you're attempting to run your code on isn't (again, because Linux and Mac both think the commandpython
means "launch Python 2", which is fair since Python 2 is installed by default on Linux and MacOS).