mrkn / pycall.rb

Calling Python functions from the Ruby language
MIT License
1.05k stars 72 forks source link

Unable to find required symbol in libpython when using a conda env #170

Open hkf opened 1 year ago

hkf commented 1 year ago

Looking at some code that used to work in earlier versions of conda and/or python, I get the error in the title using the test command that appears in the README. Thank you in advance for any direction!

PYCALL_DEBUG_FIND_LIBPYTHON=1 ruby -rpycall -ePyCall.builtins        1 cruby!?
DEBUG(find_libpython) find_libpython(nil)
DEBUG(find_libpython) investigate_python_config("python3")
DEBUG(find_libpython) Candidate: 
DEBUG(find_libpython) Not found.
DEBUG(find_libpython) libpaths: ["/Users/harold.figueroa/opt/anaconda3/envs/conda_env/lib/python3.11/config-3.11-darwin", "/Users/harold.figueroa/opt/anaconda3/envs/conda_env/lib", "/Users/harold.figueroa/opt/anaconda3/envs/conda_env"]
DEBUG(find_libpython) candidate_names: ["libpython3.11.a", "libpython3.11.so", "libpython.so"]
DEBUG(find_libpython) Candidate: /Users/harold.figueroa/opt/anaconda3/envs/conda_env/lib/python3.11/config-3.11-darwin/libpython3.11.a
DEBUG(find_libpython) Not found.
DEBUG(find_libpython) Candidate: /Users/harold.figueroa/opt/anaconda3/envs/conda_env/lib/python3.11/config-3.11-darwin/libpython3.11.so
DEBUG(find_libpython) Not found.
DEBUG(find_libpython) Candidate: /Users/harold.figueroa/opt/anaconda3/envs/conda_env/lib/python3.11/config-3.11-darwin/libpython.so
DEBUG(find_libpython) Not found.
DEBUG(find_libpython) Candidate: /Users/harold.figueroa/opt/anaconda3/envs/conda_env/lib/libpython3.11.a
DEBUG(find_libpython) Not found.
DEBUG(find_libpython) Candidate: /Users/harold.figueroa/opt/anaconda3/envs/conda_env/lib/libpython3.11.so
DEBUG(find_libpython) Not found.
DEBUG(find_libpython) Candidate: /Users/harold.figueroa/opt/anaconda3/envs/conda_env/lib/libpython.so
DEBUG(find_libpython) Not found.
DEBUG(find_libpython) Candidate: /Users/harold.figueroa/opt/anaconda3/envs/conda_env/libpython3.11.a
DEBUG(find_libpython) Not found.
DEBUG(find_libpython) Candidate: /Users/harold.figueroa/opt/anaconda3/envs/conda_env/libpython3.11.so
DEBUG(find_libpython) Not found.
DEBUG(find_libpython) Candidate: /Users/harold.figueroa/opt/anaconda3/envs/conda_env/libpython.so
DEBUG(find_libpython) Not found.
DEBUG(find_libpython) Candidate: libpython3.11.a
DEBUG(find_libpython) Not found.
DEBUG(find_libpython) Candidate: libpython3.11.so
DEBUG(find_libpython) Not found.
DEBUG(find_libpython) Candidate: libpython.so
DEBUG(find_libpython) Not found.
Traceback (most recent call last):
    5: from -e:1:in `<main>'
    4: from /Users/harold.figueroa/.rvm/gems/ruby-2.7.5/gems/pycall-1.4.2/lib/pycall.rb:14:in `builtins'
    3: from /Users/harold.figueroa/.rvm/gems/ruby-2.7.5/gems/pycall-1.4.2/lib/pycall/init.rb:16:in `const_missing'
    2: from /Users/harold.figueroa/.rvm/gems/ruby-2.7.5/gems/pycall-1.4.2/lib/pycall/init.rb:39:in `init'
    1: from /Users/harold.figueroa/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
/Users/harold.figueroa/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require': Unable to find the required symbol in libpython: _Py_NoneStruct (PyCall::LibPythonFunctionNotFound)
piclez commented 9 months ago

I'm having the exact same issue reported by @hkf.