pyqtgraph - ImportError: No module named pyqtgraph

Lucas Santana picture Lucas Santana · Aug 11, 2015 · Viewed 10.1k times · Source

Recently I downloaded pyqtgraph module. I ran the build and install after extract the folder, however when I ran a simple example like under here

import pyqtgraph as pg
import numpy as np
x = np.random.normal(size=1000)
y = np.random.normal(size=1000)
pg.plot(x, y, pen=None, symbol='o')  ## setting pen=None disables line drawing

I got a error:

Traceback (most recent call last):
File "main.py", line 1, in <module>
import pyqtgraph as pg
ImportError: No module named pyqtgraph

I am runnin on ubuntu 14.04 and pyqtgraph is under /usr/local/lib/python2.7/dist-packages. Does anybody can help me?

Answer

NoBugs picture NoBugs · Apr 12, 2018

If you don't have a package installed for that (or, any module in general), run:

sudo pip install (modulename)

and

sudo pip3 install (modulename)

for Python3.

So in this case, try sudo pip install pyqtgraph. worked for me.