FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

cannot import name rcParams · Issue #1280 · matplotlib/matplotlib · GitHub

Repository navigation

cannot import name rcParams #1280

Closed
Closed

Description

I've tried this demo from your website:
http://matplotlib.org/api/widgets_api.html?highlight=matplotlib.widgets#matplotlib.widgets.RectangleSelector

But at the moment of runnig your program I've this error:

File "rec.py", line 1, in
from matplotlib.widgets import RectangleSelector
File "/usr/lib/python3.2/site-packages/matplotlib/init.py", line 105, in
import os, re, shutil, subprocess, sys, warnings
File "/usr/lib/python3.2/subprocess.py", line 378, in
import select
File "/home/simone/spz/select.py", line 1, in
from pylab import *
File "/usr/lib/python3.2/site-packages/pylab.py", line 1, in
from matplotlib.pylab import *
File "/usr/lib/python3.2/site-packages/matplotlib/pylab.py", line 222, in
from matplotlib import mpl # pulls in most modules
File "/usr/lib/python3.2/site-packages/matplotlib/mpl.py", line 1, in
from matplotlib import artist
File "/usr/lib/python3.2/site-packages/matplotlib/artist.py", line 6, in
from matplotlib import docstring, rcParams
ImportError: cannot import name rcParams

I'm using the GIT version with python 3 under ArchLinux.
But I've observed the same problem with matplotlb 1.1.1 on python 2

Activity

  1. efiring commented on Sep 19, 2012

    Member

    This is not a bug. The problem is that subprocess is trying to import the python library select module, but it is instead finding your own select.py, and that is trying to pull in all of pylab, while matplotlib.widgets was still in the early stages of importing matplotlib/init.py. You need to rename your select.py to avoid the name clash, or run from a different directory, or take spz out of your PYTHONPATH, if that is the way your select is being found.

  2. santhoshav15 commented on Dec 13, 2018

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

    When i try to from matplotlib import pyplot as plt

    I am facing the same issue

    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?

  3. WeatherGod commented on Dec 13, 2018

    Member
  4. santhoshav15 commented on Dec 14, 2018

    @WeatherGod I have pip3(only for python 3), no pip installed. Python version 3.5.2 standard that comes along with standard Ubuntu 16.04
    I had even opened a thread ImportError: cannot import name 'rcParams'

    The issue got fixed obviously after i changed the name of dis.py

  5. pluviosilla commented on Jan 31, 2019

    I'm getting the same error under very similar circumstances (importing matplotlib pyplot with a failure in the attempt to load colorbar, then martist, then rcParams), but I do not have dis.py or any other python (.py) files in my working directory. However, I think (but am not sure) that the problem started after I installed statsmodels. I'm running a jupyter notebook within a conda environment with python 3.6 and matplotlib-3.0.2-py36_1002.

  6. WeatherGod commented on Feb 1, 2019

    Member
  7. pluviosilla commented on Feb 1, 2019

    Thanks for taking time to respond. Here's the traceback:

    After the import
    from matplotlib import pyplot as plt
    I get

    ---------------------------------------------------------------------------
    ImportError                               Traceback (most recent call last)
    <ipython-input-52-99ba79ecbbfb> in <module>
    ----> 1 from matplotlib import pyplot as plt
    
    C:\Anaconda3\envs\py36-keras\lib\site-packages\matplotlib\pyplot.py in <module>
         30 from cycler import cycler
         31 import matplotlib
    ---> 32 import matplotlib.colorbar
         33 import matplotlib.image
         34 from matplotlib import rcsetup, style
    
    C:\Anaconda3\envs\py36-keras\lib\site-packages\matplotlib\colorbar.py in <module>
         26 
         27 import matplotlib as mpl
    ---> 28 import matplotlib.artist as martist
         29 import matplotlib.cbook as cbook
         30 import matplotlib.collections as collections
    
    C:\Anaconda3\envs\py36-keras\lib\site-packages\matplotlib\artist.py in <module>
          8 
          9 import matplotlib
    ---> 10 from . import cbook, docstring, rcParams
         11 from .path import Path
         12 from .transforms import (Bbox, IdentityTransform, Transform, TransformedBbox,
    
    ImportError: cannot import name 'rcParams'
    
    
  8. WeatherGod commented on Feb 1, 2019

    Member
  9. pluviosilla commented on Feb 1, 2019

    How can I verify that it is valid? You can view the file here.

  10. jklymak commented on Feb 1, 2019

    Member

    @pluviosilla Can you do

    import logging
    logging.basicConfig(level=logging.DEBUG)
    import matplotlib.pyplot as plt

    Its just that your install is messed up somehow - running the debugging will help us see how.

  11. pluviosilla commented on Feb 1, 2019

    Nothing changes, unfortunately:

    ---------------------------------------------------------------------------
    ImportError                               Traceback (most recent call last)
    <ipython-input-53-ebf44ebd011b> in <module>
          1 import logging
          2 logging.basicConfig(level=logging.DEBUG)
    ----> 3 import matplotlib.pyplot as plt
    
    C:\Anaconda3\envs\py36-keras\lib\site-packages\matplotlib\pyplot.py in <module>
         30 from cycler import cycler
         31 import matplotlib
    ---> 32 import matplotlib.colorbar
         33 import matplotlib.image
         34 from matplotlib import rcsetup, style
    
    C:\Anaconda3\envs\py36-keras\lib\site-packages\matplotlib\colorbar.py in <module>
         26 
         27 import matplotlib as mpl
    ---> 28 import matplotlib.artist as martist
         29 import matplotlib.cbook as cbook
         30 import matplotlib.collections as collections
    
    C:\Anaconda3\envs\py36-keras\lib\site-packages\matplotlib\artist.py in <module>
          8 
          9 import matplotlib
    ---> 10 from . import cbook, docstring, rcParams
         11 from .path import Path
         12 from .transforms import (Bbox, IdentityTransform, Transform, TransformedBbox,
    
    ImportError: cannot import name 'rcParams'
    
  12. pluviosilla commented on Feb 1, 2019

    And changing the debugging level has no effect on the amount of spew.

  13. jklymak commented on Feb 1, 2019

    Member

    That means that you do not have a recent matplotlib installed in C:\Anaconda3\envs\py36-keras Try updating.

  14. pluviosilla commented on Feb 1, 2019

    These problems occur in a newly created conda environment where I installed matplotlib in the usual way:
    conda install matplotlib -n py36-keras
    After experiencing all these difficulties I tried uninstalling and reinstalling as well as:
    conda install matplotlib -c conda-forge -n py36-keras

    Versions: python 3.6 and matplotlib-3.0.2-py36_1002.

  15. jklymak commented on Feb 1, 2019

    Member

    Does conda really install in C:\Anaconda3 on Windows? What does conda info give you?

    You can also try:

    import logging
    logging.basicConfig(level=logging.DEBUG)
    import matplotlib
    print('Version', matplotlib.__version__)
    import matplotlib.pyplot as plt
  16. pluviosilla commented on Feb 1, 2019

    Here's what I get:

    ---------------------------------------------------------------------------
    AttributeError                            Traceback (most recent call last)
    <ipython-input-60-4ac91ebc2005> in <module>
          2 logging.basicConfig(level=logging.DEBUG)
          3 import matplotlib
    ----> 4 print('Version', matplotlib.__version__)
          5 import matplotlib.pyplot as plt
    
    AttributeError: module 'matplotlib' has no attribute '__version__'
    

    As for my conda installation info, here's what I get:

    C:\WINDOWS\system32>conda info
    
         active environment : None
           user config file : C:\Users\John\.condarc
     populated config files : C:\Users\John\.condarc
              conda version : 4.6.2
        conda-build version : 3.4.1
             python version : 3.6.4.final.0
           base environment : C:\Anaconda3  (writable)
               channel URLs : https://conda.anaconda.org/conda-forge/win-64
                              https://conda.anaconda.org/conda-forge/noarch
                              https://repo.anaconda.com/pkgs/main/win-64
                              https://repo.anaconda.com/pkgs/main/noarch
                              https://repo.anaconda.com/pkgs/free/win-64
                              https://repo.anaconda.com/pkgs/free/noarch
                              https://repo.anaconda.com/pkgs/r/win-64
                              https://repo.anaconda.com/pkgs/r/noarch
                              https://repo.anaconda.com/pkgs/msys2/win-64
                              https://repo.anaconda.com/pkgs/msys2/noarch
              package cache : C:\Anaconda3\pkgs
                              C:\Users\John\.conda\pkgs
                              C:\Users\John\AppData\Local\conda\conda\pkgs
           envs directories : C:\Anaconda3\envs
                              C:\Users\John\.conda\envs
                              C:\Users\John\AppData\Local\conda\conda\envs
                   platform : win-64
                 user-agent : conda/4.6.2 requests/2.18.4 CPython/3.6.4 Windows/10 Windows/10.0.17134
              administrator : True
                 netrc file : None
               offline mode : False
    
    
  17. jklymak commented on Feb 1, 2019

    Member

    The fact you can't even print the __version__ means your install is broken.

    I'd clean up your conda install - in particular, I don't think you want the C:\Anaconda3 path in there, but I'm not an expert on how conda works on Windows machines.

  18. pluviosilla commented on Feb 1, 2019

    I don't think the "Anaconda3" is the problem. Been using that for ages and never had this kind of problem before.

    I have a number of conda environments. Maybe too many.

  19. WeatherGod commented on Feb 1, 2019

    Member
  20. jklymak commented on Feb 2, 2019

    Member

    @pluviosilla If you are still having trouble, probably worth opening a new issue. But please make sure its not a conda problem first, which this really seems to be. We can't really debug install issues.

  21. MorganWeiss commented on Jan 27, 2020

    I still have the same issue, is there any solution. I tried uninstalling and installing matplotlib but I still get the same error message: ImportError: cannot import name 'rcParams' from 'matplotlib' (unknown location)

  22. kvamsi7 commented on Jun 13, 2021

    I still have the same issue, is there any solution. I tried uninstalling and installing matplotlib but I still get the same error message: ImportError: cannot import name 'rcParams' from 'matplotlib' (unknown location)

    Have you tried conda install -f matplotlib

  23. dentalfloss1 commented on Jun 16, 2023

    I have this issue and I don't have anaconda at all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL