Python orekit wrapper v9.3.1 available

Hi,

The orekit python wrapper for orekit 9.3.1 is now available on the code repo as well as build pre-made conda packages for most platforms.

The updated version is based on the release version of orekit 9.3.1 with its GPS week rollover fix.

In addition there are a number of python related fixes in this version:

  • It’s based on JCC 3.5 that includes a minor fix related to Python 3.7 and some IDE’s
  • Includes bug fix in PythonOrekitStepHandler
  • Included python test case for InterSatDirectViewDetector, OrekitStepHandler

A large number of python-extension classes is included, basically for all external usable interfaces and abstract classes in orekit. All such wrapping classes without a test case shall be considered experimental.

For documentation particular for the python aspects, I recommend looking at the test cases.

As previously, the recommended installation method is the conda packages from conda forge:

Best Regards
/Petrus

Petrus,
I used conda to install the latest wrapper but running my test program in Spyder I get:
runfile(‘C:/Crumpton/Python_Orekit/pyOrekitTest.py’, wdir=‘C:/Crumpton/Python_Orekit’)
Traceback (most recent call last):

File “”, line 1, in
runfile(‘C:/Crumpton/Python_Orekit/pyOrekitTest.py’, wdir=‘C:/Crumpton/Python_Orekit’)

File “C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py”, line 786, in runfile
execfile(filename, namespace)

File “C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py”, line 110, in execfile
exec(compile(f.read(), filename, ‘exec’), namespace)

File “C:/Crumpton/Python_Orekit/pyOrekitTest.py”, line 9, in
import orekit

File “C:\ProgramData\Anaconda3\lib\site-packages\orekit_init_.py”, line 3, in
from . import _orekit

ImportError: DLL load failed: The specified module could not be found.

I verified that the files are in:
C:\ProgramData\Anaconda3\Lib\site-packages\orekit

Any help would be appreciated. Thanks.

Stephen Crumpton

Hi Stephen,

The very most likely cause is that you have not activated your conda environment, and thus your environment variables are not set.

Activation of environment can be done by:

  • launching spyder (or other app) from the anaconda navigator interface
  • launching it from an activated prompt (either through anaconda prompt or through “conda activate env”)
  • pointing the spyder executable at a python that activate the environment automatically through the conda-wrapper, see installation instructions:
    https://gitlab.orekit.org/orekit-labs/python-wrapper/wikis/installation
  • or set them directly in your environment by hand, but this misses a bit of the point with the relocatable conda enviroment.

Best Regards
/Petrus

Thanks. That worked. I am at a new company and setting up a new laptop and I do not recall all the steps to get these things configured. (I am making note of them now!)

Hi Petrus,
I’m having a similar problem to Stephen, I get the same error. However I am in an activated environment that contains orekit. I’ve put my code below:


The only time I can this to work successfully is in Jupyter notebooks but I can’t use them for the rest of my program. Could you please help me?
Thank you!

Hi,

This looks very much like some problem with the activation as it works in jupyter. When you change environment, do you see some printouts of variables being set?

On windows the critical environment parameters that are supposed to be automatically set are JCC_JDK and for windows also PATH.

You can check in your python env what the values of these are with

import os
print(os.environ[‘JCC_JDK’])

Check also the orekit dir as pointed in your error log that there are some files there, in my dir it looks like this:

(still using 9.3.1 for legacy reasons…)

Hi Petrus,
Thanks for replying. I think you are right about it being an issue with the activation. This seems to solve the issue.


I have found that, for some reason, the activation works properly when I do it through the Anaconda Navigator, but not directly through the terminal.
I also looked at the orekit dir and found it to match yours (with 10.0).

Thank you for helping me so far.

Hi fs,

Good that you managed to get it working. Let us know if you find out later that it is some bug in the activation.

One other way to solve it is to use conda-wrappers, see the wiki. It is a set of scripts that wraps main commands like python to include activation of the environment. This is useful if you for example run some things from an IDE where you may have different activations for different projects.

Regards
/Petrus