Quantalabs
Quantalabs

Reputation: 449

Errors when installing MatPlotLib

I was trying to install the package epispot, to model this COVID-19 outbreak, but when I ran pip install epispot, and it installed all the dependencies, including MatPlotLib. When it tried to install matplotlib, it gave me an error so huge, it took up close to a quarter of the height of the command prompt (that's with the scrollbar). I then tried to install just matplotlib and then was going to install epispot, but the same error came when installing matplotlib. I updated my pip to see if that was the problem, but it didn't change. Is there any other way to install matplotlib? And will that also install all the dependencies. I'm on a windows computer, and the error came after this line: Building wheel for matplotlib (setup.py) ..., if that helps at all.

UPDATE - For @rocketsfallonrocketfalls, the error was Building wheel for matplotlib (setup.py) ... error ERROR: Command errored out with exit status 1: command: 'C:\Users\user \AppData\Local\Programs\Python\Python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user \\AppData\\Local\\Temp\\pip-install-66pka4wo\\matplotlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\user \\AppData\\Local\\Temp\\pip-install-66pka4wo\\matplotlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\user \AppData\Local\Temp\pip-wheel-o1u86tpl' cwd: C:\Users\user \AppData\Local\Temp\pip-install-66pka4wo\matplotlib\ Complete output (571 lines):

Upvotes: 0

Views: 1359

Answers (2)

Quantalabs
Quantalabs

Reputation: 449

I found it! Although Python 3.9 not having a wheel for installing Matplotib was a problem and the main problem (thanks @rocketsfallonrocketfalls and @Mr. T for finding that out), it seems that there's a problem on windows when installing NumPy, which was another dependency of the epispot package, which if you remember, was the package I was trying to install. Because of this, when using Python 3.8, it gave me a different error. You can find details here - https://github.com/numpy/numpy/issues/16739.

Now, the solution to this, at least, the solution I'm using is to use Anaconda's Python version, and then clone the epispot package from the source on Github into project directory (I can remove all the extra files and just the epispot folder). Since Numpy comes with Anaconda, I have numpy, matplotlib, and epispot.

Upvotes: 0

As @Mr.T already clarified why it's happening (there's no Python wheel for installing Matplotlib for Python 3.9 yet), I wanted to add what to do as a solution.

The easiest solution without removing what you had so far is using virtual environments. Virtual environments are basically environments that you can change between easily, where you could use different versions of Python on each with all different APIs/modules installed so they do not crossover each other. So you can create a virtual environment using Python 3.7 and install Matplotlib on that with ease. Here is a useful link that shows how to do it using pip, it's pretty easy:

How to create virtual environment for python 3.7.0?

But since I like the convenience of conda, I'd suggest you to uninstall Python and install it back again using Anaconda. Most of the things you'd need are already installed by default so you don't need to care about installing them correctly. And managing the virtual environments also do not require any further installations so whenever you need to create a new environment you just use conda environments.

Upvotes: 2

Related Questions