Executable from Python Wrapper

Hello Orekit Community,

I’ve recently started using Orekit with the python wrapper because I’m not familiar with Java.

I want to create an executable from the code using PyInstaller, even though I know Python is not a good choice for this kind of applications.

PyInstaller creates an .exe which works fine until orekit is initialized with vm = orekit.initVM().

At that point it prints:

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

Is there a way to generate a .exe from the python wrapper?

I saw with PyInstaller additional data can be added with the option --add-data. Would it work adding the missing libraries? In that case, which are the libraries missing?

Thanks,
Alessandro

Hi @aleb,

It is possible to create the .exe with the orekit python wrapper and PyInstaller. You can have a look at this issue and the solution that is proposed there.

2 Likes

Hello @gowtham,

Thank you for your answer. I was able to follow your steps till step 2. I had to change the path for jre, but I guess is the whole jre folder in miniconda (I’m using miniconda instead of conda).

Unfortunately I couldn’t find the libjvm.dylib. I just found a jmv.dll which is already in the dist/PROJECT folder.

The executable anyway is giving me the same error.

Thanks again,
Alessandro

@aleb,

The instruction given in that issue was specifically for Mac/osx. But I understand you’re using Windows to generate the executable. I have had success in generating executable in Linux as well as Mac. Yes, you’re right about the jre folder and the dll file which is already in the dist/PROJECT folder is the issue, that needs to be replaced with the one in the jre folder packed.

I tried replacing the jvm.dll but it didn’t work.

Anyway I discovered the executable works removing the jvm.dll from the dist/PROJECT folder. I honestly don’t know why.

Thanks for the support @gowtham