bertiniteam / b2

Bertini 2.0: The redevelopment of Bertini in C++.
88 stars 34 forks source link

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

Open SeffyVon opened 9 months ago

SeffyVon commented 9 months ago

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

  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/" 
  2. 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.

  3. pip3 install --upgrade .

  4. 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.

  5. 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!

ofloveandhate commented 9 months ago

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

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).