Closed cocodrino closed 3 years ago
Just to confirm, this is macos, right?
May be one of the following might help:
https://github.com/clj-python/libpython-clj/issues/121#issuecomment-691958024 -- use of :library-path
with py/initialize!
.
https://github.com/clj-python/libpython-clj/issues/2#issuecomment-687547272 -- use of PYTHONHOME
and/or PYTHONPATH
(It might be that the virtualenv portion is not necessary, so it might be worth not doing those bits in any initial attempts.)
Haven't tested either on macos though.
@sogaiu thank you, :library-path
did the trick, would be great if that info could be included in the readme, also notice that python 3.8.1 doesn't work, I get an error when I try to initialize...
thank you so much!
Is pyenv active in the shell that you launched your cursive repl in? Could the pyenv shell state be an part of the issue?
@cocodrino Along the lines (I think) of what @cnuernber said, if you launch Cursive from a terminal where pyenv is already appropriately activated, it may be that things will "just work".
I think if one launches an application from the Dock it may not have the same set of environment variables set as that of your pyenv environment.
Encountered a same problem with python 3.8.5, should I downgrade to python 3.7?
(ns my-py-clj.config
(:require [libpython-clj.python :as py]))
;; When you use conda, it should look like this.
(py/initialize! :python-executable "./venv/bin/python"
:library-path "./venv/lib/libpython3.8m.dylib")
my-py-clj.config=> (py/initialize! :python-executable "./venv/bin/python"
#_=> :library-path "./venv/lib/libpython3.8m.dylib")
Oct 18, 2020 3:33:09 PM clojure.tools.logging$eval1985$fn__1988 invoke
INFO: Executing python initialize with options:{:python-executable "./venv/bin/python", :program-name nil, :python-home nil, :library-path "./venv/lib/libpython3.8m.dylib"}
Oct 18, 2020 3:33:09 PM clojure.tools.logging$eval1985$fn__1988 invoke
INFO: Detecting startup-info for Python executable: ./venv/bin/python
Oct 18, 2020 3:33:09 PM clojure.tools.logging$eval1985$fn__1988 invoke
INFO: Startup info detected:
{:lib-version "3.8",
:java-library-path-addendum
"/Users/Shared/Relocated_Items/Security/eUSB/sync/clojure/projects/libpython-clj-play/venv/lib",
:exec-prefix
"/Users/Shared/Relocated_Items/Security/eUSB/sync/clojure/projects/libpython-clj-play/venv",
:executable
"/Users/Shared/Relocated_Items/Security/eUSB/sync/clojure/projects/libpython-clj-play/venv/bin/python",
:libnames ("./venv/lib/libpython3.8m.dylib" "python3.8"),
:prefix
"/Users/Shared/Relocated_Items/Security/eUSB/sync/clojure/projects/libpython-clj-play/venv",
:base-prefix
"/usr/local/opt/python@3.8/bin/../Frameworks/Python.framework/Versions/3.8",
:base-exec-prefix
"/usr/local/opt/python@3.8/bin/../Frameworks/Python.framework/Versions/3.8",
:python-home
"/Users/Shared/Relocated_Items/Security/eUSB/sync/clojure/projects/libpython-clj-play/venv",
:version [3 8 5],
:platform "darwin"}
Oct 18, 2020 3:33:09 PM clojure.tools.logging$eval1985$fn__1988 invoke
INFO: Trying python library names ["./venv/lib/libpython3.8m.dylib" "./venv/lib/libpython3.8m.dylib" "python3.8" "python3.7m" "python3.6m"]
Oct 18, 2020 3:33:09 PM clojure.tools.logging$eval1985$fn__1988 invoke
INFO: Setting java library path: /Users/Shared/Relocated_Items/Security/eUSB/sync/clojure/projects/libpython-clj-play/venv/lib:/Users/nelson/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
Oct 18, 2020 3:33:09 PM clojure.tools.logging$eval1985$fn__1988 invoke
INFO: Reference thread starting
Execution error (ExceptionInfo) at tech.jna.base/do-load-library (base.clj:158).
Failed to load library
@Algorimatica I had success with the pyenv + pyenv-virtualenv (via homebrew) combination on macos with python 3.8.6 using @cnuernber's find of: https://github.com/pyenv/pyenv/wiki#how-to-build-cpython-with-framework-support-on-os-x
I adapted the instructions from here: https://github.com/clj-python/libpython-clj/issues/2#issuecomment-687547272
Apart from adapting the specific paths and python modules to install, the main differences were:
pyenv install 3.8.5
-> env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.8.6
(step 1)IIUC, It looks like you are using macos and venv, is that correct?
The following issue had some discussion that mentioned those two: https://github.com/clj-python/libpython-clj/issues/70 -- though I am not sure whether that combination (venv + macos + libpython-clj) has worked out so well for folks.
Hi good day, I'm having some troubles trying to test libpython-clj, I'm not sure if I'm following the right steps
I found this related issue https://github.com/clj-python/libpython-clj/issues/61, so I installed python with the enable framework parameter activated: 1) env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.6.9 2) I downloaded an installed libpython-clj using lein install 3) I run this code in the repl (cursive)
this is the output
notice how the python version differ, I don't know why it's taking another python version
I run
I also try
I always get the same output
do you know what I'm doing wrong?
thank you so much...
Best regards