Error: ModuleNotFoundError: No module named 'pyqtgraph'?

Question:

I keep struggling with importing the pyqtgraph module. It’s really only about the import:
pip3 install pyqtgraph is not working.
My code:
from PyQt5 import QtGui
import PyQt5
import numpy as np
from PyQt5.QtWidgets import QMainWindow, QApplication, QMessageBox
import pyqtgraph as pg
import time
leaves:

<ipython-input-37-14dc06d126e4> in <module>
     31 import numpy as np
     32 from PyQt5.QtWidgets import QMainWindow, QApplication, QMessageBox
---> 33 import pyqtgraph as pg
     34 import time
     35 import sys

ModuleNotFoundError: No module named 'pyqtgraph'
Asked By: Rabuschwan

||

Answers:

I am guessing that your module gets installed to another Python version than what PYTHONPATH points to.

Try pip3 list -v | grep "pyqtgraph" on Unix-like OSs, or pip3 list -v | findstr "pyqtgraph" on Windows.

The directory location that will be shown will be different to your PYTHONPATH. Set your location to PYTHON3.7 dir and it should solve your problem. See here on how you can do that.

Answered By: AzyCrw4282

The error "ModuleNotFoundError: No module named ‘pyqtgraph.examples’" will also appear if the script to be executed if named pyqtgraph.py.

Answered By: Joe