I am having a strange problem tryin to import matplotlib. Whenever I do the import
import matplotlib.pyplot as plt
I get the following error message (When just importing matplotlib there is no error:
Vendor: Continuum Analytics, Inc.
Package: mkl
Message: trial mode expires in 30 days
Traceback (most recent call last):
File "C:\Users\Pierre\Anaconda3\lib\site-packages\matplotlib\backends\qt_compat.py", line 159, in <module>
from PySide import QtCore, QtGui, __version__, __version_info__
ImportError: No module named 'PySide'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/Pierre/Dropbox/piR/Coding/Python/Eigene Projekte/GPX_reader/main.py", line 6, in <module>
import matplotlib.pyplot as plt
File "C:\Users\Pierre\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 114, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "C:\Users\Pierre\Anaconda3\lib\site-packages\matplotlib\backends\__init__.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "C:\Users\Pierre\Anaconda3\lib\site-packages\matplotlib\backends\backend_qt4agg.py", line 18, in <module>
from .backend_qt5agg import FigureCanvasQTAggBase as _FigureCanvasQTAggBase
File "C:\Users\Pierre\Anaconda3\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 15, in <module>
from .backend_qt5 import QtCore
File "C:\Users\Pierre\Anaconda3\lib\site-packages\matplotlib\backends\backend_qt5.py", line 31, in <module>
from .qt_compat import QtCore, QtGui, QtWidgets, _getSaveFileName, __version__
File "C:\Users\Pierre\Anaconda3\lib\site-packages\matplotlib\backends\qt_compat.py", line 162, in <module>
"Matplotlib qt-based backends require an external PyQt4, PyQt5,\n"
ImportError: Matplotlib qt-based backends require an external PyQt4, PyQt5,
or PySide package to be installed, but it was not found.
I use Python 3.5 in the Anaconda distribution on Windows 10. Anybody run into the same problem? The only recent change in the my setup was the (forced) upgrade to Windows 10...
Thanks and best wishes
Pierre
You don't have PySide or PyQt installed, the Error Message is clear about that as matplotlib depends on either one of them
To install PySide run
pip install -U PySide
from the command line the -U stands for upgrade and means upgrade all packages you have installed to the newest version
from the man page of pip
-U, --upgrade
Upgrade all packages to the newest available version. This
process is recursive regardless of whether a dependency is
already satisfied.
but you should be just fine doing
pip install PySide
if for some reason you don't want to upgrade other packages installed by pip
Related
I'm implementing widgets in my jupyter notebook (via anaconda). I tried first by using an old code from a professor of mine, but it's not displaying widgets.
I tried installing:
jupyter labextension install #jupyter-widgets/jupyterlab-manager
But it was unsuccessful
This was presented when I attempted installation of the package via windows command prompt:
C:\Users\davio>jupyter labextension install #jupyter-widgets/jupyterlab-manager
Traceback (most recent call last): File
"C:\Users\davio\Anaconda3\lib\site-packages\jupyterlab_server\server.py",
line 14, in
from notebook.base.handlers import ( File "C:\Users\davio\Anaconda3\lib\site-packages\notebook\base\handlers.py",
line 30, in
from tornado import web, gen, escape, httputil File "C:\Users\davio\Anaconda3\lib\site-packages\tornado\web.py", line 87,
in
from tornado.httpserver import HTTPServer File "C:\Users\davio\Anaconda3\lib\site-packages\tornado\httpserver.py",
line 29, in
import ssl File "C:\Users\davio\Anaconda3\lib\ssl.py", line 98, in
import _ssl # if we can't import it, let the error propagate ImportError: DLL load failed: The specified procedure could
not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"C:\Users\davio\Anaconda3\Scripts\jupyter-labextension-script.py",
line 6, in
from jupyterlab.labextensions import main File "C:\Users\davio\Anaconda3\lib\site-packages\jupyterlab\labextensions.py",
line 16, in
from .commands import ( File "C:\Users\davio\Anaconda3\lib\site-packages\jupyterlab\commands.py",
line 27, in
from jupyterlab_server.process import which, Process, WatchHelper File
"C:\Users\davio\Anaconda3\lib\site-packages\jupyterlab_server__init__.py",
line 4, in
from .app import LabServerApp File "C:\Users\davio\Anaconda3\lib\site-packages\jupyterlab_server\app.py",
line 9, in
from .server import ServerApp File "C:\Users\davio\Anaconda3\lib\site-packages\jupyterlab_server\server.py",
line 26, in
from jupyter_server.base.handlers import ( # noqa ModuleNotFoundError: No module named 'jupyter_server'
I expect to:
i) Be able to install all the required ipy packages in order to display widgets properly
ii) View and manipulate widgets properly
Thank you!!!!
Maybe if you had alredy python installed before installing anaconda, that's the problem. Try uninstalling python and only working with anaconda's python, that worked for me.
(Sorry for bad english)
when I use superplot_gui it comes out the error:
Could not load matplotlib - GTK backend.
Your version of matplotlib may not be compiled with GTK support.
Reinstalling matplotlib may fix this problem - see README or user manual for instructions
>Traceback (most recent call last):
File "super_gui.py", line 32, in <module>
from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas
File "/home/xxxxx/.local/lib/python2.7/site-packages/matplotlib/backends/backend_gtkagg.py", line 12, in <module>
from matplotlib.backends.backend_gtk import (
File "/home/xxxxx/.local/lib/python2.7/site-packages/matplotlib/backends/backend_gtk.py", line 38, in <module>
from matplotlib.backends.backend_gdk import RendererGDK, FigureCanvasGDK
File "/home/xxxxx/.local/lib/python2.7/sitepackages/matplotlib/backends/backend_gdk.py", line 29, in <module>
from matplotlib.backends._backend_gdk import pixbuf_get_pixels_array
ImportError: No module named _backend_gdk
I did not get this problem before I upgrade my ubuntu 16.04 to 18.04
I have tried the solution in other related question but they does not work.
I am trying to get my old project clipmanager building and I am encountering the following error:
/home/user/.virtualenvs/clipmanager27/bin/python /home/user/development/clipmanager/clipmanager/app.py
Traceback (most recent call last):
File "/home/user/development/clipmanager/clipmanager/app.py", line 15, in <module>
from mainwindow import MainWindow
File "/home/user/development/clipmanager/clipmanager/mainwindow.py", line 12, in <module>
import dialogs
File "/home/user/development/clipmanager/clipmanager/dialogs.py", line 8, in <module>
from PySide import QtWebKit
ImportError: cannot import name QtWebKit
Process finished with exit code 1
I installed Pyside with pip install pyside. I do not even see QtWebKit.so in the site packages folder /home/user/.virtualenvs/clipmanager27/lib/python2.7/site-packages/PySide:
Did it get removed due to licensing?
For Arch Linux, install qt4 and also qtwebkit before installing PySide.
I am learning how to use MATPLOTLIB and I am following some examples form the book "Matplotlib for Python Developers".
.
In one of the examples, the author uses the following code:
import matplotlib as mpl
mpl.use('GTKAgg')
import matplotlib.pyplot as plt
The problem is, when I try to run this code, I get the following error:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_gtk.py", line 15, in
import gobject
ImportError: No module named 'gobject'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "", line 1, in
from matplotlib import pyplot as plt File "/usr/local/lib/python3.5/dist-packages/matplotlib/pyplot.py", line
114, in
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup() File
"/usr/local/lib/python3.5/dist-packages/matplotlib/backends/init.py",
line 32, in pylab_setup
globals(),locals(),[backend_name],0) File "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_gtkagg.py",
line 14, in
from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\ File
"/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_gtk.py",
line 19, in
raise ImportError("Gtk* backend requires pygtk to be installed.") ImportError: Gtk* backend requires pygtk to be installed.
I've found a "solution" here, but since I am very new to this, I have no idea of what I must do.
Can someone here give me any idea of what exactly I have to do?
Thank you all in advance,
On Windows I use Anaconda, which makes installing PyGObject and GTK easy:
conda install -c conda-forge pygobject
conda install -c conda-forge gtk3
Then you can use GTK3Agg:
import matplotlib as mpl
mpl.use('GTK3Agg')
# Check if it worked
assert(mpl.get_backend() == 'GTK3Agg')
...although I found it wasn't actually any faster for my use case than TKAgg, anyway, and it still had weird warnings. So I stopped using it. (i.e. I deleted the line mpl.use('GTK3Agg'))
I recently installed PyQt4 onto my system and started doing some basic tasks (course work), it worked fine.
Then, after some days, I was trying to work with matplotlib.
When I tried import matplotlib.pyplot as plt,I get the following error:
Traceback (most recent call last):
File "C:\Users\user\Desktop\Confusion.py", line 1, in <module>
import matplotlib.pyplot as plt
File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 114, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\__init__.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 16, in <module>
from .backend_qt5 import QtCore
File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\backend_qt5.py", line 27, in <module>
import matplotlib.backends.qt_editor.figureoptions as figureoptions
File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\qt_editor\figureoptions.py", line 17, in <module>
import matplotlib.backends.qt_editor.formlayout as formlayout
File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\qt_editor\formlayout.py", line 58, in <module>
from matplotlib.backends.qt_compat import QtGui, QtWidgets, QtCore
File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\qt_compat.py", line 127, in <module>
from PyQt5 import QtCore, QtGui, QtWidgets
RuntimeError: the sip module implements API v11.0 to v11.2 but the PyQt5.QtCore module requires API v11.3
[Finished in 1.9s]
I thought that the problem is with the installation of PyQt4 while I already had PyQt5, but thiswebsite says that they can work properly together without any problem, provided the sip is of same version for both.
The problem seems to be coming from sip.
I followed the steps given here : PyQt5 - SIP API 10 level error. API 11 required
When I run import sip and then
print(sip, sip.SIP_VERSION_STR)
I get the following:
4.16.9
Then when I run sip -V in the command prompt, I get 4.18.
I clearly see that there is in the sip module.
All I want to ask is, how do I solve this problem?
I am on a Windows 8 64 bit system, using Anaconda3
Any help is appreciated. :)
You have to update the PyQt5-sip package as well:
pip install PyQt5-sip --upgrade
The problem was solved by doing a pip install pyqt5 and the sip version became same.
I followed this website : PyQt Sourceforge.
I hope this helps.
I had the same problem, and upgrading sip through conda worked for me:
conda upgrade sip
I have the same problem. And I fixed it temporarily by :
try import PyQt4 or import PyQt5 before import matplotlib.pyplot as plt