Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

matplotlib - module 'sip' has no attribute 'setapi'

Tags:

I just set up the VS Code with all the Python extensions. Python version is 3.8.3 through Anaconda. The interpreter is venv. When I run this code

import matplotlib.pyplot as plt 

An error shows -

Exception has occurred: AttributeError module 'sip' has no attribute 'setapi'   File "C:\test.py", line 145, in <module>     import matplotlib.pyplot as plt 

I've tried uninstalling and reinstalling matplotlib, but to no avail.

like image 357
Egret Avatar asked Oct 10 '20 07:10

Egret


People also ask

Why does matplotlib say no module?

The Python "ModuleNotFoundError: No module named 'matplotlib'" occurs when we forget to install the matplotlib module before importing it or install it in an incorrect environment. To solve the error, install the module by running the pip install matplotlib command.

How do you check matplotlib is installed or not?

To verify that Matplotlib is installed, try to invoke Matplotlib's version at the Python REPL. Use the commands below that include calling the . __version__ an attribute common to most Python packages.


1 Answers

This worked for me.

python -m pip install matplotlib==3.2 
like image 188
Nuno Lopes Avatar answered Sep 23 '22 08:09

Nuno Lopes