module 'matplotlib' has no attribute 'verbose' - python

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.

Related

BeautiulSoup4 Installation issue in VSCode

I've BeautifulSoup4 installed in my system but when I import it, I get thrown an error No module named 'beautifulsoup4'. I just installed this module as shown in the screenshot attached. .
In addition, I've tried the regular pip install method to install BeautifulSoup4 but same issue.
Maybe you are not in the version you installed beautifulSoup4. Try positioning yourself in the python version you intalled it.
try changing the version you are working on with in visual:
Look for this, and click it
you may have two options like so:
select the one you are not positioned in

AttributeError: module 'matplotlib.dates' has no attribute '_rcParam_helper'

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.

ModuleNotFoundError: No module named 'seaborn' in VSCode

I've tried everything, pip to conda, all types of installations possible.
And all the time I got that the required packages are already satisfied/installed.
But when I try to import it in VScode, it doesn't work. There was a similar question, who had the same problem and I did what people suggested there but it didn't help either. Can someone help out here?
I'm using python 3.8.8 version
thanks in advance for the help :)
enter image description here
Run pip show seaborn in Jupyter to check if it exists in current environment.
If it does, you should see the following screenshot, seanborn stores in environment\lib\site-packages:
If not, please selecting interpreter and opening an integrated Terminal, then install seaborn in it. You may also use pip show seaborn to check its installation location.
For your reference, view select and activate environment.
You may need to try changing your Python (3) interpreter, to do this:
Click the interpreter button in the bottom left (bottom blue ribbon): https://i.stack.imgur.com/4H2AL.png
Try running with the different Python 3 interpreter paths until you find one which works - https://i.stack.imgur.com/wY1Ld.png

Cannot use numpy, pandas, matplotlib on my new mac

I just changed my computer and it seems like I cannot run my machine learning code anymore. Here are some examples:
main.py file
import matplotlib
...
...
command
File "main.py", line 1, in <module>
import matplotlib
ModuleNotFoundError: No module named 'matplotlib'
Here is just one example of matplotlib. Although I can found this module in pip list, I cannot successfullt plot the graph. Anyone knows why?
Do yourself a favor... before you start installing things and creating symlinks, go install Homebrew. Once you have that installed, use it to install Python3 (it should install under /usr/local/bin). Once that is set, open your .bash_profile ($HOME/.bash_profile`) and add to the end:
PATH=/usr/local/bin:$PATH
Now the Homebrew version of your Python binaries will be found first.
Apple has added an "extra special feature" to MacOS called System Integrity Protection which prevents you from being able to edit / replace files in certain locations, which includes /usr/bin. This means you can't go in there and replace the default Python2 binaries with something newer. Only option is to do what I've suggested, or something similar (well, that or just live with Python2, but that's not a very good option).
EDIT:
Please do not install anaconda and Python from Homebrew (I personally do not like Anaconda, YYMV). Go with one or the other, or unpleasant library conflicts surely will be in your future.

Importing matplotlib.pyplot fails in PyCharm due to AttributeError: module 'PyQt5.QtGui' has no attribute 'QApplication'

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)

Categories