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

Can't find dependent libraries #517

Open
MrBlazer335 opened this issue Feb 1, 2024 · 5 comments
Open

Can't find dependent libraries #517

MrBlazer335 opened this issue Feb 1, 2024 · 5 comments

Comments

@MrBlazer335
Copy link

Describe the problem

Task :desktop:run
Exception in thread "main" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.UnsatisfiedLinkError: P:\Java\Java-Python\venv\Lib\site-packages\jep\jep.dll: Can't find dependent libraries
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.(Lwjgl3Application.java:173)
at com.roquelike.game.DesktopLauncher.main(DesktopLauncher.java:15)
Caused by: java.lang.UnsatisfiedLinkError: P:\Java\Java-Python\venv\Lib\site-packages\jep\jep.dll: Can't find dependent libraries
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2418)
Caused by: java.lang.UnsatisfiedLinkError: P:\Java\Java-Python\venv\Lib\site-packages\jep\jep.dll: Can't find dependent libraries
I did args, I use gradle, I used even MainInterpreter, pls help

Environment (please complete the following information):
Windows 10
3.12
21
4.2.0
numpy

@bsteffensmeier
Copy link
Member

It looks like you are using a virtual environment. Make sure your virtual environment is active before starting your java program. #513 may have some information that can help you.

@whaypr
Copy link

whaypr commented Jul 27, 2024

Hi, I have the same issue and none of the proposed solutions worked for me. @MrBlazer335, were you able to solve it?

@bking-encodia
Copy link

Got this issue running jep under Windows with Python 3.12 in a virtual environment. I was correctly adding the folder with jep.dll to PATH environment variable. But it was still complaining "Can't find dependent libraries". Turns out I also needed to add the folder containing python312.dll to the PATH as well. My final PATH environment variable ended being:

PATH=D:\myapp\venv\Lib\site-packages\jep;C:\Users\someuser\AppData\Local\Programs\Python\Python312

Then it worked

@whaypr
Copy link

whaypr commented Jul 31, 2024

Got this issue running jep under Windows with Python 3.12 in a virtual environment. I was correctly adding the folder with jep.dll to PATH environment variable. But it was still complaining "Can't find dependent libraries". Turns out I also needed to add the folder containing python312.dll to the PATH as well. My final PATH environment variable ended being:

PATH=D:\myapp\venv\Lib\site-packages\jep;C:\Users\someuser\AppData\Local\Programs\Python\Python312

Then it worked

Thanks for your quick response!

There was indeed an issue with Python's DLL not being present in the PATH. To be more precise, the issue was that there was only Microsoft Store Python installed on my machine, which does not provide the DLL. The solution was to install Python from its website and the PATH was automatically updated accordingly.

Having fixed the problem, I've got <class 'ModuleNotFoundError'>: No module named 'jep' error instead, which I fixed by adding

    SharedInterpreter.setConfig(
      new JepConfig()
        .addIncludePaths(Paths.get("<path_to_venv>/Lib/site-packages/jep/").toString)
    )

to my code.

That resolved into <class 'ImportError'>: dynamic module does not define module export function (PyInit_jep) error when instantiating SharedInterpreter class. For this error I have not been able to find any solution yet.


EDIT

The last error was caused by pointing to the jep directory itself and not to the directory containing the jep directory, as stated here. With

    SharedInterpreter.setConfig(
      new JepConfig()
        .addIncludePaths(Paths.get("<path_to_venv>/Lib/site-packages/").toString)
    )

everything works now.

@drseung
Copy link

drseung commented Sep 15, 2024

I am having the same issue. The above suggestions of path setting and edits to JepConfig did not work. Has anyone tried anything else.

My application ships with an embedded python for windows environments where python is not installed. When I unpack this and try to get a new SharedInterpreter() I get Java.lang.UnsatisfiedLinkError. I am correctly adding the jep.dll path for System.load(jepLibraryPath) call in MainInterpreter.initialize() via MainInterpreter.setJepLibraryPath(jepPath).

I have tried the System PATH edit as well as add the JepConfig.addIncludePaths with all the paths in my python package (Lib, Scripts, libs, Lib\site-package, include, DLLs)

I have tried this with a minimalist embedded .zip python and complete python312 build.
I have set pythonhome in jep.pyCconfig " C:\vapData*.vap\py\vi_venv"
I have set the jepLibraryPath "C:\Users*.vap\py\vi_venv\Lib\site-packages\jep\jep.dll"

Exception in thread "Thread-154" java.lang.UnsatisfiedLinkError: C:\vapData***.vap\py\vi_venv\Lib\site-packages\jep\jep.dll: Can't find dependent libraries
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2399)
at java.base/java.lang.Runtime.load0(Runtime.java:852)
at java.base/java.lang.System.load(System.java:2030)
at jep.MainInterpreter.initialize(MainInterpreter.java:126)
at jep.MainInterpreter.getMainInterpreter(MainInterpreter.java:101)
at jep.Jep.(Jep.java:133)
at jep.SharedInterpreter.(SharedInterpreter.java:60)
at ca.okello.vi.central.OsGovernor.getPyInterpreter(OsGovernor.java:400)
at ca.okello.vi.ui.onBoarding.OnboardingCTRL$2.run(OnboardingCTRL.java:117)
at java.base/java.lang.Thread.run(Thread.java:1570)

Any thoughts?

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