clj-python / libpython-clj

Python bindings for Clojure
Eclipse Public License 2.0
1.06k stars 69 forks source link

"Failed to find constructor f java.nio.DirectByteBuffer: $s", #136

Closed DegenApeDev closed 3 years ago

DegenApeDev commented 3 years ago

I'm trying to run the example and I am getting this.. I'm not sure what I am doing wrong.

:clojure.main/trace {:via [{:type clojure.lang.Compiler$CompilerException, :message "Syntax error compiling at (libpython_clj/metadata.clj:13:1).", :data {:clojure.error/phase :compile-syntax-check, :clojure.error/line 13, :clojure.error/column 1, :clojure.error/source "libpython_clj/metadata.clj"}, :at [clojure.lang.Compiler load "Compiler.java" 7648]} {:type java.lang.ExceptionInInitializerError, :at [tech.v3.datatype.native_buffer$unsafe invokeStatic "native_buffer.clj" 28]}

:cause "Failed to find constructor f java.nio.DirectByteBuffer: $s",

Python 3.8 on Arch

DegenApeDev commented 3 years ago

When I run 'lein run' from terminal:

INFO: Startup info detected: {:lib-version "3.8", :java-library-path-addendum "/usr/lib", :exec-prefix "/usr", :executable "/usr/bin/python3", :libnames ("python3.8m" "python3.8"), :prefix "/usr", :base-prefix "/usr", :base-exec-prefix "/usr", :python-home "/usr", :version [3 8 6], :platform "linux"}

Nov. 22, 2020 10:39:24 A.M. clojure.tools.logging$eval533$fn536 invoke INFO: Trying python library names ["python3.8m" "python3.8" "python3.7m" "python3.6m"] Nov. 22, 2020 10:39:24 A.M. clojure.tools.logging$eval533$fn536 invoke INFO: Reference thread starting Nov. 22, 2020 10:39:25 A.M. clojure.tools.logging$eval533$fn__536 invoke INFO: Library python3.8 found at [:system "python3.8"] Syntax error (IllegalStateException) compiling at (libpython_clj/metadata.clj:13:1). Failed to find constructor f java.nio.DirectByteBuffer: $s

cnuernber commented 3 years ago

I bet that has to do with your java version. They removed nio buffer constructors in JDK-14. What JDK version are you running?

This is fixable because jna also contains pointer->bytebuffer pathways that are compiled in via JNI.

DegenApeDev commented 3 years ago

Yep I am running 14.. What version would you recommend to run for this?

cnuernber commented 3 years ago

I have given guarantees to always work on Java 8 to quite a few people.

DegenApeDev commented 3 years ago

Ok thank you!