Closed eoswald closed 4 years ago
Agree this is legitimate; it should have loaded the library. I wonder if there is some linkage issue when it attempts to load the library.
What is the return value of:
(tech.jna/load-library "C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll")
That throws the same exception:
Exception in thread "main" Syntax error compiling at (C:\Users\eoswald\AppData\Local\Temp\form-init6781053897180991248.clj:1:116).
Failed to load library
at clojure.lang.Compiler.load(Compiler.java:7647)
at clojure.lang.Compiler.loadFile(Compiler.java:7573)
at clojure.main$load_script.invokeStatic(main.clj:452)
at clojure.main$init_opt.invokeStatic(main.clj:454)
at clojure.main$init_opt.invoke(main.clj:454)
at clojure.main$initialize.invokeStatic(main.clj:485)
at clojure.main$null_opt.invokeStatic(main.clj:519)
at clojure.main$null_opt.invoke(main.clj:516)
at clojure.main$main.invokeStatic(main.clj:598)
at clojure.main$main.doInvoke(main.clj:561)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.Var.applyTo(Var.java:705)
at clojure.main.main(main.java:37)
Caused by: clojure.lang.ExceptionInfo: Failed to load library {:libname "C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll", :paths [[:system ["C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll"]] [:java-library-path ["C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\jdk-13.0.2\\bin;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\WINDOWS\\Sun\\Java\\bin;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\WINDOWS\\system32;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\WINDOWS;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\Windows\\system32;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\Windows;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\Windows\\System32\\Wbem;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\Program Files (x86)\\Git\\cmd;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\WINDOWS\\system32;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\WINDOWS;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\WINDOWS\\System32\\Wbem;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;D\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\Program Files\\PuTTY\\;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\WINDOWS\\System32\\OpenSSH\\;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\Program Files\\NVIDIA Corporation\\NVIDIA NvDLISR;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\WINDOWS\\system32;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\WINDOWS;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\WINDOWS\\System32\\Wbem;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\WINDOWS\\System32\\OpenSSH\\;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\Users\\eoswald\\AppData\\Roaming\\nvm;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\Program Files\\nodejs;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\php;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\jdk-13.0.2\\bin;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\bin;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\Users\\eoswald\\AppData\\Local\\Microsoft\\WindowsApps;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\Hugo\\bin;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\Users\\eoswald\\AppData\\Local\\Microsoft\\WindowsApps;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\Users\\eoswald\\AppData\\Local\\atom\\bin;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\Users\\eoswald\\AppData\\Roaming\\nvm;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\Program Files\\nodejs;C\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll" "\\Users\\eoswald\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;;.\\C:\\Users\\eoswald\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.dll"]]]}
at tech.jna.base$do_load_library.invokeStatic(base.clj:158)
at tech.jna.base$do_load_library.invoke(base.clj:123)
at tech.jna.base$load_library.invokeStatic(base.clj:178)
at tech.jna.base$load_library.invoke(base.clj:174)
at tech.jna$load_library.invokeStatic(jna.clj:87)
at tech.jna$load_library.invoke(jna.clj:85)
at libpython_test.core$_main.invokeStatic(core.clj:6)
at libpython_test.core$_main.doInvoke(core.clj:4)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.Var.invoke(Var.java:380)
at user$eval140.invokeStatic(form-init6781053897180991248.clj:1)
at user$eval140.invoke(form-init6781053897180991248.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:7176)
at clojure.lang.Compiler.eval(Compiler.java:7166)
at clojure.lang.Compiler.load(Compiler.java:7635)
... 12 more
What happens if you load the dll with dependency walker?
Basically the loadlibrary call has to work. And it is pretty low level. I was hoping for more information in the exception like exactly why the library isn't loading.
I was able to crash dependency walker and found my issue: I accidentally installed a 32-bit version of Python. Installing a 64-bit version worked. I tried re-installing a 32-bit version and was able to reproduce this issue with Python 3.7 and Python 3.8.
Awesome, glad I could help :-).
I'm on Windows 10 and it seems like it's failing to find the provided python library path when the DLL clearly exists.
project.clj:
core.clj:
Output: