clj-python / libpython-clj

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

Failed to find a valid python library on MS-Windows with the official python distributions #246

Closed ikappaki closed 12 months ago

ikappaki commented 12 months ago

libpython-clj can't find the python dll on MS-Windows:

Execution error at libpython-clj2.python/initialize! (python.clj:129).
Failed to find a valid python library!

Steps to reproduce.

  1. Download and install python 3.11 for MS-Windows from https://www.python.org/downloads/
  2. Create a deps.edn adding libpython-clj as a dep
    {:deps {clj-python/libpython-clj {:mvn/version "2.024"}}}
  3. Bring up the REPL
    > clojure
    Clojure 1.11.1
    user=> 
  4. Try to load libpython-clj, you should get the above error
    user=> (require 'libpython-clj2.require)
    clojure.tools.logging$eval667$fn__670 invoke
    INFO: Detecting startup info
    clojure.tools.logging$eval667$fn__670 invoke
    INFO: Startup info {:lib-version "3.11", :java-library-path-addendum "C:\\local\\Python311\\lib", :exec-prefix "C:\\local\\Python311", :executable "C:\\local\\Python311\\python.exe", :libnames ("python3.11m" "python3.11"), :prefix "C:\\local\\Python311", :base-prefix "C:\\local\\Python311", :libname "python3.11m", :base-exec-prefix "C:\\local\\Python311", :python-home "C:\\local\\Python311", :version [3 11 4], :platform "win32"}
    clojure.tools.logging$eval667$fn__670 invoke
    INFO: Prefixing java library path: C:\local\Python311\lib
    Execution error at libpython-clj2.python/initialize! (python.clj:129).
    Failed to find a valid python library!

This is because the python dll filename on the official distributions do not include a . between major and minor strings.

PR to follow.