OSKAR icon indicating copy to clipboard operation
OSKAR copied to clipboard

RuntimeError("OSKAR library not found.")

Open SimonP2207 opened this issue 3 years ago • 3 comments

Hi,

First of all, my system is a MacBook Pro (16-inch, 2021) with Apple M1 Pro, running macOS Monterey v12.1. Python version 3.8.9. I've followed all installation instructions found here (OSKAR was installed using its .dmg), including assigning relevant library paths from the installed App to the OSKAR_INC_DIR and OSKAR_LIB_DIR environmental variables (located within the /Applications/OSKAR.app/Contents/Resources directory).

Currently, I'm trying to use python bindings for the OSKAR library. Unfortunately I run in to the following issue:

simon@macbook:~ % python3 -c "import oskar;oskar.SettingsTree('oskar_sim_beam_pattern')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "~/Library/Python/3.8/lib/python/site-packages/oskar/settings_tree.py", line 138, in __init__
    raise RuntimeError("OSKAR library not found.")
RuntimeError: OSKAR library not found.

Looking at settings_tree.py, this error is raised if _settings_lib is None. Controlling this are the following import statements within a try/except block (lines 33-38 of settings_tree.py):

try:
    from . import _settings_lib
    from . import _apps_lib
except ImportError:
    _settings_lib = None
    _apps_lib = None

So, to investigate further, I looked at manually importing _settings_lib after changing my working directory to ~/Library/Python/3.8/lib/python/site-packages/oskar/, resulting in the following terminal output:

simon@macbook:oskar % python3 -c "import _settings_lib" 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: dlopen(~/Library/Python/3.8/lib/python/site-packages/oskar/_settings_lib.cpython-38-darwin.so, 0x0002): symbol not found in flat namespace '__ZN5oskar12SettingsTree4freeEPS0_'

Looking at the ImportError that was raised, I found the following question on StackOverflow, the accepted answer for which states:

"...The problem was caused by mixing objects that compiled with libc++ and object that compiled with libstdc++."

Any ideas what my next steps should be? Thanks in advance!

SimonP2207 avatar Jan 24 '22 16:01 SimonP2207