Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File "/Users/zhongzunfa/fjl/py-faster-rcnn/tools/../caffe-fast-rcnn/python/caffe/pycaffe.py", line 13, in <module> from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \ ImportError: dlopen(/Users/zhongzunfa/fjl/py-faster-rcnn/tools/../caffe-fast-rcnn/python/caffe/_caffe.so, 2): Library not loaded: libcaffe.so.1.0.0-rc3 Referenced from: /Users/zhongzunfa/fjl/py-faster-rcnn/caffe-fast-rcnn/python/caffe/_caffe.so Reason: image not found #634

Open
fujingling opened this issue Jul 19, 2017 · 4 comments

Comments

@fujingling
Copy link

when I run the demo.py of faster rcnn, I get this problem,who knows how to solve it?Thank you very much!
zhongzunfadeMacBook-Air:tools zhongzunfa$ python demo.py
Traceback (most recent call last):
File "demo.py", line 17, in
from fast_rcnn.test import im_detect
File "/Users/zhongzunfa/fjl/py-faster-rcnn/tools/../lib/fast_rcnn/test.py", line 16, in
import caffe
File "/Users/zhongzunfa/fjl/py-faster-rcnn/tools/../caffe-fast-rcnn/python/caffe/init.py", line 1, in
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
File "/Users/zhongzunfa/fjl/py-faster-rcnn/tools/../caffe-fast-rcnn/python/caffe/pycaffe.py", line 13, in
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver,
ImportError: dlopen(/Users/zhongzunfa/fjl/py-faster-rcnn/tools/../caffe-fast-rcnn/python/caffe/_caffe.so, 2): Library not loaded: libcaffe.so.1.0.0-rc3
Referenced from: /Users/zhongzunfa/fjl/py-faster-rcnn/caffe-fast-rcnn/python/caffe/_caffe.so
Reason: image not found

@zhenni
Copy link

zhenni commented Jul 24, 2017

I do not use mac to run this project. Just a guess.... Maybe you do not add the demo image path to your path.....

@Dshinji137
Copy link

Hi, same problem and I am also using MAC, any idea to solve it?

@riadhayachi
Copy link

i think that you have a problem with caffe installation
try to go to py-faster-rcnn/caffe-fast-rcnn /python/caffe
open python and import caffe
i think it will send you the same error
it that correct reinstall caffe (go to caffe oficial site to see how to install caffe in mac)

@syangav
Copy link

syangav commented Aug 14, 2017

Hi, I am using Mac OS X 10.12.6 and have met similar issues as mentioned above.
@fujingling @Dshinji137

This is the wrong output. I am working on a python virtual environment called "fasterRcnn". My Mac user name is ysh.

(fasterRcnn) ysh@16:32:49@~/Projects/py-faster-rcnn/caffe-fast-rcnn$ python
Python 2.7.13 (default, Jul 18 2017, 09:17:00)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

import caffe
Traceback (most recent call last):
File "", line 1, in
File "/Users/ysh/Projects/py-faster-rcnn/caffe-fast-rcnn/python/caffe/init.py", line 1, in
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
File "/Users/ysh/Projects/py-faster-rcnn/caffe-fast-rcnn/python/caffe/pycaffe.py", line 13, in
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver,
ImportError: dlopen(/Users/ysh/Projects/py-faster-rcnn/caffe-fast-rcnn/python/caffe/_caffe.so, 2): Library not loaded: libcaffe.so.1.0.0-rc3
Referenced from: /Users/ysh/Projects/py-faster-rcnn/caffe-fast-rcnn/python/caffe/_caffe.so
Reason: image not found

I have been stuck for a while until I found a similar issue here. BVLC/caffe#3597

First step:
(fasterRcnn) ysh@16:41:50@~/Projects/py-faster-rcnn/caffe-fast-rcnn$ otool -l -v python/caffe/_caffe.so | grep caf
python/caffe/_caffe.so:
name python/caffe/_caffe.so (offset 24)
name libcaffe.so.1.0.0-rc3 (offset 24)

Second step:
(fasterRcnn) ysh@16:47:37@~/Projects/py-faster-rcnn/caffe-fast-rcnn$ install_name_tool -change libcaffe.so.1.0.0-rc3 @rpath/libcaffe.so.1.0.0-rc3 python/caffe/_caffe.so

Result of second step:
(fasterRcnn) ysh@16:48:06@~/Projects/py-faster-rcnn/caffe-fast-rcnn$ otool -l -v python/caffe/_caffe.so | grep caf
python/caffe/_caffe.so:
name python/caffe/_caffe.so (offset 24)
name @rpath/libcaffe.so.1.0.0-rc3 (offset 24)

Third step:
(fasterRcnn) ysh@16:48:12@~/Projects/py-faster-rcnn/caffe-fast-rcnn$ install_name_tool -add_rpath /Users/ysh/Projects/py-faster-rcnn/caffe-fast-rcnn/.build_release/lib python/caffe/_caffe.so

Result of third step:
(fasterRcnn) ysh@16:49:02@~/Projects/py-faster-rcnn/caffe-fast-rcnn$ otool -l -v python/caffe/_caffe.so | grep caf
python/caffe/_caffe.so:
name python/caffe/_caffe.so (offset 24)
name @rpath/libcaffe.so.1.0.0-rc3 (offset 24)
path /Users/ysh/Projects/py-faster-rcnn/caffe-fast-rcnn/.build_release/lib (offset 12)

As you can see, the commands
install_name_tool -change libcaffe.so.1.0.0-rc3 @rpath/libcaffe.so.1.0.0-rc3 python/caffe/_caffe.so
install_name_tool -add_rpath /Users/ysh/Projects/py-faster-rcnn/caffe-fast-rcnn/.build_release/lib python/caffe/_caffe.so
add the path to the libcaffe.so.1.0.0-rc3 lib.

The command
otool -l -v python/caffe/_caffe.so | grep caf
shows the lib status.

Everything solved.
(fasterRcnn) ysh@16:50:31@~/Projects/py-faster-rcnn/caffe-fast-rcnn$ python
Python 2.7.13 (default, Jul 18 2017, 09:17:00)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

import caffe

Please pay attention to the directories where you use these commands. Your faster R-cnn folder directory might differ from mine.

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

No branches or pull requests

5 participants