Hi, You could try renaming your example file from pyqtgraph.py to something else (eg. test_pyqtgraph.py), it's likely that the "import pyqtgraph as pg" is then trying to import your example pyqtgraph.py file again (as it is in the script directory and thus will be the first match found), which is exactly the definition of a circular import.
Patrick On Monday, 22 August 2022 at 10:42:33 pm UTC+9:30 [email protected] wrote: > Hello there, > > I am new to pyqtgraph and cannot run basic examples like the following one > (found in their documentation): > > import pyqtgraph as pg > import numpy as np > > x = np.linspace(0.0, 2 * np.pi, 1000) > y = np.sin(x) > pw = pg.plot(x, y, pen="r") # plot x vs y in red > > I get the following error: > Traceback (most recent call last): > File > "/Users/tudoroancea/Developer/racing-team/data_visualization/work/pyqtgraph.py", > > line 2, in <module> > import pyqtgraph as pg > File > "/Users/tudoroancea/Developer/racing-team/data_visualization/work/pyqtgraph.py", > > line 9, in <module> > pw = pg.plot(x, y, pen="r") # plot x vs y in red > AttributeError: partially initialized module 'pyqtgraph' has no attribute > 'plot' (most likely due to a circular import) > > However, when I run the examples provided with pyqtgraph during > installation it works just fine. > I am using pyqtgraph v0.12.4, and tried with both qt5 and qt6, and with > both PySide and PyQt. > Do you have any idea where the problem might come from? > -- You received this message because you are subscribed to the Google Groups "pyqtgraph" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/f356474d-e22a-45de-8cc2-f2443cce501fn%40googlegroups.com.
