Hi All, Hope this is the right forum.
I am working on using Numpy from the programming language Racket. My plan of attack is to use Python via `libpython`. That is, from Racket I use `ffilib` to load `libpython` and from there I use the C API to control Python. Here is what works at the moment: 1. From Racket I can load `libpython` via `ffilib`. 2. It is possible to initialize a Python process and run Python programs in it. 3. It is possible to import modules written in Python. What doesn't work is importing `numpy`. The error I get when I run `import numpy` is: ImportError: dlopen(/usr/local/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_PyBaseObject_Type' Right now, I am trying to figure out where things went wrong. First I checked that Numpy works in the terminal (it did): soegaard@mbp2 ~ % /usr/local/Cellar/python@3.10/3.10.4/Frameworks/Python.framework/Versions/3.10/bin/python3.10 Python 3.10.4 (main, Apr 26 2022, 19:42:59) [Clang 13.1.6 (clang-1316.0.21.2)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import numpy >>> numpy.array([[1, 2, 3], [4, 5, 6]], numpy.int32) array([[1, 2, 3], [4, 5, 6]], dtype=int32) I notice that Python is built with `clang`. Is this okay? I ask, partly because there is a cryptic note on GCC in the Numpy installation guide and partly because I have seen posts where static link problems where due to mixing gcc and clang binaries. I installed `python3.10` on my Intel mac using HomeBrew. Then I installed `numpy` using `pip`. Since XCode terminal commands are installed the system `gcc` actually invokes `clang`. In order to check that the paths are as expected, I made the embedded Python instance print out the paths before issuing the command `import numpy`: (ProgramName /usr/local/Cellar/python@3.10/3.10.4/Frameworks/Python.framework/Versions/3.10/bin/python3.10) (Prefix /usr/local/Cellar/python@3.10/3.10.4/Frameworks/Python.framework/Versions/3.10) (ExecPrefix /usr/local/Cellar/python@3.10/3.10.4/Frameworks/Python.framework/Versions/3.10) (ProgramFullPath /usr/local/Cellar/python@3.10/3.10.4/Frameworks/Python.framework/Versions/3.10/bin/python3.10) (Path /usr/local/Cellar/python@3.10/3.10.4/Frameworks/Python.framework/Versions/3.10/lib/python310.zip:/usr/local/Cellar/python@3.10/3.10.4/Frameworks/Python.framework/Versions/3.10/lib/python3.10:/usr/local/Cellar/python@3.10/3.10.4/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload) (PythonHome #f) The full error message was: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/numpy/core/__init__.py", line 23, in <module> from . import multiarray File "/usr/local/lib/python3.10/site-packages/numpy/core/multiarray.py", line 10, in <module> from . import overrides File "/usr/local/lib/python3.10/site-packages/numpy/core/overrides.py", line 6, in <module> from numpy.core._multiarray_umath import ( ImportError: dlopen(/usr/local/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_PyBaseObject_Type' Any help is appreciated. -- Jens Axel Søgaard _______________________________________________ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-le...@python.org https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ Member address: arch...@mail-archive.com