scalapy-test:>python3-config --ldflags
-L/Users/brandons/.pyenv/versions/3.8.5/lib/python3.8/config-3.8-darwin -lintl -ldl -framework CoreFoundation
sbt:scalapy-test> run
[info] running (fork) Main
[error] Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'python3':
[error] dlopen(libpython3.dylib, 9): image not found
[error] dlopen(libpython3.dylib, 9): image not found
[error] Native library (darwin/libpython3.dylib) not found in resource path (TOO LONG)
[error] at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:302)
[error] at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:455)
[error] at com.sun.jna.Native.register(Native.java:1722)
[error] at com.sun.jna.Native.register(Native.java:1443)
[error] at me.shadaj.scalapy.interpreter.CPythonAPIInterface.$anonfun$new$2(CPythonAPI.scala:13)
[error] at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
[error] at scala.util.Try$.apply(Try.scala:210)
[error] at me.shadaj.scalapy.interpreter.CPythonAPIInterface.$anonfun$new$1(CPythonAPI.scala:13)
[error] at me.shadaj.scalapy.interpreter.CPythonAPIInterface.$anonfun$new$1$adapted(CPythonAPI.scala:13)
[error] at scala.collection.immutable.List.find(List.scala:413)
[error] at me.shadaj.scalapy.interpreter.CPythonAPIInterface.<init>(CPythonAPI.scala:13)
[error] at me.shadaj.scalapy.interpreter.CPythonAPI$.<init>(CPythonAPI.scala:95)
[error] at me.shadaj.scalapy.interpreter.CPythonAPI$.<clinit>(CPythonAPI.scala:95)
[error] at me.shadaj.scalapy.interpreter.CPythonInterpreter$.<clinit>(CPythonInterpreter.scala:9)
[error] at me.shadaj.scalapy.py.package$.<clinit>(package.scala:15)
[error] at Main$.main(Main.scala:13)
[error] at Main.main(Main.scala)
[error] Suppressed: java.lang.UnsatisfiedLinkError: dlopen(libpython3.dylib, 9): image not found
[error] at com.sun.jna.Native.open(Native Method)
[error] at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:191)
[error] ... 16 more
[error] Suppressed: java.lang.UnsatisfiedLinkError: dlopen(libpython3.dylib, 9): image not found
[error] at com.sun.jna.Native.open(Native Method)
[error] at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:204)
[error] ... 16 more
[error] Suppressed: java.io.IOException: Native library (darwin/libpython3.dylib) not found in resource path (TOO LONG)
[error] at com.sun.jna.Native.extractFromResourcePath(Native.java:1095)
[error] at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:276)
[error] ... 16 more
[error] Nonzero exit code returned from runner: 1
[error] (Compile / run) Nonzero exit code returned from runner: 1
[error] Total time: 1 s, completed Nov 24, 2020 2:04:42 PM
sbt:scalapy-test>
ThisBuild / scalaVersion := "2.13.3"
libraryDependencies += "me.shadaj" %% "scalapy-core" % "0.4.0"
fork := true
import scala.sys.process._
javaOptions += s"-Djava.library.path=${"python3-config --ldflags".!! + "/lib"}"
-Djna.library.path=/usr/local/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/lib
which is effectively -Djna.library.path=${"python3-config --prefix".!!.trim}/lib
SCALAPY_PYTHON_LIBRARY = python3.8
SCALAPY_PYTHON_LIBRARY=python3.6m
(replacing 3.6 with the appropriate Python version) to fix it for now
Hello all, the folowing snippet fails to compile:
import me.shadaj.scalapy.numpy.NumPy
import me.shadaj.scalapy.py
val np = py.module("numpy").as[NumPy]
could not find implicit value for evidence parameter of type me.shadaj.scalapy.readwrite.Reader[me.shadaj.scalapy.numpy.NumPy]
val np = py.module("numpy").as[NumPy]
Any hints?
py.module("numpy")
compiles despite missing implicit jep: Jep
, whereas implicitly[Jep]
fails to compile.
Hi! I was following the Getting Started https://scalapy.dev/docs/ instructions, but when I tried running the code example, I got:
[error] Exception in thread "main" java.lang.ExceptionInInitializerError
[error] at me.shadaj.scalapy.interpreter.CPythonInterpreter$.<clinit>(CPythonInterpreter.scala:9)
[error] at me.shadaj.scalapy.py.package$.<clinit>(package.scala:15)
[error] at Main$package$.hello(Main.scala:5)
[error] at hello.main(Main.scala:4)
[error] Caused by: java.lang.Exception: Unable to locate Python library, tried python3, python3.7, python3.7m
[error] at me.shadaj.scalapy.interpreter.CPythonAPIInterface.$anonfun$new$2(CPythonAPI.scala:19)
[error] at scala.Option.getOrElse(Option.scala:201)
[error] at me.shadaj.scalapy.interpreter.CPythonAPIInterface.<init>(CPythonAPI.scala:19)
[error] at me.shadaj.scalapy.interpreter.CPythonAPI$.<init>(CPythonAPI.scala:102)
[error] at me.shadaj.scalapy.interpreter.CPythonAPI$.<clinit>(CPythonAPI.scala:102)
[error] ... 4 more
Python was installed via homebrew, the OS is MacOS Catalina. The output of python3-config --configdir
is /usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/config-3.9-darwin
. When I run ls -1 $(python3-config --configdir)
, I get:
Makefile
Setup
Setup.local
config.c
config.c.in
install-sh
libpython3.9.a
libpython3.9.dylib
makesetup
python-config.py
python.o
So probably javaOptions += s"-Djava.library.path=${"python3-config --configdir".!!.trim}/lib"
in the SBT settings cannot locate lib
. How do I fix this?