Shreyansh Kapasi
Shreyansh Kapasi

Reputation: 1

I was using matplotlib and I get an Import error

This is my error traceback:

Traceback (most recent call last):
  File "D:\My projects\aaa.py", line 1, in <module>
    import matplotlib.pyplot as plt
  File "C:\Users\SHREYANSH\AppData\Local\Programs\Python\Python37-32\lib\site-packages\matplotlib\__init__.py", line 138, in <module>
    from . import cbook, rcsetup
  File "C:\Users\SHREYANSH\AppData\Local\Programs\Python\Python37-32\lib\site-packages\matplotlib\rcsetup.py", line 28, in <module>
    from cycler import Cycler, cycler as ccycler
  File "C:\Users\SHREYANSH\AppData\Local\Programs\Python\Python37-32\lib\site-packages\cycler.py", line 46, in <module>
    import six
  File "D:\My projects\six.py", line 2, in <module>
    import matplotlib.pyplot as plt
  File "C:\Users\SHREYANSH\AppData\Local\Programs\Python\Python37-32\lib\site-packages\matplotlib\pyplot.py", line 30, in <module>
    from cycler import cycler
ImportError: cannot import name 'cycler' from 'cycler' (C:\Users\SHREYANSH\AppData\Local\Programs\Python\Python37-32\lib\site-packages\cycler.py)

I tried it after reinstalling matplotlib but nothing works please help.

Upvotes: 0

Views: 1213

Answers (3)

Walid Bousseta
Walid Bousseta

Reputation: 1469

In my case it was a privilege problem, I have uninstall cycler and matplotlib by:

sudo pip uninstall cycler matplotlib

and than install them again with:

pip3 install matplotlib

and it works fine, I hope that could help.

Upvotes: 0

Nick Nikzat
Nick Nikzat

Reputation: 31

Ouch! I found out what was happening. I was naming my sample work as one, two, three, etc. and I also had a file "six.py". Make sure you don't have a file named six.py in your path.

Upvotes: 3

Rahul Verma
Rahul Verma

Reputation: 3176

Try to install 'cycler' then install 'matplotlib'

pip install cycler
pip install matplotlib

Upvotes: -2

Related Questions