I am trying the juliacall package, installed in a conda environment, and julia fails to find the libgit2 dll on windows. The problem appears when trying to install JuMP.
In stdlib/LibGit2/src/LibGit2.jl
the problematic line seems to be @check ccall((:git_libgit2_init, :libgit2), Cint, ())
and I try to reproduce the problem below.
Giving it only the symbol :libgit2
, the following python code (using juliacall with the julia installation that it has installed itself inside my conda environment) fails to find the dll.
(iqc_test) PS C:\Users\johan\IQC_Test> python
Python 3.10.6 | packaged by conda-forge | (main, Oct 7 2022, 20:14:50) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from juliacall import Main as jl
>>> jl.seval("ccall((:git_libgit2_init, :libgit2), Cint, ())")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\johan\.julia\packages\PythonCall\eU0yr\src\jlwrap\module.jl", line 25, in seval
return self._jl_callmethod($(pyjl_methodnum(pyjlmodule_seval)), expr)
juliacall.JuliaError: could not load library "libgit2"
The specified module could not be found.
Stacktrace:
[1] top-level scope
@ .\none:1
[2] eval
@ .\boot.jl:368 [inlined]
[3] eval
@ .\Base.jl:65 [inlined]
[4] pyjlmodule_seval(self::Module, expr::PythonCall.Py)
@ PythonCall C:\Users\johan\.julia\packages\PythonCall\eU0yr\src\jlwrap\module.jl:13
[5] _pyjl_callmethod(f::Any, self_::Ptr{PythonCall.C.PyObject}, args_::Ptr{PythonCall.C.PyObject}, nargs::Int64)
@ PythonCall C:\Users\johan\.julia\packages\PythonCall\eU0yr\src\jlwrap\base.jl:62
[6] _pyjl_callmethod(o::Ptr{PythonCall.C.PyObject}, args::Ptr{PythonCall.C.PyObject})
@ PythonCall.C C:\Users\johan\.julia\packages\PythonCall\eU0yr\src\cpython\jlwrap.jl:47
but giving it the full path to the dll seems to work better
(iqc_test) PS C:\Users\johan\IQC_Test> python
Python 3.10.6 | packaged by conda-forge | (main, Oct 7 2022, 20:14:50) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from juliacall import Main as jl
>>> jl.seval('ccall((:git_libgit2_init, "C:/Users/johan/.conda/envs/iqc_test/julia_env/pyjuliapkg/install/bin/libgit2.dll"), Cint, ())')
1
I do not understand where julia should look for libgit2.dll
and how I could help it find it.