Hi Everyone! Has anyone used matplotlib 2.0.0 with...
# questions
s
Hi Everyone! Has anyone used matplotlib 2.0.0 with Kedro 0.17.7 before? I am getting error. I have installed PyQt5 and pyside2 but still getting the same error. I'd grateful for any help. Thanks a lot!
Copy code
File "/usr/local/lib/python3.6/site-packages/matplotlib/backends/qt_compat.py", line 175, 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.
j
hi @Suyash Shrivastava! I don't think it's a Kedro problem but I'm happy to help 😄
when you say you have PyQt5 and PySide2 installed, how do you know?
the reason I ask is that matplotlib seems to be installed globally in
/usr/local/lib/python3.6
, which might be managed by your Linux package manager
s
Hi Juanlu, PyQt5 is installed at /home/cdsw/.local/lib/python3.6/site-packages
j
then it's probably a problem of Python not finding it in the right path
s
any idea how to solve that 🙂 btw thanks a lot for the help!
j
my recommendation would be to use a virtual environment and install both matplotlib and PyQt5 on it:
Copy code
$ cd /home/cdsw/Projects/kedro-test
$ /usr/local/bin/python3.6 -m venv .venv
$ source .venv/bin/activate
(.venv) $ pip install matplotlib pyqt5 pyside2  # didn't test
(.venv) $ python -c "import matplotlib.backends.qt_compat"  # check if it works
s
yes thats a problem. I am working on client infra where I can't create virtual environments matplotlib is installed at /usr/local/lib/python3.6/site-packages
j
if you can't create virtual environments then you'll need to
/usr/local/bin/python3.6 -m pip install pyqt5
. there's a chance that you already did, and it ended up in
~/.local
. that means that you don't have permissions to do
sudo ... pip install
. which is a good thing anyway 😄 so another thing you can try is launching your script with
PYTHONPATH=/home/cdsw/.local/lib/python3.6/site-packages
so that the global matplotlib "sees" the local PyQt5
👍🏼 1
s
Thanks Juanlu!, will try that and let you know!
🙌🏼 1
n
+1 on
PYTHONPATH
or sys.path if virtualenv is not an option
🙌 1
s
cc @Amith Nair