When I am trying to import matlibplot or sns or plotly packages below is the error
AttributeError: module 'matplotlib.dates' has no attribute '_rcParam_helper'.
I have tried to install older versions but no luck.
I suspect that this is an installation issue where you have more than one version of Matplotlib installed at the same time so some files are from one version and some are from another (a chimera).
I suggest uninstalling everything and starting again clean with exactly one package management tool (pip vs conda vs system vs ...).
In https://github.com/matplotlib/matplotlib/commit/814a969d4a731321827a108c38ed6f3aaf50a623 (which looks like it went in between 3.4.2 and 3.5.0) we re-named an internal class. I suspect you have a new version of dates.py and an old version of rcsetup.py.
Related
I wanted to change my python compiler to "newer" one (within one project) and use some additional packages with conda. After the installation all my packages worked fine and I could use the console, however matplotlib.pyplot fails to import since then. And throws the following error: app = QtGui.QApplication([" "])
AttributeError: module 'PyQt5.QtGui' has no attribute 'QApplication'
After doing some research on this I found this one: link
It is suggesting to change inputhooks.py (on line 513 and change GUI_QT:enable_qt4 to GUI_QT: enable_qt5 4 to 5)
As it is a company machine, I can't have admin rights to overwrite things within PyCharm.
Can you recommend a better solution to avoid this?
Why is this popping up?
ErrorLogScreenshot
Also I tried to install the newer version of pyqt but that didn't fix the problem.
In the same time
Within pydev the interactiveshell.py fails as well. with the following error message:self.showtraceback(running_compiled_code=True)
TypeError: showtraceback() got an unexpected keyword argument 'running_compiled_code'
I understand it gets an argument which it is not expecting. I did some research on this one as well and some could fix it by deleting a stale a corresponding .pyc file (I couldn't find one at the same location as the initial file only interactiveshell.py)
Below this blog regarding pydev the conversation never went further
https://github.com/ipython/ipython/issues/10687
Is there a way to fix it?
I am kind of new to Python and don't quite understand the heart of it at this depth so any help is appreciated.
Thanks,
Anna
For anyone having the same issue, I have solved this problem by switching to qt and pyqt 4. To do so, follow the following procedure:
conda remove qt
conda install qt=4
conda install -c anaconda pyqt=4.11.4
conda install matplotlib --no-update-dependencies
If you are not using a virtual environment, you might also have to remove anaconda navigator before installing new packages:
conda uninstall anaconda-navigator
At the beginning of your program, switch matplotlib backend:
import matplotlib.pyplot as plt
plt.switch_backend('Qt4Agg')
Inspired by this solution.
After updating PyCharm all issues seem to have been resolved. (I was using versin 2017.1)
The show traceback error was due to pydev, and the new release fixes it.
As well as the GUI problem.
I was able to solve it by finding the file, and both messages disappeared, and matplotlib seems to work fine again.
Under this folder (I named my environment py35):
C:\Users\myusername\AppData\Local\Continuum\anaconda3\envs\py35\Lib\site-packages\IPython\core__pycache__
I found the file: interactiveshell.cpython-35.pyc and deleted it -
(This solves the problem only on Python 3.5)
I can run my program in the terminal, but when I run it directly using Pycharm, it gives
AttributeError: module 'matplotlib' has no attribute 'verbose'
I think I found the answer. I was having the same problem. In PyCharm Professional 2017.3, go to File | Settings | Tools | Python Scientific. There is an option there to "Show plots in toolwindow". Uncheck this option. Then it should work ok. It has something to do with PyCharm trying to help you by allowing you to interact with your plots - as hinted at in this issue discussion. https://youtrack.jetbrains.com/issue/PY-26652
Try to install older version of matplotlib like 2.1.0 rather than v 2.2.0
use:
pip uninstall matplotlib
pip install matplotlib==2.1.0
This is an error on the matplotlib side, verbose was unintentionally removed in matplotlib 2.2.0.
See this issue.
This is fixed from the matplotlib side as of version 2.2.2. (Release here)
If updating is not an option, one less ideal option could be to locate the __init__.py inside the matplotlib folder, and add the line
verbose = Verbose()
after the Verbose() class - that should be around line 384 in the current version.
if anyone is having issue such as: module matplotlib has no attribute 'artist'.
Try this method below by removing matplotlib
pip uninstall matplotlib
then reinstall it again worked for me
pip install matplotlib==3.0.0
In the most recent version of PyCharm (Profession 2020.2), this issue if fixed. You can use matplotlib 2.2.0+ and make use of the "Show plots in tool window" feature at the same time.
Brand new to Python (typically program in MSDN C#) and I'm trying to make use of the matplotlib to generate some graphics from .csv files
I've downloaded & installed Python as well as Anaconda onto my Windows 10 machine, the versions are Python 3.5.2 and Anaconda 4.1.1
I open up the Python "notepad" interface and do
import matplotlib.pyplot as plt
plt.plot([1,2,3],[3,2,1])
plt.show()
but when I run the code I get the error:
ImportError: No module named 'matplotlib'
I've looked at some other posts for this but they all seem to be in regard to Mac OSX or Linux. Some have pointed to multiple installs of matplotlib, but I haven't turned up such a situation so far. What might be causing this, or how can I troubleshoot it?
**Edit:
The path returned to me from the import sys recommended in the comments gave me this response
['C:\Users\a.watts.ISAM-NA\Desktop',
'C:\Users\a.watts.ISAM-NA\AppData\Local\Programs\Python\Python35-32\python35.zip',
'C:\Users\a.watts.ISAM-NA\AppData\Local\Programs\Python\Python35-32\DLLs',
'C:\Users\a.watts.ISAM-NA\AppData\Local\Programs\Python\Python35-32\lib',
'C:\Users\a.watts.ISAM-NA\AppData\Local\Programs\Python\Python35-32',
'C:\Users\a.watts.ISAM-NA\AppData\Local\Programs\Python\Python35-32\lib\site-packages',
'C:\Users\a.watts.ISAM-NA\AppData\Local\Programs\Python\Python35-32\lib\site-packages\setuptools-26.1.1-py3.5.egg']
You essentially have 2 versions of python on your system - the standard one you downloaded and the one that ships with Anaconda. When you are running code in the IDLE you are using the standard version (in C:\Users\a.watts.ISAM-NA\AppData\Local\Programs\Python\Python35-32\python.exe) where matplotlib isn't installed which is why you are getting the error.
You need to use the Anaconda version (C:\Users\a.watts.ISAM-NA\AppData\Local\continuum\anaconda3\python.exe) that comes with the scientific stuff already setup. It looks like your system is using this one from the cmd so if you run scripts from there it should use the Anaconda version. If you want to use something more interactive you can also use spyder - the Anaconda version of the IDLE - or run jupyter notebook from cmd to get a browser based platform for interactive development
I have got a strange issue.
I am now using graphlab/numpy to develop a project via Pycharm 5. OS is Mac OS 10.11.5. I created a p2.7 virtual environment for the project. Programme runs well. But after I install ipython, I can no longer import graphlab and numpy correctly.
Error message:
AttributeError: 'module' object has no attribute 'core'
System keeps telling that attribute ‘core' and 'connect' are missing. But I am pretty sure that they can be found in graphlab/numpy folders, and no duplicates.
Project runs all right in terminal. Now I have to uninstall ipython. Then everything is ok again.
Please kindly help.
Please remember that console applications and GUI application do not share the same environment on OS X.
This also means that if you install a Python package from the console, this would probably not be visible to PyCharm.
Usually you need to install packages using PyCharm in order to be able to use them.
Upgrading pip itself then reinstalling worked for me
I've been struggling for hours on a problem that is making me insane. I installed Python 2.7 with Cygwin and added Scipy, Numpy, Matplotlib (1.4.3) and Ipython. When I decided to run ipython --pylab I get the following error:
/usr/lib/python2.7/site-packages/matplotlib/transforms.py in <module>()
37 import numpy as np
38 from numpy import ma
----> 39 from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox,
40 update_path_extents)
41 from numpy.linalg import inv
ImportError: No module named _path
I spent hours on the internet, looking for a solution but nothing worked. I did notice that I am missing _path.so files in the matplotlib directory that everybody seems to have. Instead, I have two files: path.py and path.pyc. But I installed matplotlib directly from the official website using pip install and reinstalling it didn't make any difference. Does anyone have a little clue on what is going wrong? I would be incredibly grateful !!!
For others having this problem, in my case, the solution was simple. The problem was caused by having the wrong matplot library installed on your computer; creating an error in finding the correct matplotlib path. In my case, I had installed matplotlib on a different version of python. Simply update matplotlib on your computer, so that it is compatible with your current version of python:
pip install --upgrade matplotlib
As for the post, I am unsure of what caused these big issues. Hope my tip can help anyone else stumbling upon this issue!
I doubt that most of you brought here by Google have the problem I had, but just in case:
I got the above "ImportError: No module named _path" (on Fedora 17) because I was trying to make use of matplotlib by just setting sys.path to point to where I had built the latest version (1.5.1 at the time). Don't do that.
Once I ran "python setup.py install" (as root) to do a proper install (and got rid of my sys.path hack), the error was fixed.
The package matplotlib requires multiple dependencies (see them here). For me, the missing dependencies included pyparsing and kiwisolver, but your results my vary. Before you do any of these other things (reinstalling python or the library, etc...), make sure you have installed (pip install ...) all the libs in this list (link).