Comments (2)
Found an explanation:
https://stackoverflow.com/questions/19776571/error-dlopen-library-not-loaded-reason-image-not-found
I'm not sure I understand the issue at hand, but I investigated and found a workaround:
First let's see where what pydarknet.cpython-37m-darwin.so is looking for:
otool -L /usr/local/lib/python3.7/site-packages/pydarknet.cpython-37m-darwin.so
/usr/local/lib/python3.7/site-packages/pydarknet.cpython-37m-darwin.so:
libdarknet.so (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0)
It looks like libdarknet.so is referenced with a relative path.
Its absolute path is /usr/local/lib/python3.7/site-packages/__libdarknet/libdarknet.so
A workaround is to copy libdarknet.so to the current working directory.
But then, another error arises:
Traceback (most recent call last):
File "/Users/zulu/docs/projets/dev/python/yolo-computer-vision/YOLO3-4-Py/video_demo.py", line 3, in
from pydarknet import Detector, Image
ImportError: dlopen(/usr/local/lib/python3.7/site-packages/pydarknet.cpython-37m-darwin.so, 2): Library not loaded: @rpath/libcudart.9.2.dylib
Referenced from: /Users/zulu/docs/projets/dev/python/yolo-computer-vision/YOLO3-4-Py/libdarknet.so
Reason: image not found
Let's run otool again:
otool -L libdarknet.so
libdarknet.so:
libdarknet.so (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
/usr/local/opt/opencv/lib/libopencv_stitching.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_superres.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_videostab.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_aruco.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_bgsegm.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_bioinspired.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_ccalib.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_dnn_objdetect.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_dpm.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_face.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_photo.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_fuzzy.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_hfs.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_img_hash.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_line_descriptor.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_optflow.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_reg.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_rgbd.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_saliency.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_stereo.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_structured_light.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_phase_unwrapping.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_surface_matching.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_tracking.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_datasets.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_dnn.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_plot.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_xfeatures2d.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_shape.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_video.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_ml.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_ximgproc.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_calib3d.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_features2d.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_highgui.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_videoio.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_flann.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_xobjdetect.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_imgcodecs.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_objdetect.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_xphoto.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_imgproc.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/opt/opencv/lib/libopencv_core.3.4.dylib (compatibility version 3.4.0, current version 3.4.2)
/usr/local/cuda/lib/libcuda.dylib (compatibility version 1.1.0, current version 9.2.64)
@rpath/libcudart.9.2.dylib (compatibility version 0.0.0, current version 9.2.148)
@rpath/libcublas.9.2.dylib (compatibility version 0.0.0, current version 9.2.148)
@rpath/libcurand.9.2.dylib (compatibility version 0.0.0, current version 9.2.148)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0)
So this is the same issue as before, except this time the paths are absolute.
I don't know how @rpath works, but on my system the 3 dylibs are in Developer/NVIDIA/CUDA-9.2/lib/.
No big deal, just use install_name_tool to change the paths:
install_name_tool -change @rpath/libcudart.9.2.dylib /Developer/NVIDIA/CUDA-9.2/lib/libcudart.9.2.dylib libdarknet.so
install_name_tool -change @rpath/libcublas.9.2.dylib /Developer/NVIDIA/CUDA-9.2/lib/libcublas.9.2.dylib libdarknet.so
install_name_tool -change @rpath/libcurand.9.2.dylib /Developer/NVIDIA/CUDA-9.2/lib/libcurand.9.2.dylib libdarknet.so
After doing this, the python script runs fine!
I think something has to be changed in the install script to fix this.
from yolo3-4-py.
Hi @zulufoxtrot, Unfortunately, yolo34py do not officially support MacOS. I believe that is why API failed to link with libdarknet.so automatically as intended.
Anyhow, I am glad you managed to find a solution. Would you be able to share the changes you made as a pull request? Then we can maintain a separate branch for Mac OS. (Unfortunately, I will not be able to contribute to the MacOS branch since I do not have a Mac)
Cheers!
from yolo3-4-py.
Related Issues (20)
- get error when i install yolo34py in Windows 8 pro HOT 1
- running yolov4 HOT 1
- Error installing from both pip and source HOT 5
- Disable architecture printing HOT 1
- batch inference HOT 1
- ModuleNotFoundError: No module named 'numpy' HOT 1
- does it work with yolov4? HOT 2
- Ubuntu 20.4 installation error HOT 1
- FileNotFoundError: pkg-config, pkg-config HOT 1
- ImportError: No module named pydarknet HOT 5
- Proxy issue in downloading https://github.com/madhawav/darknet while installing YOLO34PY using PIP HOT 1
- crashes on colab using custom weights/config HOT 2
- Trouble installing pip install yolo34py-gpu HOT 1
- Errors in "pip3 install yolo34py-gpu" HOT 1
- Error when installing yolo34py-gpu from source. HOT 2
- Segmentation Fault when running custom model HOT 1
- Error when pip installing
- Installation with newer GCC not working HOT 1
- Error pip installing yolo34py on windows
- Google Colab crashed when I was running the Detector HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yolo3-4-py.