1

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.

enter image description here

10
  • 3
    What about the error is not clear? It is very literal: you are using Python 2.7 and are using an outdated pip version. It is telling you to use Python 3.4+ and how to upgrade to the latest pip version. Aug 7, 2021 at 1:27
  • I don't understand how its still using python 2.7 when I have python 3.9? @GinoMempin Aug 7, 2021 at 1:32
  • 3
    Try using the command python3.9 instead of python in your terminal and python3.9 -m pip instead of pip Aug 7, 2021 at 1:35
  • 1
    Does this answer your question? How do I access updated Python 3.9 in VS Code via command line? Aug 7, 2021 at 1:37
  • 1
    Looks like you're using WSL which means that you need to be calling the Python binary with 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 command python means "launch Python 2", which is fair since Python 2 is installed by default on Linux and MacOS).
    – ddejohn
    Aug 7, 2021 at 3:10

7 Answers 7

7

Consider using the --user option or check the permissions.

pip install -U --upgrade pip

1
  • My upvote. I was getting the same message in Azure Databricks. I ran the command you suggested and it successfully upgraded pip from 20.2.4 to latest version 122.0.3
    – nam
    Mar 2, 2022 at 23:58
3

I tried a lot of different ones but the one below worked for me

pip3 install --upgrade pip --user
0

Three things to do:

  1. Run this in your bash terminal

python3 pip install --upgrade pip

  1. Configure your VS Code environment for python 3.x

  2. Run your file using python3 [filename.py]

0

If the above suggestion fails, you should try:

pip install --upgrade pip  
2
  • I run tried this. It gives me Requirement already satisfied: pip in /Users/xxx
    – wzso
    Jan 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
    – Alexis
    Aug 1, 2022 at 4:34
0

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.

0

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)

-1

You should use the command behind:

python3 install --upgrade pip
1
  • This answer adds nothing to the already existing answers
    – warped
    Mar 12 at 1:10

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.