Libpcre2-8-0.dll not found with pyjulia / proper way to use julia functions in Python

I have a Julia environnement called env and structured this way :

env/

├── Project.toml
├── Manifest.toml
├── folder/
│ └── funcs.jl
│ └── script.py
│ └── script.jl

My file funcs.jl is using packages installed in env, and I’m using pyjulia to retrieve functions from this file to be used in my python script.

In Python, I’m using :

import julia
j = julia.Julia()
j.eval('using Pkg')
j.eval('Pkg.activate("env")')
j.eval('include("folder/funcs.jl")

But I’m getting this error :

ImportError: <PyCall.jlwrap (in a Julia function called from Python)
JULIA: LoadError: InitError: could not load library "libpcre2-8-0.dll"
The specified module could not be found.

But I’m able to include the file in a Julia file…

  1. How to resolve it ?

The functions in funcs.jl are also used in script.jl.

  1. Is there a proper way to make funcs.jl be used by both my Python and Julia script ? I’ve found another solution : make a package, and use it both in the two scripts, but I wasn’t able to make it work…

This may be an issue with recent Python versions as pointed out in this GitHub issue: Julia is unable to launch in the Universal Windows Platform (UWP) · Issue #52007 · JuliaLang/julia · GitHub

The root cause likely involves Julia using the older MSVCRT runtime instead of the newer Universal C Runtime (UCRT). There may have benn a compatability layer in older python versions that could have been deprecated recently.

I really wish someone would do the UCRT port for Julia as it also interferes with running applications in MSIX sandbox environment.

1 Like