SimpleCV cannot load OpenCV library

user2103777 picture user2103777 · Feb 24, 2013 · Viewed 10.1k times · Source

I have installed SimpleCV from the 1.3 Superpack in Win Server 2008 R2.

In Python, I can load the Image library as:

from SimpleCV import Image

This works correctly in Python scripts executed as

python script.py

It also works from IDLE and python interactive.

This ONLY works correctly if I am logged in as the user account used when installing SimpleCV.

I have set a system variable PYTHONPATH to value C:\SimpleCV1.3\files\opencv\build\python\2.7

If I log in with another account, "from SimpleCV import Image" executes correctly from IDLE in interactive mode. It also executes correctly if I launch python from a Windows Run "C:\Python27\python". If I just start a command shell and launch python interactve I get:

C:\Python27>python Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win 32 Type "help", "copyright", "credits" or "license" for more information.

from SimpleCV import Image

Traceback (most recent call last): File "", line 1, in File "C:\Python27\lib\site-packages\SimpleCV__init__.py", line 3, in

from SimpleCV.base import *   File "C:\Python27\lib\site-packages\SimpleCV\base.py", line 59, in <module>
raise ImportError("Cannot load OpenCV library which is required by SimpleCV" ) ImportError: Cannot load OpenCV library which is required by SimpleCV

Can anyone help me understand why this only works correctly in the original installation account, and works (partially) in other accounts? I'm particularly confused that it will execute correctly in IDLE interactive but not from a command line execution of the script.

Thank you!

Answer

xamox picture xamox · Feb 25, 2013

Can you verify that you have set both paths correctly?

SETX PATH C:/Python27/;C:/Python27/Scripts/;C:/OpenCV2.3/opencv/build/x86/vc10/bin/;%PATH%
SETX PYTHONPATH C:/OpenCV2.3/opencv/build/python/2.7/;%PYTHONPATH%

You may also want to try the following in a script and from the terminal:

import cv
print cv.__file__
import cv2
print cv2.__file__

and see if one works or the other doesn't.