-
Notifications
You must be signed in to change notification settings - Fork 61
opencv 3.3.0: python 3.5: ImportError: numpy.core.multiarray failed to import #26
Comments
I tried to replicate this on a Raspberry Pi 3 by creating a new environment using Can you provide some additional details on the environment where you are seeing this error? How was berryconda installed, what hardware is being used, how was opencv was installed, what is the output of |
Here's the precise history of what I did from my notes: In an environment using python 3.5.4. `pi@qacker:~/bitsy_gen3/dev-tools/qacker $ source activate qt (qt) pi@qacker:~/bitsy_gen3/dev-tools/qacker $ conda list packages in environment at /home/pi/berryconda3/envs/qt: ca-certificates 2017.7.27.1 0 (qt) pi@qacker:~/bitsy_gen3/dev-tools/qacker $ conda search opencv (qt) pi@qacker:~/bitsy_gen3/dev-tools/qacker $ conda install opencv Package plan for installation in environment /home/pi/berryconda3/envs/qt: The following NEW packages will be INSTALLED:
Proceed ([y]/n)? y numpy-1.14.0-p 100% |################################################################################################################################| Time: 0:01:40 77.20 kB/s Immediately afterwards I got the the error when I tried to import python within this environment. The python version defaulted to 3.5.4 when I created the environment by specifying 3.5. I tried to build opencv from scratch using this install guide However, cmake gave me an error saying that it wanted python 3.5.3 instead: I created a new environment with that version:
I hope this is helpful. |
Was there any more of the error message? Can you try running |
My apologies, but it looks like this might be my bad.
However, I am able to reproduce the error running my shell script. Digging a little deeper it seems like the problem might be caused by having a different version of numpy in my PATH.
I was not able to find a version of PyQt5 that could be installed via pip or conda, so I had to install via apt-get. Interestingly, however, I can set the PYTHONPATH exactly the same in my virtualenv environment (where I built openCV from scratch) without getting this error.
|
It is quite possible that the Python extension modules built with the system Python are not compatible with Berryconda. Setting the PYTHONPATH variable to the system dist-/site-packages directory is trying to mix these two sets of extension modules. I have a suspicion that this may be a result of the different configuration that were used to build Python for Berryconda and Raspian. Specifically Raspian uses the My recommendation is to build anything not included by Berryconda from source using the Python provided by Berryconda. I understand that this can be a difficult task but it seem to be the only method to insure binary compatibility. |
I used berryconda to install opencv 3.3.0 into a python 3.5 virtual environment
but "import cv2" yielded this error:
ImportError: numpy.core.multiarray failed to import
The text was updated successfully, but these errors were encountered: