b2 icon indicating copy to clipboard operation
b2 copied to clipboard

Import pybertini in python got RuntimeError: unidentifiable C++ exception

Open SeffyVon opened this issue 2 years ago • 1 comments

Hi, I am using Mac Montery OS with M1 Max Chip, and homebrew to install all the dependencies.

  • mpfr: 4.2.0-p12
  • gmp: 6.2.1_1
  • boost: 1.82.0_1
  • eigen: 3.4.0_1
  • boost-python3: 1.82.0
  • python3: 3.11.6
  1. I configured b2/core and make-installed the core to /usr/local/ using the following command, with only 9 PASS and 1 FAIL (b2_class_test).
./configure CPPFLAGS="-I/opt/homebrew/include -DBOOST_PHOENIX_STL_TUPLE_H_" LDFLAGS="-L/opt/homebrew/lib" --with-eigen="/opt/homebrew/Cellar/eigen/3.4.0_1/include/eigen3/" 
  1. I then configured b2/python using
./configure CPPFLAGS="-I/opt/homebrew/include -DBOOST_PHOENIX_STL_TUPLE_H_" LDFLAGS="-L/opt/homebrew/lib" --with-eigen="/opt/homebrew/Cellar/eigen/3.4.0_1/include/eigen3/"  --with-eigenpy="/opt/homebrew/lib/python3.11/site-packages/cmeel.prefix"  --with-boost-python="/opt/homebrew/Cellar/boost-python3/1.82.0/"

command, then make-installed.

  1. pip3 install --upgrade .

  2. I ran python3 and import pybertini, but I got the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/homebrew/lib/python3.11/site-packages/pybertini/__init__.py", line 53, in <module>
    import pybertini.function_tree as function_tree
  File "/opt/homebrew/lib/python3.11/site-packages/pybertini/function_tree/__init__.py", line 31, in <module>
    import _pybertini
ModuleNotFoundError: No module named '_pybertini'

I think this is because the _pybertini.so was installed in /usr/local/lib/python3.11/site-packages, outside the PYTHONPATH, so I added export PYTHONPATH=/usr/local/lib/python3.11/site-packages:$PYTHONPATH.

  1. Again, I ran python3 and import pybertini. This time another error appeared:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/homebrew/lib/python3.11/site-packages/pybertini/__init__.py", line 53, in <module>
    import pybertini.function_tree as function_tree
  File "/opt/homebrew/lib/python3.11/site-packages/pybertini/function_tree/__init__.py", line 31, in <module>
    import _pybertini
RuntimeError: unidentifiable C++ exception

I attached config.log under b2/python. Please help, thank you!

SeffyVon avatar Oct 18 '23 15:10 SeffyVon

Your setup seems spot-on, through adding the location of the .so library to PYTHONPATH.

  • I expect that failing test in b2_class_test due to a bug in Boost 1.82 (I think it's fixed in 1.83?).

I'm curious about what exception got generated. I'll try to take a look. It might be as simple as bringing my most recent changes from my fork to the "official" repo (this one).

ofloveandhate avatar Oct 18 '23 18:10 ofloveandhate