Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError("OSKAR library not found.") #40

Open
SimonP2207 opened this issue Jan 24, 2022 · 3 comments
Open

RuntimeError("OSKAR library not found.") #40

SimonP2207 opened this issue Jan 24, 2022 · 3 comments

Comments

@SimonP2207
Copy link

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!

@fdulwich
Copy link
Contributor

Many thanks for the detailed report. The binary in the .dmg currently on GitHub was compiled for macOS 10.13, so it's possible there may be some incompatibility between that and the system libraries on the latest macOS version. Could you perhaps try the build from the CI pipeline instead? This was compiled for macOS 11.0, so there's a chance it may not have that problem: https://gitlab.com/ska-telescope/sim/oskar/-/jobs/1811865284/artifacts/browse/build-mac/

If that also fails then it may be necessary to try building from source. Let me know if it's any better or if there's still a problem.

@SimonP2207
Copy link
Author

Thanks for getting back to me.

Unfortunately, building with the .dmg compiled with macOS 11.0 still did not help and the problem repeated itself. I shall try my hand at building from source and post my results up here.

@NadiaSteyn
Copy link

Any update on this issue? I'm trying to run the hello-world.py example. I'm experiencing the same problem with pip install 'git+https://github.com/OxfordSKA/OSKAR.git@master#egg=oskarpy&subdirectory=python'
The file '_settings_lib.cpython-310-darwin.so' is not being imported.
I'm using macOS Monterey 12.5.1 (M1), and Python 3.10.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants