cmusatyalab / openface

Face recognition with deep neural networks.
http://cmusatyalab.github.io/openface/
Apache License 2.0
15.09k stars 3.6k forks source link

ImportError: numpy.core.multiarray failed to import #30

Closed onurays closed 8 years ago

onurays commented 8 years ago

I am trying to setup this project for hours on Mac OS. Could anyone please help me to resolve this import error in server.py.

ImportError: numpy.core.multiarray failed to import Traceback (most recent call last): File "./server.py", line 28, in import cv2 ImportError: numpy.core.multiarray failed to import

kaikuehne commented 8 years ago

Hi, did you install numpy? You also need to install scipy, pandas, scikit-learn and scikit-image and the packages listed in demos/web/requirements.txt.

Note: If you are using a virtualenv (which I recommend), the cv2 package may not be available because the opencv python module was only installed for the system-python. In that case, just copy the cv2 module into your virtualenv:

cp /usr/local/lib/python2.7/site-packages/cv* <VIRTUALENV>/lib/python2.7/site-packages
onurays commented 8 years ago

Yes, I installed all of the dependencies. cv2 is also available. I already copied them to virtualenv.

numpy-1.10.1 pandas-0.17.0 scipy-0.16.0 scikit_image-0.11.3 scikit_learn-0.16.1

bamos commented 8 years ago

Do the solutions here help? http://stackoverflow.com/questions/28157976/importing-opencv-and-getting-numpy-core-multiarray-failed-to-import

bamos commented 8 years ago

See also http://stackoverflow.com/questions/20518632/importerror-numpy-core-multiarray-failed-to-import

onurays commented 8 years ago

I already tried both of your suggestions. numpy and others are up to date. Thanks.

bamos commented 8 years ago

What numpy version are you using? I'm using 1.9.2.

~$ python2 -c 'import numpy; print (numpy.version.version)'
1.9.2

Edit - sorry, I see you're using 1.10.1 from above.

bamos commented 8 years ago

Just as a sanity check, can you try outputting the numpy version right before the failed cv2 import?

bamos commented 8 years ago

https://github.com/Itseez/opencv/issues/4893 shows importing numpy before cv2 helps in some cases

onurays commented 8 years ago

Actually, i just deleted everything to start over, this will take some moment. Thanks a lot. I hope, import order is the case. Will write here, after test.

onurays commented 8 years ago

After struggle of another couple hours, I have a clean setup by following these tutorial for Mac OS: http://www.pyimagesearch.com/2015/06/15/install-opencv-3-0-and-python-2-7-on-osx/

Now, I am stuck on dlib setup. It is not compiling: CMake Error at /usr/local/Cellar/cmake/3.3.2/share/cmake/Modules/FindBoost.cmake:1245 (message): Unable to find the requested Boost libraries.

Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers. Call Stack (most recent call first): /Users/onurays/Documents/openface/dlib-18.16/dlib/add_python_module:57 (FIND_PACKAGE) CMakeLists.txt:5 (include)

bamos commented 8 years ago
bamos commented 8 years ago

Sorry for the bad setup experience. Depending on your use case, the Docker container works well on OSX with an Ubuntu Docker machine.

-Brandon.

On Tue, Oct 20, 2015 at 4:44 AM onurays notifications@github.com wrote:

For MacOS users: "brew install boost-python".

And now server.py throws "Segmentation fault: 11". Seems like an OpenCV bug for MacOS. I think i will give up :)

— Reply to this email directly or view it on GitHub https://github.com/cmusatyalab/openface/issues/30#issuecomment-149479507 .

RapidR3D commented 7 years ago

I just wanted to say that I have been having this issue for the past two days and began after an installation of visual studio 2015. I'm running windows 10, python 3.5. After much trial and error the solution was as simple as going to the sitepackages directory and manually deleting anything that had to do with NumPy or MatPlotLib. After deleting I reinstalled using the command: python -m pip install --user matplotlib-2.0.0-cp35-cp35m-win_amd64.whl

Everything is now back up and running. Including Jupyter Notebook. Which was an odyssey in itself as well. I hope this can help someone else. It seems so simple now but I swear I nearly through my rig out into the yard over trying to figure out a viable fix for this problem.

bamos commented 7 years ago

Thanks for the helpful post @RapidR3D!