4

I want to install the matplotlib package for Python with pip install matplotlib in the command prompt but suddenly the lines get red and the next error appears:

ERROR: Command errored out with exit status 1: 'c:\users\pol\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Pol\\AppData\\Local\\Temp\\pip-install-v44y041t\\matplotlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Pol\\AppData\\Local\\Temp\\pip-install-v44y041t\\matplotlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Pol\AppData\Local\Temp\pip-record-d5re6a86\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

I'm using Windows and my Python version is 3.8.0. I have already tried python -m pip install matplotlib but it doesn't work.

zest16
  • 455
  • 3
  • 7
  • 20
  • It seems a problem with pip. Try the following: pip install -U setuptools pip install -U wheel – powerPixie Nov 12 '19 at 08:36
  • This gives the following error `ERROR: Could not find a version that satisfies the requirement install (from versions: none) ERROR: No matching distribution found for install` – zest16 Nov 12 '19 at 08:45
  • 1
    There are no wheels for matplotlib 3.1.1 on python 3.8. Unless you want to build matplotlib from source, use python 3.7 instead. Also see [this](https://stackoverflow.com/a/58457893/4124317). – ImportanceOfBeingErnest Nov 12 '19 at 12:18
  • 1
    @ ImportanceOfBeingErnest. I erased my post. I suspected you downvoted me, my recommendation was to solve a pip problem. There was no matplotlib mention. – powerPixie Nov 12 '19 at 13:21
  • Thanks @ImportanceOfBeingErnest, I changed to 3.7.5 and it did work this time. – zest16 Nov 12 '19 at 17:59

3 Answers3

4

Had the same problem. Came across a solution (which, as I understand, is quite recent):

python -m pip install -U matplotlib==3.2.0rc1

Explanation:

Since there are no wheels available, installing matplotlib 3.1.1 on python 3.8 requires to build it from source. This process may turn out to be a little cumbersome. So for anyone having problems with that, either

Install matplotlib 3.1.1 on python 3.7 Wait for matplotlib 3.2.0 to be released with the respective wheels for python 3.8

Also, someone pointed to wheels stored here: https://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib

But I haven't tried those myself.

Source: https://github.com/matplotlib/matplotlib/issues/15041

Dainius
  • 51
  • 8
0

pip install --pre -U scikit-learn this command is work for me I have found because this error come for the duplication of same libraries.

-1

Try running your command prompt with administrator privileges

If the problem further persists try reinstalling pip