bertiniteam / b2

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

Issues running python tests: test_all.py #60

Closed davisbnag closed 7 years ago

davisbnag commented 7 years ago

I believe I have installed pybertini (got through make install without errors), but ran into some issues with test_all.py. As instructed I ran cd test && python test_all.py to run tests and got this error:

Traceback (most recent call last):
  File "test_all.py", line 29, in <module>
    import classes.test_classes
  File "/Users/brentdavis/Desktop/b2/python/test/classes/test_classes.py", line 29, in <module>
    import mpfr_test
  File "/Users/brentdavis/Desktop/b2/python/test/classes/mpfr_test.py", line 29, in <module>
    from pybertini import *
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/pybertini.so, 2): Symbol not found: __ZN5boost6python6detail13current_scopeE
  Referenced from: /usr/local/lib/python2.7/site-packages/pybertini.so
  Expected in: flat namespace
 in /usr/local/lib/python2.7/site-packages/pybertini.so

I've installed python version 2.7.12 using brew install python. After doing a some searching it looks like it may be connected to the boost-python library (which I didn't actually have install). I installed boost-python library using brew install boost-python, and remade and installed pybertini. I am getting the same error. I believe this may be related (but I don't know):

Mac OS X linking .so file to dynamic library

Any help would be appreciated. Thanks!

ofloveandhate commented 7 years ago

trying to replicate. building now.

ofloveandhate commented 7 years ago

Sadly, I was unable to immediately replicate this error on my machine. i was hoping it would, since i have not really done too much custom software installation on this one yet.

i am surprised you were able to build without installing boost-python from brew... so that's a little fishy. i need to think on this one...

ofloveandhate commented 7 years ago

what's the output from

otool -L /usr/local/lib/python2.7/site-packages/pybertini.so

?

mine is:

integral:python ofloveandhate$ otool -L /usr/local/lib/python2.7/site-packages/pybertini.so
/usr/local/lib/python2.7/site-packages/pybertini.so:
    /usr/local/opt/boost-python/lib/libboost_python.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/lib/libbertini2.0.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/local/opt/boost/lib/libboost_serialization-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/opt/boost/lib/libboost_system.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/opt/boost/lib/libboost_filesystem.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/opt/boost/lib/libboost_chrono-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/opt/boost/lib/libboost_regex-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/opt/boost/lib/libboost_thread-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/opt/boost/lib/libboost_timer-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/opt/boost/lib/libboost_log-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/opt/boost/lib/libboost_log_setup-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/opt/mpfr/lib/libmpfr.4.dylib (compatibility version 6.0.0, current version 6.4.0)
    /usr/local/opt/gmp/lib/libgmp.10.dylib (compatibility version 14.0.0, current version 14.1.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)

followup: this SO post appears to describe why this is the case?

davisbnag commented 7 years ago

This is what I have:

Necrabak:classes brentdavis$ otool -L /usr/local/lib/python2.7/site-packages/pybertini.so
/usr/local/lib/python2.7/site-packages/pybertini.so:
    /usr/local/lib/libbertini2.0.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/local/opt/boost/lib/libboost_serialization-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/opt/boost/lib/libboost_system.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/opt/boost/lib/libboost_filesystem.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/opt/boost/lib/libboost_chrono-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/opt/boost/lib/libboost_regex-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/opt/boost/lib/libboost_thread-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/opt/boost/lib/libboost_timer-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/opt/boost/lib/libboost_log-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/opt/boost/lib/libboost_log_setup-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/opt/mpfr/lib/libmpfr.4.dylib (compatibility version 6.0.0, current version 6.5.0)
    /usr/local/opt/gmp/lib/libgmp.10.dylib (compatibility version 14.0.0, current version 14.1.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 307.4.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)
davisbnag commented 7 years ago

From my naive understanding, should we be linking to /usr/local/opt instead of /usr/local/lib?

ofloveandhate commented 7 years ago

i don't think we really care about the locations. we care that they are linked at all. for some reason, you're missing the link to libboost-python -- it's not in the output from your run of otool. try reconfiguring, and remaking. hopefully it picks up the link. you might have to force it to remake, by rm pybertini.la from b2/python.

davisbnag commented 7 years ago

I removed b2: rm -r b2 then completely reinstalled b2 and pybertini up to make install. My output for otool -L /usr/local/lib/python2.7/site-packages/pybertini.so now includes:

/usr/local/opt/boost-python/lib/libboost_python.dylib (compatibility version 0.0.0, current version 0.0.0)

among all the other stuff...Good sign! I then reran the python tests: python test_all.py and got the error:

Necrabak:test brentdavis$ python test_all.py
Traceback (most recent call last):
  File "test_all.py", line 29, in <module>
    import classes.test_classes
  File "/Users/brentdavis/Desktop/b2/python/test/classes/test_classes.py", line 30, in <module>
    import function_tree_test
  File "/Users/brentdavis/Desktop/b2/python/test/classes/function_tree_test.py", line 33, in <module>
    import numpy as np;
ImportError: No module named numpy

I then ran the command brew install homebrew/python/numpy successfully to include numpy with python. After runrunning python test_all.py it appears that all tests have passed. Sweet!

I'm not sure what the issue was? Maybe it was the order of operations of obtaining the boost-python library, configuring, and making. I didn't force the remake, but I have a feeling that would of worked....