[Solved] Issue to run Julia from snap: symbol lookup error: /snap/core18/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined symbol: __libc_vfork, version GLIBC_PRIVATE

If you installed Julia from snap, and tried to run it from Python3, probably you get the following issue.

from julia.api import Julia
jl = Julia(compiled_modules=False)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/dist-packages/julia/core.py", line 472, in __init__
    self.api = LibJulia.from_juliainfo(jlinfo)
  File "/usr/local/lib/python3.10/dist-packages/julia/libjulia.py", line 203, in from_juliainfo
    return cls(
  File "/usr/local/lib/python3.10/dist-packages/julia/libjulia.py", line 226, in __init__
    self.libjulia = ctypes.PyDLL(libjulia_path, ctypes.RTLD_GLOBAL)
  File "/usr/lib/python3.10/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /snap/core18/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined symbol: __libc_vfork, version GLIBC_PRIVATE

Appears to be a core18 error, but I can't remove it, because other packages are installed and are using it.
If you add Julia to your PATH, at the terminal startup you will see:

mkdir: symbol lookup error: /snap/core18/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined symbol: __libc_vfork, version GLIBC_PRIVATE
mv: symbol lookup error: /snap/core18/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined symbol: __libc_vfork, version GLIBC_PRIVATE

I tried downgrade Julia from version 1.8.1 to 1.6.7, with:

snap info julia
sudo snap refresh julia --channel=lts/stable

However the issue its persistent.

To solve it, just download Julia package from github:

wget https://julialang-s3.julialang.org/bin/linux/x64/1.8/julia-1.8.1-linux-x86_64.tar.gz
tar xzvf julia-1.8.1-linux-x86_64.tar.gz
cd julia-1.8.1
pwd

Now, add this directory to your PATH in ~/.bashrc

export JULIA="~/julia-1.8.1"
export PATH="${PATH}:${JULIA}/bin"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${JULIA}/lib"


Now, execute Julia in Python3:

from julia.api import Julia
>>> jl = Julia(compiled_modules=False)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/dist-packages/julia/core.py", line 513, in __init__
    self._call("const PyCall = Base.require({0})".format(PYCALL_PKGID))
  File "/usr/local/lib/python3.10/dist-packages/julia/core.py", line 549, in _call
    self.check_exception(src)
  File "/usr/local/lib/python3.10/dist-packages/julia/core.py", line 603, in check_exception
    raise JuliaError(u'Exception \'{}\' occurred while calling julia code:\n{}'
julia.core.JuliaError: Exception 'ArgumentError' occurred while calling julia code:
const PyCall = Base.require(Base.PkgId(Base.UUID("438e738f-606a-5dbb-bf0a-cddfbfd45ab0"), "PyCall"))

To run PyCall, go to Julia REPL and add the package "PyCall".

Pkg.add("PyCall")
ERROR: UndefVarError: Pkg not defined

Before call Pkg, remeber use Pkg:

using Pkg
Pkg.add("PyCall")

Now, all its ok. Enjoy!


Comments

Popular posts from this blog

Exception: Could not find a default OpenFlow controller in Mininet

How to fix Android when developer options are not available for this user

Webcam streaming throught VLC with YUY2 compatibility