Darknet: OSerror: libdarknet.so:cannot open shared object file: no such file or directory

Created on 21 Jan 2018  路  20Comments  路  Source: pjreddie/darknet

when i tried to run darknet.py, some error happened , and i don't know why!!!
aaa

Most helpful comment

It worked when I gave the complete path to libdarknet.so in darknet.py

All 20 comments

Change the path of the lib in darknet.py and/or execute it from the right place and/or make sure the make worked.

It worked when I gave the complete path to libdarknet.so in darknet.py

libdarknet.so needs to be in your library paths. You can add libdarknet.so to LD_LIBRARY_PATH, or copy it to /usr/lib/libdarknet.so, or any other path that is included in your library paths.

Change the path of the lib in darknet.py and/or execute it from the right place and/or make sure the make worked.

i dont have libdarknet file

Either keep the libdarknet.so file in the same directory as your python code, or simple give the whole path instead to the CDLL object.

Change the path of the lib in darknet.py and/or execute it from the right place and/or make sure the make worked.

i dont have libdarknet file

It means that your make was not successful. Try installing it once again. Follow this instructions: https://pjreddie.com/darknet/install/

I solved this by adding import os on top and then replace that line with:
lib = CDLL(os.path.join(os.getcwd(), "libdarknet.so"), RTLD_GLOBAL)

then should work by running normally the script: python python/darknet.py

guys I'm having the same issues, how to change the path of lib in my darknet.py
pls can someone explain with the steps of how to change?

am just started with darknet but this error is killing me the past two days.
_Thanks_

@Mahamatnour

in darknet.py, line 48

lib = CDLL("libdarknet.so", RTLD_GLOBAL)

change this to

lib = CDLL("/Users/home/Mahamatnour/darknet/libdarknet.so", RTLD_GLOBAL)

but replace "/Users/home/Mahamatnour/darknet/libdarknet.so" with the path to the libdarknet.so file on your actual machine.

If you don't know where that is, try this

find ~ -name libdarknet.so

that should output something like

john@my-server:~/darknet/python$ find ~ -name libdarknet.so
/home/john/darknet/libdarknet.so

i dont have libdarknet file

+1.

I don't have the libdarknet.so file either. And the make worked just fine and no reported errors. I can run the darknet binary and do training, testing etc. But the python scripts fail with
OSError: ./libdarknet.so: cannot open shared object file: No such file or directory

If you cannot find lib.so, you can remake and change the MakefileLIBSO=1

Same here, can't find libdarknet.so after cmake
https://github.com/AlexeyAB/darknet#how-to-compile-on-linux-using-cmake

If setting LIBSO=1 can be solved in make
Which value should be set in cmake?

Hey @ggosiang @zonasw @lrustand

I had this same issue.
Using Makefile, it doesn't generate libdarknet.so, but using CMakeLists.txt, it does.
What I did was, I built it using CMake and got the .so as libdark.so, then I renamed and put it in the darknet.py folder, now it's working fine.

@qboticslabs
I can get libdarknet.so by setting LIBSO=1 within Makefile

Hey @ggosiang @zonasw @lrustand

I had this same issue.
Using Makefile, it doesn't generate libdarknet.so, but using CMakeLists.txt, it does.
What I did was, I built it using CMake and got the .so as libdark.so, then I renamed and put it in the darknet.py folder, now it's working fine.

Can you please tell me how to make darknet with CMakeLists.txt instead of Makefile?

Hi @Commando-one

Can you check the following blog post I have written about this?

Hi @Commando-one

Can you check the following blog post I have written about this?

Worked for me, thanks

@qboticslabs
I can get libdarknet.so by setting LIBSO=1 within Makefile

Yes Thank you it works!

Trying to load libdarknet.so and facing this issue:

Traceback (most recent call last): File "D:/alpr-unconstrained-master/alpr_video.py", line 6, in <module> import darknet.python.darknet as dn File "D:\alpr-unconstrained-master\darknet\python\darknet.py", line 70, in <module> lib = CDLL("darknet/libdarknet.so", RTLD_GLOBAL) File "D:\InstalledPrograms\Anaconda3\lib\ctypes\__init__.py", line 373, in __init__ self._handle = _dlopen(self._name, mode) FileNotFoundError: Could not find module 'D:\alpr-unconstrained-master\darknet\libdarknet.so' (or one of its dependencies). Try using the full path with constructor syntax.

Operating System:
Windows 10 64-bit
Darknet .so make using cygwing64 terminal.
Python Version 3.8

Note: If i use Ubuntu terminal for Window 10 to make libdarknet.so and run python code using Ubuntu terminal, everything works fine. Please help me to resolve this issue for windows
thanks

Please i need help
I dont have libdarknet.so file and i also dont have LIBSO within Makefile
Is there a new update of the darknet or can someone help me
Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sujithm picture sujithm  路  3Comments

job2003 picture job2003  路  3Comments

sayanmutd picture sayanmutd  路  3Comments

TheHidden1 picture TheHidden1  路  3Comments

ghost picture ghost  路  4Comments