[SOLVED] OSError incompatible architecture

Hi everyone,

I am using a manually compiled version of openmc-0.13.3 to do some depletion tests. But when I import openmc.deplete, it throws me this error :

Traceback (most recent call last):
  File "/usr/pferney/PROJECTS/openmc_depletion/test_dep.py", line 4, in <module>
    import openmc.deplete
  File "/usr/pferney/openmc/openmc/deplete/__init__.py", line 11, in <module>
    from .coupled_operator import *
  File "/usr/pferney/openmc/openmc/deplete/coupled_operator.py", line 21, in <module>
    import openmc.lib
  File "/usr/pferney/openmc/openmc/lib/__init__.py", line 32, in <module>
    _dll = CDLL(_filename)
           ^^^^^^^^^^^^^^^
  File "/usr/pferney/anaconda3/lib/python3.11/ctypes/__init__.py", line 376, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: dlopen(/usr/pferney/openmc/openmc/lib/libopenmc.dylib, 0x0006): tried: '/usr/pferney/openmc/openmc/lib/libopenmc.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/usr/pferney/openmc/openmc/lib/libopenmc.dylib' (no such file), '/usr/pferney/openmc/openmc/lib/libopenmc.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))

I am on MacOS. I tried to uninstall and reinstall openmc python api using --no-cache option, and with arch -arm64 pip install. but it didn’t work, I still get the error.

Does someone has an idea ?

Paul

I think the conda install for openmc doesn’t currently support arm processor’s

As i don’t see the build_platform: osx_arm64: osx_64 comands in our conda meta.yml

You may have more luck with installing from source
https://docs.openmc.org/en/stable/quickinstall.html#installing-from-source-on-linux-or-mac-os-x

Yup, actually, this is a version installed from source '^^

I will try to install an other version to see if I get the same error.

EDIT : nope, it doesn’t work. I also tried to install all packages with a x86_64 architecture but get the make command line would fail everytime.

EDIT2 : I finally solved this problem by buldozing everything, uninstalling conda, openmc, removed everything and reinstalled conda and openmc from source the traditionnal way. Now, it works.

I have run into the same error, this post wasn’t very clear so I wanted to add in more detail how I fixed the problem. To my understanding, in order to install openmc using conda, you need to explicitly tell conda that you are emulating x86_64 architecture because the mamba version of openmc is not yet compatible with Apple arm64 chips. I had created such a conda environment in my post here. The drawbacks to installing in this way are that, on apple chips, you tend to get crazy segmentation fault errors when doing things like plotting geometries, and all of those errors told me to install from source, which I did. Once you install from source, your openmc executable will be compatible with arm64 and you then need to create a REGULAR conda environment before pip installing. Then it all seemed to work out. In conclusion, installing from source eliminates a ton of headache down the road.