pyskell / slouchy

Slouchy uses your webcam to check if you're slouching and alert you if you are.
GNU General Public License v3.0
797 stars 47 forks source link

Mac install error #10

Closed WilliamQLiu closed 8 years ago

WilliamQLiu commented 8 years ago

I followed the mac install guide (e.g. use brew) and after the pip install -r requirements.txt, I got this error:

Traceback (most recent call last):
   File "slouchy.py", line 5, in <module>
    from PyQt4 import QtGui, QtCore
ImportError: No module named PyQt4

Is anyone else getting this? When I do brew list, I see pyqt, qt, python, and opencv.

pyskell commented 8 years ago

That's odd, my guess is that the path to your python libraries is not configured right. Or maybe you have multiple copies of python? Try python2.7 slouchy.py

WilliamQLiu commented 8 years ago

I tried python2.7 and python3, but both gave the same above error. When I went into the python shells (both 2 and 3) and tried import PyQt4, I couldn't find that library either. For some reason I'm able to import some of the other libraries (e.g. import docutils and import lockfile, etc). I'm in a clean virtualenv if that matters?

pyskell commented 8 years ago

Actually I encountered this issues with using a virtualenv.

PyQt4 for some reason does not link up right with virtual environments. I made a symbolic link (ln -s) between my install (/usr/lib/python2.7/dist-packages/PyQt4) and my virtualenv (~/.virtualenvs/slouchy/lib/python2.7/site-packages/).

Going to close this as it's really a PyQt4 issue. But let me know if you have anymore issues.

WilliamQLiu commented 8 years ago

Thanks, it's working now. My files were in slightly different locations: ln -s /usr/local/lib/python2.7/site-packages/PyQt4 /Users/williamliu/.virtualenvs/slouchy/lib/python2.7/site-packages/ and I had to run this for also: cv2.so, sip.so (instead of just PyQt4). I usedbrew doctor`, and found that I had to chown a couple directories, install numpy, then it worked.