clj-python / libpython-clj

Python bindings for Clojure
Eclipse Public License 2.0
1.05k stars 68 forks source link

Issues with using libpython-clj with pyenv installed python version #193

Closed bajrachar closed 9 months ago

bajrachar commented 2 years ago

OS: Arch 5.15.11-arch2-1 Libpython-clj 2.006 pyenv 2.2.3

I get a "Failed to find a valid python library!" when using a python library version set as global using pyenv [which is a different version from the system installed one]. It works fine when global is set to the system installed version.

Digging further into libpython-clj code, I found that it is actually trying to find the libpython.so file and the pyenv installed version only installs a libpython.a file.

It worked for me by forcing pyenv to generate a .so file --> $ env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.7.5

jjtolton commented 2 years ago

That’s great. I can’t tell you how many times this has gotten me. Glad to finally see the proper installation pathway!

On Thu, Dec 30, 2021 at 10:34 PM bajrachar @.***> wrote:

OS: Arch 5.15.11-arch2-1 Libpython-clj 2.006

I get a "Failed to find a valid python library!" when using a python library version set as global using pyenv [which is a different version from the system installed one]. It works fine when global is set to the system installed version.

Digging further into libpython-clj code, I found that it is actually trying to find the libpython.so file and the pyenv installed version only installs a libpython.a file.

It worked for me by forcing pyenv to generate a .so file --> $ env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.7.5

— Reply to this email directly, view it on GitHub https://github.com/clj-python/libpython-clj/issues/193, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACPJX43OQ4U27KGRTRXTBW3UTUQEBANCNFSM5LAWMQZA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

thecontinium commented 2 years ago

FYI: For those on a Mac with pyenv this also works

e.g.

env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.10.2
❯ pyenv root
/Users/blah/.cache/pyenv
(py/initialize! :python-executable "/Users/blah/.cache/pyenv/versions/3.10.2/bin/python"
                :library-path "/Users/blah/.cache/pyenv/versions/3.10.2/lib/libpython3.10.dylib")
behrica commented 9 months ago

can be closed ?

cnuernber commented 9 months ago

Yes - can be reopened as I am sure we will hear more about this