TheoreticalEcology / s-jSDM

Scalable joint species distribution modeling
https://cran.r-project.org/web/packages/sjSDM/index.html
GNU General Public License v3.0
68 stars 14 forks source link

sjSDM on a remote server #138

Open Loic-sanchez opened 7 months ago

Loic-sanchez commented 7 months ago

Hello, I've been trying to install sjSDM on a server using a GPU and I can't figure how to install it correctly. Installing the packages works well, the install_sjSDM function with the version = "gpu" function also works but when I try to use a function it seems the library can't be attached: I have an error saying the four dependencies are not installed, although when I re-run install_sjSDM it says everything is installed already. Here is the output of my install_diagnostic() :

sjSDM::install_diagnostic()

     name                                        python
1    base                    /etc/miniconda3/bin/python
2 r-sjsdm /home/lsanchez/.conda/envs/r-sjsdm/bin/python

ENV: base

torch:
# packages in environment at /etc/miniconda3:
#
# Name                    Version                   Build  Channel

numpy:
# packages in environment at /etc/miniconda3:
#
# Name                    Version                   Build  Channel

ENV: r-sjsdm

torch:
# packages in environment at /home/lsanchez/.conda/envs/r-sjsdm:
#
# Name                    Version                   Build  Channel
pytorch                   1.13.1              py3.7_cpu_0    pytorch
pytorch-mutex             1.0                         cpu    pytorch
pytorch-ranger            0.1.1                    pypi_0    pypi
torch-optimizer           0.3.0                    pypi_0    pypi
torchaudio                0.13.1                 py37_cpu    pytorch
torchvision               0.14.1                 py37_cpu    pytorch

numpy:
# packages in environment at /home/lsanchez/.conda/envs/r-sjsdm:
#
# Name                    Version                   Build  Channel
numpy                     1.21.6                   pypi_0    pypi

python:         /home/lsanchez/.virtualenvs/r-reticulate/bin/python
libpython:      /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10.so
pythonhome:     /home/lsanchez/.virtualenvs/r-reticulate:/home/lsanchez/.virtualenvs/r-reticulate
version:        3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
numpy:          /home/lsanchez/.virtualenvs/r-reticulate/lib/python3.10/site-packages/numpy
numpy_version:  1.26.4
torch:          [NOT FOUND]

     active environment : base
    active env location : /etc/miniconda3
            shell level : 1
       user config file : /home/lsanchez/.condarc
 populated config files : 
          conda version : 24.3.0
    conda-build version : not installed
         python version : 3.11.4.final.0
                 solver : libmamba (default)
       virtual packages : __archspec=1=icelake
                          __conda=24.3.0=0
                          __cuda=12.2=0
                          __glibc=2.35=0
                          __linux=5.15.0=0
                          __unix=0=0
       base environment : /etc/miniconda3  (read only)
      conda av data dir : /etc/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /etc/miniconda3/pkgs
                          /home/lsanchez/.conda/pkgs
       envs directories : /home/lsanchez/.conda/envs
                          /etc/miniconda3/envs
               platform : linux-64
             user-agent : conda/24.3.0 requests/2.31.0 CPython/3.11.4 Linux/5.15.0-101-generic ubuntu/22.04.3 glibc/2.35 solver/libmamba conda-libmamba-solver/24.1.0 libmambapy/1.5.8
                UID:GID : 1083:1083
             netrc file : None
           offline mode : False

Thanks for reading me

MaximilianPi commented 7 months ago

Hi @Loic-sanchez, Run reticulate::use_condaenv("r-sjsdm", required = TRUE) at the top of your script or in a new R session before loading a library.

Loic-sanchez commented 7 months ago

Hi thanks for the proposition, my team found a workaround, running this line before attaching library :

Sys.setenv(PATH=paste(Sys.getenv('PATH'), '/etc/miniconda3/condabin/', sep=':'))

Now the following issue I have when running the model is :

AssertionError: Torch not compiled with CUDA enabled

Any idea on how to activate it ? I tried this in my bash terminal :

conda create --name cuda_env
conda activate cuda_env
conda install cudatoolkit

This is the error message I got :

EnvironmentNotWritableError: The current user does not have write permissions to the target environment. environment location: /etc/miniconda3 uid: 1083 gid: 1083

Loic-sanchez commented 7 months ago

Update : it seems that an update on the server has solved the issue ! Thank you again :)