Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Trouble building pycaffe #14

Closed
by321 opened this issue Feb 7, 2016 · 9 comments
Closed

Trouble building pycaffe #14

by321 opened this issue Feb 7, 2016 · 9 comments

Comments

@by321
Copy link

by321 commented Feb 7, 2016

I'm having trouble building pycaffe, I'm not sure if it's some problem with my local setup. It seems to me there're two issues:

  1. The 3rdparty\include\boost\python subdir is missing, and you should copy it from the right boost version. This is the easy part.
  2. The real problem for me is that _caffe.cpp includes numpy/arrayobject.h. You can copy the numpy includes into 3rdparty\include, but arrayobject.h causes a few other files to be included, including __multiarray_api.h and _numpyconfig.h. And as far as I can determine, these are not in the numpy source distribution, instead they are generated during the numpy build/installation process. And try as I may, I could not get numpy to build on my machine.

Am I missing something obvious here ? Is there an easier way ?

@zer0n
Copy link

zer0n commented Feb 7, 2016

This issue was already brought up in #6 . It's addressed in @pavlejosipovic 's pull request: #13. Should be available in master soon. If you don't want to wait, consider checking out the branch bvlc_win.

@by321
Copy link
Author

by321 commented Feb 8, 2016

I think the actual fix belongs to wincaffe-3rdparty, which will then be pulled into this project.

Trying to build numpy, I eventually got the "ImportError: cannot import name multiarray" error msg. From web searches I saw this issue is not Windows-specific, people have been having this problem for years on Linux.

@zer0n
Copy link

zer0n commented Feb 9, 2016

You just need to point to the Python lib library with numpy. You shouldn't need to build numpy yourself.

Please follow the instruction here: https://github.com/Microsoft/caffe#python

@by321
Copy link
Author

by321 commented Feb 10, 2016

OK, got past the compiling step, still have trouble with libs during linking.

@by321
Copy link
Author

by321 commented Feb 10, 2016

zer0n, do you know if anyone has successfully built and run this in python ?

Anaconda 2.7 was built using VC for Python 2.7 compiler, which is based on VC 2008
Anaconda 3.5 was built using VC 2015
We're building this using VC 2013

Will it run ?

@pavlejosipovic
Copy link

It will run with Miniconda 2.7 x64.
Follow Python setup guide https://github.com/Microsoft/caffe#python
After you built Caffe with Python support do the following to run UT.
set PATH=%PATH%\Build\x64\Release
set PythonPath=\Build\x64\Release\pycaffe
python -m unittest discover -s <caffe_root>\python\caffe\test

@fycus-tree
Copy link

Not working for me. Built from master against full Anaconda 2.7. Obviously the paths are set correct, as it's loading the module. There exists a _caffe.pyd in Release\pycaffe\caffe\

ERROR: test_io (unittest.loader.ModuleImportFailure)

ImportError: Failed to import test module: test_io
Traceback (most recent call last):
File "C:\Anaconda\lib\unittest\loader.py", line 254, in _find_tests
module = self.get_module_from_name(name)
File "C:\Anaconda\lib\unittest\loader.py", line 232, in get_module_from_name
import(name)
File "C:\Users\fycus\caffe\python\caffe\test\test_io.py", line 4, in
import caffe
File "C:\Users\fycus\caffe\Build\x64\Release\pycaffe\caffe__init
.py", line 1, in
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, >AdaDeltaSolver, AdamSolver
File "C:\Users\fycus\caffe\Build\x64\Release\pycaffe\caffe\pycaffe.py", line 13, in
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver,
ImportError: DLL load failed: The specified module could not be found.

@mnidza
Copy link

mnidza commented Feb 12, 2016

It definitely looks like Caffe's runtime dependencies cannot be found. Please double-check that <caffe_root>\Build\x64\Release is in your PATH, and that it is separated by a semicolon from previous dirs (if you followed @pavlejosipovic's comment above this may not be the case).

Alternatively, try copying <caffe_root>\Build\x64\Release*.dll to <caffe_root>\Build\x64\Release\pycaffe\caffe.

@zer0n
Copy link

zer0n commented Feb 12, 2016

Yeah, just copy the DLLs to Build\x64\Release\pycaffe\caffe.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants