sightmachine / SimpleCV

The Open Source Framework for Machine Vision
http://simplecv.org
BSD 3-Clause "New" or "Revised" License
2.68k stars 798 forks source link

fail to install SimpleCV inside virtualenv on Ubuntu 14.04 #647

Open oscargicast opened 10 years ago

oscargicast commented 10 years ago

I've created a virtualenv and install almost all the requirements via pip, but PIL. So I installed Pillow instead of this one.

# pip freeze
Pillow==2.4.0
SimpleCV==1.3 # --> intall manually
argparse==1.2.1
ipython==2.1.0
numpy==1.8.1
pygame==1.9.1release # --> intall manually
pyparsing==2.0.2
scipy==0.14.0
svgwrite==1.1.6
wsgiref==0.1.2

Then, when I want to import SimpleCV I get this.

#python
>>> import SimpleCV
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/oscar/.virtualenvs/simplecv/local/lib/python2.7/site-packages/SimpleCV-1.3-py2.7.egg/SimpleCV/__init__.py", line 3, in <module>
    from SimpleCV.base import *
  File "/home/oscar/.virtualenvs/simplecv/local/lib/python2.7/site-packages/SimpleCV-1.3-py2.7.egg/SimpleCV/base.py", line 60, in <module>
    raise ImportError("Cannot load OpenCV library which is required by SimpleCV")
ImportError: Cannot load OpenCV library which is required by SimpleCV

Apparently I don't have installed cv(2)

>>> import cv
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named cv
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named cv2
>>> 

This is the output when I installed SimpleCV doing this:

$ python setup.py install

I would like to install SimpleCV inside a virtualenv. Thank you all your help.

mylxiaoyi commented 10 years ago

I think you need to install the python binding of opencv

$ aptitude search python | grep opencv
p   python-opencv                   - Python bindings for the computer vision li
v   python2.7-opencv                -                 
oscargicast commented 10 years ago

Hi @mylxiaoyi . I already have python-opencv installed.

$ apt-cache search python | grep opencv
python-opencv - Python bindings for the computer vision library
mylxiaoyi commented 10 years ago

In my computer, there are two file cv.py and cv2.so in /usr/local/lib/python2.7/dist-packages, do you have the files in the same place or in other places of your computer?

If you do have the files in other places, maybe you need to add the path where the two files exist in to your python path.

Good Luck!!

oscargicast commented 10 years ago

Thanks @mylxiaoyi for the help. The two files, cv.py and cv2.so are located in this path, I am using ubuntu 14.04:

/usr/lib/python2.7/dist-packages/

Besides, I am using virtualenvwrapper, so I linked these file to ~/.viertualenvs/**simplecv_env**/lib/python2.7/site-packages/ and ~/.viertualenvs/**simplecv_env**/local/lib/python2.7/site-packages/, inside my virtualenv.

That's what I have inside this path:

$ oscar@oscar  ~WORKON_HOME/simplecv/lib/python2.7/site-packages  ls
cv2.so                       pkg_resources.py
cv.py                        pkg_resources.pyc
easy-install.pth             pygame
easy_install.py              pygame-1.9.1release-py2.7.egg-info
easy_install.pyc             pyparsing-2.0.2-py2.7.egg-info
IPython                      pyparsing.py
ipython-2.1.0.dist-info      pyparsing.pyc
_markerlib                   scipy
numpy                        scipy-0.14.0-py2.7.egg-info
numpy-1.8.1-py2.7.egg-info   setuptools
PIL                          setuptools-3.6.dist-info
Pillow-2.4.0-py2.7.egg-info  SimpleCV-1.3-py2.7.egg
pip                          svgwrite
pip-1.5.6.dist-info          svgwrite-1.1.6-py2.7.egg-info
$ oscar@oscar  ~WORKON_HOME/simplecv/lib/python2.7/site-packages  pwd
/home/oscar/.virtualenvs/simplecv/lib/python2.7/site-packages

The same for ~/.viertualenvs/simplecv/local/lib/python2.7/site-packages/, just in case.

P.S. I can run SimpleCV globally without using virtualenv.