0

I am getting an error:

"Error occurred during initialization of VM
Unable to load native library: Can't find dependent libraries"

The error arises when I try to execute my exe file.

I have created exe file through pyinstaller on a django application. Application uses pylucine library. I think it may be the issue of error.

How to fix the error?

Robert
  • 10,403
  • 14
  • 67
  • 117

2 Answers2

0

Since I can't be certain given you've provided very few details here is a shot in the dark to help solve your problem:

First, try removing the jvm.dll file that gets packaged with the pyinstaller -D youmodule.py command (for now work with the directory command rather than -F option). The reason why is here.

With that jvm.dll file gone, you should start seeing the actual error code - and with that the java class or dependency that isn't being loaded.

If it's a java class that isn't being properly loaded then you know instantly it must not be correcly represented in the classpath environment variable and you should do everything in your power to make sure it is:

e.g.: os.environ['CLASSPATH'] += 'the/path/to/the/jar'

Otherwise, consider bulking up your question with more details, especially if you can get a more meaningful error output.

Community
  • 1
  • 1
ecoe
  • 4,994
  • 7
  • 54
  • 72
0

I had the same error trying to run a .exe built with PyInstaller through wine.

My problem went away by adding C:\Program Files\Java\ [your jdk version here] \jre\bin\server to the PATH environment variable in wine - I suppose it might be the same in Windows.

It also reappeared if I tried to build with C:\Program Files\Java\ [your jdk version here] \jre\bin\server in my PATH, so I had to build without it and then append it before running it (I have no explanation as to why this happens).

Andreas Grivas
  • 337
  • 4
  • 6
  • I think I understand now. When I built the .exe with the jre path it included the jvm.dll file in the .exe and therefore I got an error because it couldn't find the rest of the jre. So apparently there are 2 solutions to the problem **a)** Add all the jre folder to your .exe (not portable but no fiddling with paths) **b)** Build without the path to jre\bin\server in your path, and add it to your path wherever you are going to execute the .exe file – Andreas Grivas Jan 31 '15 at 14:08