Python on Windows 7: dll load failed Net, SGDSolver, etc.

324 views
Skip to first unread message

Paul Delamusica

unread,
Jan 10, 2017, 1:03:25 AM1/10/17
to Caffe Users
I build caffe on VC2013 following the instructions in https://github.com/BVLC/caffe/blob/windows/README.md. It ran for a long time and seemed to have completed successfully, although I might have missed some messages.

I saw it produced caffe.exe in C:\projects\caffe\build\tools\Release. But when I try to import caffe in Python, I get the following message:

>>> import caffe
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\projects\caffe\python\caffe\__init__.py", line 1, in <module>
    from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropS
olver, AdaDeltaSolver, AdamSolver
  File "C:\projects\caffe\python\caffe\pycaffe.py", line 13, in <module>
    from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \
ImportError: DLL load failed: The specified module could not be found.

I could not find _caffe.so or any dll with recognizable name. What are the dlls that i need here? Were they supposed to be built by the script? If so, where are they placed? 

Here is the options set in the build_win.cmd file

) else (
    :: Change the settings here to match your setup
    :: Change MSVC_VERSION to 12 to use VS 2013
    if NOT DEFINED MSVC_VERSION set MSVC_VERSION=12
    :: Change to 1 to use Ninja generator (builds much faster)
    if NOT DEFINED WITH_NINJA set WITH_NINJA=0
    :: Change to 1 to build caffe without CUDA support
    if NOT DEFINED CPU_ONLY set CPU_ONLY=1
    :: Change to Debug to build Debug. This is only relevant for the Ninja generator the Visual Studio generator will generate both Debug and Release configs
    if NOT DEFINED CMAKE_CONFIG set CMAKE_CONFIG=Release
    :: Change to 1 to build a caffe.dll
    if NOT DEFINED CMAKE_BUILD_SHARED_LIBS set CMAKE_BUILD_SHARED_LIBS=0
    :: Change these options for your needs.
    if NOT DEFINED BUILD_PYTHON set BUILD_PYTHON=1
    if NOT DEFINED BUILD_PYTHON_LAYER set BUILD_PYTHON_LAYER=1
    if NOT DEFINED BUILD_MATLAB set BUILD_MATLAB=1
    :: If python is on your path leave this alone
    if NOT DEFINED PYTHON_EXE set PYTHON_EXE=python
    :: Run the tests
    if NOT DEFINED RUN_TESTS set RUN_TESTS=0
    :: Run lint
    if NOT DEFINED RUN_LINT set RUN_LINT=0
    :: Build the install target
    if NOT DEFINED RUN_INSTALL set RUN_INSTALL=1
)

Paul Delamusica

unread,
Jan 10, 2017, 12:37:38 PM1/10/17
to Caffe Users
I use Anaconda2 64 bit. 

Do I have to build shared libraries in order for the Python interface to work? I am having problems with setting CMAKE_BUILD_SHARED_LIBS=1.

Thanks! 
Reply all
Reply to author
Forward
0 new messages