Skip to content

R, Julia and container miscommunication #7088

@vladimirovav

Description

@vladimirovav

I am using an R script which uses Julia functions to run the code. It works perfectly on my computer, but when I try to set it up in the virtual environment, it gives me an error. I've created a container (ubuntu 22.04) with R and Julia installed inside with all the packages required, and upon testing it worked great. However, once I run a specific code, which calls Julia to interact with R, it gives me this error:

    ERROR: LoadError: InitError: could not load library "/home/v_vl/.julia/artifacts/2829a1f6a9ca59e5b9b53f52fa6519da9c9fd7d3/lib/libhdf5.so"
    /usr/lib/x86_64-linux-gnu/libcurl.so: version `CURL_4' not found (required by /home/v_vl/.julia/artifacts/2829a1f6a9ca59e5b9b53f52fa6519da9c9fd7d3/lib/libhdf5.so)

I've looked online, and it says that the main problem is that the script is using the system's lib* files, as opposed to of that from Julia, which creates this error.

So I am trying to modify the last .def file to fix the problem, so far this is what I've added to it:

    Bootstrap: localimage
    From: ubuntu_R_ResistanceGA.sif
    
    %post
    # Install system dependencies for Julia
    apt-get update && \
    apt-get install -y wget tar gnupg lsb-release \
    software-properties-common libhdf5-dev libnetcdf-dev \
    libcurl4-openssl-dev=7.68.0-1ubuntu2.25 \
    libgconf-2-4 \
    libssl-dev
    
    # Run ldconfig to update the linker cache
      ldconfig
    
     # Set environment variable to include the directory where the artifacts are stored
    echo "export LD_LIBRARY_PATH=/home/v_vl/.julia/artifacts/2829a1f6a9ca59e5b9b53f52fa6519da9c9fd7d3/lib:\$LD_LIBRARY_PATH" >> /etc/profile
  # Clean up the package cache to reduce container size
  apt-get clean

  # Install Julia 1.9.3
  wget https://julialang-s3.julialang.org/bin/linux/x64/1.9/julia-1.9.3-linux-x86_64.tar.gz
  tar -xvzf julia-1.9.3-linux-x86_64.tar.gz
  mv julia-1.9.3 /usr/local/julia
  ln -s /usr/local/julia/bin/julia /usr/local/bin/julia

  # Install Circuitscape
julia -e 'using Pkg; Pkg.add("Circuitscape")'
julia -e 'using Pkg; Pkg.build("NetCDF_jll")'


%environment
  export LD_LIBRARY_PATH=/home/v_vl/.julia/artifacts/2829a1f6a9ca59e5b9b53f52fa6519da9c9fd7d3/lib:$LD_LIBRARY_PATH

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions