Test of orekit python wrapper for mac M1/M2 needed

Hi,

This weekend I managed to get the orekit python wrapper cross-compiled for mac M1/M2, but I cannot test it as it needs a mac HW to run.

Could someone with a mac M1/M2 please try to install it via conda and report back?

same as with other platforms, just “conda install -c conda-forge orekit”

and then run: import orekit; orekit.initVM()
if that works it should be ok.

Hi,

Tried on M2 (MacBook Pro, Ventura 13.4)

  1. conda create -n oretest python=3.8
  2. conda activate oretest
  3. conda install -c conda-forge orekit==11.3.2
  4. python; import orekit; orekit.initVM()

this gives message: <jcc.JCCenv object at 0x7f8d400aa550>

Thanks @AlexS! This is the expected response from a working installation, great!

That’s very exciting! It failed for me so I’m posting some info in case it helps.

(dev) journals/2022W50 % conda create -n oretest python=3.8
Collecting package metadata (current_repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.13.0
  latest version: 23.5.0

Please update conda by running

    $ conda update -n base conda



## Package Plan ##

  environment location: /Users/jrowland/miniforge3/envs/oretest

  added / updated specs:
    - python=3.8


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    libsqlite-3.42.0           |       hb31c410_0         804 KB  conda-forge
    libzlib-1.2.13             |       h53f4e23_5          47 KB  conda-forge
    ncurses-6.4                |       h7ea286d_0         780 KB  conda-forge
    pip-23.1.2                 |     pyhd8ed1ab_0         1.3 MB  conda-forge
    python-3.8.17              |h3ba56d0_0_cpython        13.1 MB  conda-forge
    readline-8.2               |       h92ec313_1         244 KB  conda-forge
    setuptools-68.0.0          |     pyhd8ed1ab_0         453 KB  conda-forge
    wheel-0.40.0               |     pyhd8ed1ab_0          54 KB  conda-forge
    xz-5.2.6                   |       h57fd34a_0         230 KB  conda-forge
    ------------------------------------------------------------
                                           Total:        17.0 MB

The following NEW packages will be INSTALLED:

  bzip2              conda-forge/osx-arm64::bzip2-1.0.8-h3422bc3_4
  ca-certificates    conda-forge/osx-arm64::ca-certificates-2023.5.7-hf0a4a13_0
  libffi             conda-forge/osx-arm64::libffi-3.4.2-h3422bc3_5
  libsqlite          conda-forge/osx-arm64::libsqlite-3.42.0-hb31c410_0
  libzlib            conda-forge/osx-arm64::libzlib-1.2.13-h53f4e23_5
  ncurses            conda-forge/osx-arm64::ncurses-6.4-h7ea286d_0
  openssl            conda-forge/osx-arm64::openssl-3.1.1-h53f4e23_1
  pip                conda-forge/noarch::pip-23.1.2-pyhd8ed1ab_0
  python             conda-forge/osx-arm64::python-3.8.17-h3ba56d0_0_cpython
  readline           conda-forge/osx-arm64::readline-8.2-h92ec313_1
  setuptools         conda-forge/noarch::setuptools-68.0.0-pyhd8ed1ab_0
  tk                 conda-forge/osx-arm64::tk-8.6.12-he1e0b03_0
  wheel              conda-forge/noarch::wheel-0.40.0-pyhd8ed1ab_0
  xz                 conda-forge/osx-arm64::xz-5.2.6-h57fd34a_0


Proceed ([y]/n)? y


Downloading and Extracting Packages
python-3.8.17        | 13.1 MB   | ######################################################################################################################################################################### | 100% 
pip-23.1.2           | 1.3 MB    | ######################################################################################################################################################################### | 100% 
libzlib-1.2.13       | 47 KB     | ######################################################################################################################################################################### | 100% 
wheel-0.40.0         | 54 KB     | ######################################################################################################################################################################### | 100% 
xz-5.2.6             | 230 KB    | ######################################################################################################################################################################### | 100% 
libsqlite-3.42.0     | 804 KB    | ######################################################################################################################################################################### | 100% 
readline-8.2         | 244 KB    | ######################################################################################################################################################################### | 100% 
setuptools-68.0.0    | 453 KB    | ######################################################################################################################################################################### | 100% 
ncurses-6.4          | 780 KB    | ######################################################################################################################################################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate oretest
#
# To deactivate an active environment, use
#
#     $ conda deactivate

(dev) journals/2022W50 % conda activate oretest
(oretest) journals/2022W50 % conda install -c conda-forge orekit==11.3.2
Collecting package metadata (current_repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.13.0
  latest version: 23.5.0

Please update conda by running

    $ conda update -n base conda



## Package Plan ##

  environment location: /Users/jrowland/miniforge3/envs/oretest

  added / updated specs:
    - orekit==11.3.2


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    orekit-11.3.2              |   py38he333c0f_2        39.1 MB  conda-forge
    python_abi-3.8             |           3_cp38           6 KB  conda-forge
    ------------------------------------------------------------
                                           Total:        39.1 MB

The following NEW packages will be INSTALLED:

  libcxx             conda-forge/osx-arm64::libcxx-16.0.6-h4653b0c_0
  openjdk            conda-forge/osx-arm64::openjdk-8.0.332-he4db4b2_0
  orekit             conda-forge/osx-arm64::orekit-11.3.2-py38he333c0f_2
  python_abi         conda-forge/osx-arm64::python_abi-3.8-3_cp38


Proceed ([y]/n)? y


Downloading and Extracting Packages
python_abi-3.8       | 6 KB      | ######################################################################################################################################################################### | 100% 
orekit-11.3.2        | 39.1 MB   | ######################################################################################################################################################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(oretest) journals/2022W50 % pyThon
Python 3.8.17 | packaged by conda-forge | (default, Jun 16 2023, 07:11:32) 
[Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import orekit
zsh: killed     pyThon
(oretest) journals/2022W50 % python
Python 3.8.17 | packaged by conda-forge | (default, Jun 16 2023, 07:11:32) 
[Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import orekit
zsh: killed     python

some system info

(oretest) journals/2022W50 % system_profiler SPSoftwareDataType SPHardwareDataType
Software:

    System Software Overview:

      System Version: macOS 12.5.1 (21G83)
      Kernel Version: Darwin 21.6.0
      Boot Volume: Macintosh HD
      Boot Mode: Normal
      Secure Virtual Memory: Enabled
      System Integrity Protection: Enabled
      Time since boot: 12 days 17:18

Hardware:

    Hardware Overview:

      Model Name: MacBook Pro
      Model Identifier: MacBookPro18,3
      Chip: Apple M1 Pro
      Total Number of Cores: 10 (8 performance and 2 efficiency)
      Memory: 16 GB
      System Firmware Version: 7459.141.1
      OS Loader Version: 7459.141.1
      Activation Lock Status: Enabled

(oretest) journals/2022W50 % conda env export
name: oretest
channels:
  - conda-forge
dependencies:
  - bzip2=1.0.8=h3422bc3_4
  - ca-certificates=2023.5.7=hf0a4a13_0
  - libcxx=16.0.6=h4653b0c_0
  - libffi=3.4.2=h3422bc3_5
  - libsqlite=3.42.0=hb31c410_0
  - libzlib=1.2.13=h53f4e23_5
  - ncurses=6.4=h7ea286d_0
  - openjdk=8.0.332=he4db4b2_0
  - openssl=3.1.1=h53f4e23_1
  - pip=23.1.2=pyhd8ed1ab_0
  - python=3.8.17=h3ba56d0_0_cpython
  - python_abi=3.8=3_cp38
  - readline=8.2=h92ec313_1
  - setuptools=68.0.0=pyhd8ed1ab_0
  - tk=8.6.12=he1e0b03_0
  - wheel=0.40.0=pyhd8ed1ab_0
  - xz=5.2.6=h57fd34a_0
  - pip:
    - orekit==11.3.2
prefix: /Users/jrowland/miniforge3/envs/oretest

Thanks @rowland-208 for the report. Would be good to get more reports, if something could be tracked down. Did/could you try with a different python version? (all versions published should however have been tested in the automated tests)

Regards

It appears to be an issue with the jvm rather than orekit. Specifically openjdk=8.0.332. I can install openjdk=11 and javac executes without the os killing it. I’m trying to force operkit 11 and openjdk 11 at the moment. Also considering upgrading my OS.

(oretest) repos/leo-backend-od % sudo dmesg | grep -i python
[1117860.164103]: CODE SIGNING: cs_invalid_page(0x102c94000): p=80222[python3.9] final status 0x23000200, denying page sending SIGKILL
[1117860.164116]: CODE SIGNING: process 80222[python3.9]: rejecting invalid page at address 0x102c94000 from offset 0x0 in file "/Users/jrowland/miniforge3/envs/oretest/jre/lib/server/libjvm.dylib" (cs_mtime:1655621585.0 == mtime:1655621585.0) (signed:1 validated:1 tainted:1 nx:0 wpmapped:0 dirty:0 depth:0)
[1117863.655475]: CODE SIGNING: cs_invalid_page(0x100fb8000): p=80238[python3.9] final status 0x23000200, denying page sending SIGKILL
[1117863.655487]: CODE SIGNING: process 80238[python3.9]: rejecting invalid page at address 0x100fb8000 from offset 0x0 in file "/Users/jrowland/miniforge3/envs/oretest/jre/lib/server/libjvm.dylib" (cs_mtime:1655621585.0 == mtime:1655621585.0) (signed:1 validated:1 tainted:1 nx:0 wpmapped:0 dirty:0 depth:0)
(oretest) repos/leo-backend-od % javac
zsh: killed     javac

I have tried with python 3.8 and 3.9. I found a related thread in the openjdk issues.

Posting an update in case it helps others. I upgraded my OS and no luck. It failed on macOS 11 and 13 variants.

Edit: As a workaround I was able to downgrade openjdk. Orekit works with that version so far.
$ conda install openjdk=8.0.312 --no-deps

1 Like

I’m not sure this is the appropriate place to post this, but I’m having trouble getting the python wrapper to work completely on a MacBook Pro M2, MacOS 13.4 with Anaconda and python 3.8. For some very strange reason, it can’t seem to load the orekit-data (just downloaded an uncompressed a fresh version from the OREKIT site to make sure the formatting was right). The following code snippet fails at “earthframe =” with the dreaded “org.orekit.errors.OrekitException: no IERS UTC-TAI history data loaded”. Just to confirm, the tai-utc.dat file is in that directory.

import orekit
from java.io import File
from org.orekit.data import DataProvidersManager, DirectoryCrawler
from org.orekit.utils import IERSConventions
from org.orekit.frames import FramesFactory
datapath = 'orekit-data-master'
jccEnv = orekit.initVM(orekit.CLASSPATH, None, None, None, '')
datafile = File(datapath)
if not datafile.exists():
    print('File :', datafile.absolutePath, ' not found')
else:
    DM = DataProvidersManager()
    crawler = DirectoryCrawler(datafile)
    DM.clearProviders()
    DM.addProvider(crawler)
    print('Data Names: {0}'.format(DM.getLoadedDataNames()))
    earthframe = FramesFactory.getITRF(IERSConventions.IERS_2010, True)

This is with OREKIT 11.3.2, openjdk 8.0.332 (I tried 8.0.312 and it makes no difference), and python 3.8.17. Here is my system profile:

%system_profiler SPSoftwareDataType SPHardwareDataType
Software:

System Software Overview:

  System Version: macOS 13.4.1 (22F82)
  Kernel Version: Darwin 22.5.0
  Boot Volume: Macintosh HD
  Boot Mode: Normal
  Secure Virtual Memory: Enabled
  System Integrity Protection: Enabled
  Time since boot: 20 days, 5 hours, 34 minutes

Hardware:

Hardware Overview:

  Model Name: MacBook Pro
  Model Identifier: Mac14,10
  Model Number: MNW83LL/A
  Chip: Apple M2 Pro
  Total Number of Cores: 12 (8 performance and 4 efficiency)
  Memory: 16 GB
  System Firmware Version: 8422.121.1
  OS Loader Version: 8422.121.1
  Serial Number (system): CFF4Q19RHV
  Hardware UUID: BDA8543B-D6E0-54C0-A51A-EC81B7E044F6
  Provisioning UDID: 00006020-000A0891267B401E
  Activation Lock Status: Disabled

Any help would be appreciated!

Joe

Hi Joe,

Thanks for your report. Did you try using the supplied setup_orekit_curdir and use the zip from orekit, you can see how in some of the examples in Orekit Labs / Orekit Python Wrapper · GitLab ? Or maybe try your code and confirm it works on a x86 linux if you have access. Your setup code looks ok at a first glance but may be something, so please first try the default setup routine?

/Petrus

No! I didn’t know about that. I’m not new to OREKIT, but it’s been a while (OREKIT 7.1) since I last used it. So, I’m busy trying to port all my code over to the updated API. That was a detail I missed and now that is working just fine. Thank you! So, I can report it seems to be working on my M2 machine now.

Hi, orekit 11.3.3 is now released including rebuilt M1/M2 packages. As there is no way to perform automated M1/M2 tests today in the CI platform I would be thankful if some M1/M2 users could verify that the new ones are working…

It seems working for me (conda install -c conda-forge orekit==11.3.3)

MacBook Pro M2 (Ventura 13.4.1)

Hello.

I am on Mac M1 OS Ventura 13.5 and I am unable to import orekit after installation. I have tried all Python versions between 3.8 and 3.11. I have tried installing by specifying a version “conda install -c conda-forge orekit==11.3.3” and also not specifying a version “conda install -c conda-forge orekit”. I have also tried downgrading conda install openjdk=8.0.312 --no-deps but it won’t let me?
I consistently just get:
">>> import orekit
[1] 40643 killed python

Let me know if I can provide any more info that might be relevant!

`Software:

System Software Overview:

  System Version: macOS 13.5 (22G74)
  Kernel Version: Darwin 22.6.0
  Boot Volume: Macintosh HD
  Boot Mode: Normal
  Computer Name: Charles’s MacBook Pro
  Secure Virtual Memory: Enabled
  System Integrity Protection: Enabled
  Time since boot: 8 days, 23 hours, 51 minutes

Hardware:

Hardware Overview:

  Model Name: MacBook Pro
  Model Identifier: MacBookPro18,4
  Model Number: Z15H000D1B/A
  Chip: Apple M1 Max
  Total Number of Cores: 10 (8 performance and 2 efficiency)
  Memory: 32 GB
  System Firmware Version: 8422.141.2
  OS Loader Version: 8422.141.2
  Serial Number (system): C7QK3JGX3J
  Hardware UUID: 71D2586B-656F-51F6-AECD-FF6D48330DF5
  Provisioning UDID: 00006001-001410CE3445801E
  Activation Lock Status: Enabled

`

Thanks for any help!
Charles

Hi @charlesc
Thanks for your report. When you say that it doesn’t let you downgrade to openjdk 8.0.312 do you mean that it still don’t work or that conda is refusing you to downgrade? In the later case you can create a new conda environment

conda create -n orekitenv orekit openjdk=8.0.312

you may want to add some other pacakges as well that you are using.

Rgeards

Hi @petrus.hyvonen,

This worked when I made a new environment! Thanks.

conda create -n orekitenv orekit openjdk=8.0.312

But making my environment using a .yml file doesn’t. These are all the dependencies I am trying to use:

name: orekitenv

channels:
  - conda-forge
  - defaults

dependencies:
  - ipython=7.28
  - jupyter=1.0   
  - pip  
  - jplephem
  - wheel
  - requests
  - wget
  - python-dotenv
  - xlsxwriter
  - pandas
  - matplotlib
  - python
  - pyshtools
  - orekit
  - openjdk=8.0.321
  - scipy
  - pillow 
  - fftw
  - pip:
    - sp3
    - datetime
    - seaborn
    - astropy
    - poliastro
    - spacetrack
    - requests
    - tqdm
    - sgp4
    - matplotlib
    - python-dotenv
    - pandas
    - numba
    - numpy
    - pyatmos

conda env create -f orekit_env.yml

This is the output that I get:

Collecting package metadata (repodata.json): done
Solving environment: failed

ResolvePackageNotFound: 
  - openjdk=8.0.321

Further if I try to ask conda to find a suitable channel it can’t (eventhough it does manage to install somehow…)

conda search -c conda-forge openjdk=8.0.321
Loading channels: done
No match found for: openjdk=8.0.321. Search: *openjdk*=8.0.321

PackagesNotFoundError: The following packages are not available from current channels:

  - openjdk=8.0.321

Current channels:

  - https://conda.anaconda.org/conda-forge/osx-arm64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://repo.anaconda.com/pkgs/main/osx-arm64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/osx-arm64
  - https://repo.anaconda.com/pkgs/r/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

This makes me think that the issue is potentially with conda itself?

Hope that helps.
Charles

Hi, @charlesc

Yes this seems to be something with the conda and the dependencies there, suprising, it sounds like it “should work” :slight_smile:

What I can recommend to try is to keep exclusively to the conda-forge channes as these are built on a different pipeline and may have different compiler settings etc. (The anaconda repositories are also under some licensing terms that are not free for all.). There is a file .condarc (can be in some different locations) that selects which and which order of repos to use. See Tips & tricks — conda-forge 2023.08.17 documentation

Regards

1 Like