BVLC / caffe

Caffe: a fast open framework for deep learning.
http://caffe.berkeleyvision.org/
Other
34.12k stars 18.69k forks source link

Python layers not compatible with matcaffe interface? #2850

Open to3i opened 9 years ago

to3i commented 9 years ago

There seems to be a dependency problem involving python layers #1703 and the matcaffe interface #2505.

Using matcaffe in order to load a network that contains a python layer will result in an import error:

ImportError: /usr/lib/python2.7/dist-packages/numpy/core/multiarray.so: undefined symbol: PyExc_SystemError

I am running the current master branch of caffe on Ubuntu 14.04. Using pycaffe everything works as advertised. Maybe someone can confirm this. Thanks!

iamprem commented 8 years ago

Hi, I also having the same issue. I have my Loss Layer defined in python and trying to train the network using matcaffe because I have few other stuff written in MATLAB that i will be using along training.

Traceback (most recent call last):
  File "/home/prem/MATLAB/matrobreg/L1LossLayer.py", line 1, in <module>  
    import caffe  
  File "/share/caffe/python/caffe/__init__.py", line 1, in <module>
    from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
  File "/share/caffe/python/caffe/pycaffe.py", line 11, in <module>
    import numpy as np
  File "/usr/lib/python2.7/dist-packages/numpy/__init__.py", line 153, in <module>
    from . import add_newdocs
  File "/usr/lib/python2.7/dist-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/usr/lib/python2.7/dist-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/usr/lib/python2.7/dist-packages/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/usr/lib/python2.7/dist-packages/numpy/core/__init__.py", line 6, in <module>
    from . import multiarray
ImportError: /usr/lib/python2.7/dist-packages/numpy/core/multiarray.so: undefined symbol: PyExc_SystemError

If anyone have a solution to use python layer along with matcaffe, please drop a comment below. Thanks

LucyLu-LX commented 6 years ago

I encountered the same problem. Have you solved it yet? @iamprem @to3i

iamprem commented 6 years ago

Unfortunately I couldn't solve it. I decided to use pycaffe and used matlab engine in python to run the matlab scripts. https://www.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html