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

IMPORT ERROR #7048

Open
DongStop opened this issue Mar 2, 2022 · 9 comments
Open

IMPORT ERROR #7048

DongStop opened this issue Mar 2, 2022 · 9 comments

Comments

@DongStop
Copy link

DongStop commented Mar 2, 2022

Traceback (most recent call last):
File "demo.py", line 6, in
import caffe
File "/home/dong/work/caffe/python/caffe/init.py", line 1, in
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver, NCCL, Timer
File "/home/dong/work/caffe/python/caffe/pycaffe.py", line 13, in
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver,
ImportError: /home/dong/work/caffe/build/lib/libcaffe.so.1.0.0: unexpected reloc type 0x03

@xiaolin1990
Copy link

xiaolin1990 commented Mar 2, 2022 via email

@lovie123
Copy link

lovie123 commented Mar 2, 2022 via email

@dragonQian
Copy link

dragonQian commented Mar 2, 2022 via email

@Rocksnake
Copy link

Traceback (most recent call last): File "demo.py", line 6, in import caffe File "/home/dong/work/caffe/python/caffe/init.py", line 1, in from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver, NCCL, Timer File "/home/dong/work/caffe/python/caffe/pycaffe.py", line 13, in from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, ImportError: /home/dong/work/caffe/build/lib/libcaffe.so.1.0.0: unexpected reloc type 0x03

@DongStop The reason for this problem is that the relevant dependencies are missing in your python compilation environment.
You only need to download the relevant dependencies through pip or conda
just like:
pip install <source-package>
conda install <source-package>

@DongStop
Copy link
Author

DongStop commented Mar 4, 2022

@Rocksnake But I dont't know what dependencies are missing.the compiling process is successful.

@DongStop
Copy link
Author

DongStop commented Mar 4, 2022

@Rocksnake the cmake information as follow
******************* Caffe Configuration Summary *******************
General:
Version : 1.0.0
Git : 1.0-136-g9b891540-dirty
System : Linux
C++ compiler : /usr/bin/c++
Release CXX flags : -O3 -DNDEBUG -fPIC -Wall -Wno-sign-compare -Wno-uninitialized
Debug CXX flags : -g -fPIC -Wall -Wno-sign-compare -Wno-uninitialized
Build type : Release
BUILD_SHARED_LIBS : ON
BUILD_python : ON
BUILD_matlab : OFF
BUILD_docs : ON
CPU_ONLY : ON
USE_OPENCV : ON
USE_LEVELDB : ON
USE_LMDB : ON
USE_NCCL : OFF
ALLOW_LMDB_NOLOCK : OFF
USE_HDF5 : ON
Dependencies:
BLAS : Yes (Atlas)
Boost : Yes (ver. 1.78)
glog : Yes
gflags : Yes
protobuf : Yes (ver. ..)
lmdb : Yes (ver. 0.9.24)
LevelDB : Yes (ver. 1.22)
Snappy : Yes (ver. 1.1.8)
OpenCV : Yes (ver. 3.4.16)
CUDA : No
Python:
Interpreter : /usr/bin/python (ver. 3.7.1)
Libraries : /usr/local/lib/libpython3.7m.a (ver 3.7.1)
NumPy : /usr/local/lib/python3.7/site-packages/numpy/core/include (ver 1.21.5)

Documentaion:
Doxygen : No
config_file :
Install:
Install path : /home/dong/work/caffe/build/install
Configuring done
Generating done
Build files have been written to: /home/dong/work/caffe/build

@Rocksnake
Copy link

The package after the from keyword is a large package, and the package after the import keyword is included in the former.
You can choose to download the package after the from keyword, or you can choose to download the package after the import.
I think you just need to execute these code:
pip install caffe
pip install .pycaffe
pip install ._caffe

@DongStop
Copy link
Author

DongStop commented Mar 4, 2022

@Rocksnake my hardware doesn't support GPU.maybe using pip to install doesn't make it work!

@DongStop
Copy link
Author

DongStop commented Mar 4, 2022

image

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