Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'rcParams' #12983

Closed
santhoshav15 opened this issue Dec 13, 2018 · 2 comments
Closed

ImportError: cannot import name 'rcParams' #12983

santhoshav15 opened this issue Dec 13, 2018 · 2 comments
Labels
Community support Users in need of help.

Comments

@santhoshav15
Copy link

OS: Ubuntu 16.04
Python Version: 3.5.2
Matplotlib Version: 3.0.2

When i try to from matplotlib import pyplot as plt

Traceback (most recent call last):
File "try.py", line 2, in
from matplotlib import pyplot as plt
File "/home/artivatic/.virtualenvs/test/lib/python3.5/site-packages/matplotlib/init.py", line 124, in
import inspect
File "/usr/lib/python3.5/inspect.py", line 35, in
import dis
File "/home/artivatic/Documents/Santhosh/data/ori_data/dis.py", line 1, in
from matplotlib import pyplot as plt
File "/home/artivatic/.virtualenvs/test/lib/python3.5/site-packages/matplotlib/pyplot.py", line 32, in
import matplotlib.colorbar
File "/home/artivatic/.virtualenvs/test/lib/python3.5/site-packages/matplotlib/colorbar.py", line 28, in
import matplotlib.artist as martist
File "/home/artivatic/.virtualenvs/test/lib/python3.5/site-packages/matplotlib/artist.py", line 10, in
from . import cbook, docstring, rcParams
ImportError: cannot import name 'rcParams'

Any solution?

@tacaswell
Copy link
Member

The issue is that you have a dis.py in your current directory (File "/home/artivatic/Documents/Santhosh/data/ori_data/dis.py", line 1, in) that is shadowing the built in dis module. We import dis (via inspect) in matplotlib/__init__.py, your dis then import matplotlib.pyplot which tries to get things out of the matplotlib module before it has finished setting it's self up.

The solution is to run python from a path that does not have files that shadow the standard library.

I am going to close this because there is nothing we can do at the Matplotlib level to avoid this problem.

@tacaswell tacaswell added this to the unassigned milestone Dec 13, 2018
@tacaswell tacaswell added the Community support Users in need of help. label Dec 13, 2018
@FerCris
Copy link

FerCris commented May 9, 2019

i have the same problem, uninstall matplotlib and then install again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community support Users in need of help.
Projects
None yet
Development

No branches or pull requests

3 participants