Pyqtgraph error when running built in examples

4.5k views Asked by At

I'm trying to work out how to use pyqtgraph so that I can use it.

I've tried to run this block of code which I found on the pyqtgraph website

import pyqtgraph.examples
pyqtgraph.examples.run()

But it always throws this error

Traceback (most recent call last):
  File "/Users/willemhandreck/Code/Misc.Projects/heater_alert/python/plotly_test.py", line 1, in <module>
    import pyqtgraph.examples
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyqtgraph/__init__.py", line 13, in <module>
    from .Qt import QtGui
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyqtgraph/Qt.py", line 35, in <module>
    from PySide import QtGui, QtCore, QtOpenGL, QtSvg
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PySide/QtGui.so, 2): Library not loaded: libpyside-python2.7.1.2.dylib
  Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PySide/QtGui.so
  Reason: image not found

How would I fix this?

2

There are 2 answers

0
caleb c. On BEST ANSWER

Yep, same problem here if I try to use the built-in python on the mac.

My solution is to use the anaconda python distribution:

1) Download & install Anaconda python, which already has all the right scientific modules installed. http://continuum.io/downloads#all

2) Restart your terminal and ensure you have anaconda as your python:

$ which python
/Users/caleb/anaconda/bin/python

3) Then install pyqtgraph:

$ pip install pyqtgraph
... 
Successfully installed pyqtgraph-0.9.10

4) Run the examples from the command line:

$ python -m pyqtgraph.examples

or use your import... run method above.

-Caleb

0
begust bugest On

This is actually a good thing. The system python ships installed and configured to run system utilities. It's a good idea to have a separate playpen for special packages, tweaks, upgrades, experiments. Anaconda makes it autoeasy by containing itself and its packages all within its own directory and prevents messing up anything else.

http://www.reddit.com/r/Python/comments/39qeq6/anaconda_pros_cons_mac_os_x/cs5mxwk