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

Problem with installation #130

Open niming2 opened 1 year ago

niming2 commented 1 year ago

Hi all,

I'm trying to use sjSDM to run joint species distribution model. But when I run the model it reminds: Error: PyTorch not installed I have tried all methods provided in installation_help, but they don't work. Hope advises from you. Here are reports from install_diagnostic() :

      name                                                                        python

1 base C:\Users\au734704\AppData\Local\anaconda3/python.exe 2 r-reticulate C:\Users\au734704\AppData\Local\anaconda3\envs\r-reticulate/python.exe 3 r-sjsdm C:\Users\au734704\AppData\Local\anaconda3\envs\r-sjsdm/python.exe

ENV: base

torch:

packages in environment at C:\Users\au734704\AppData\Local\ANACON~1:

#

Name Version Build Channel

numpy:

packages in environment at C:\Users\au734704\AppData\Local\ANACON~1:

#

Name Version Build Channel

numpy 1.24.3 py311hdab7c0b_1
numpy-base 1.24.3 py311hd01c5d8_1
numpydoc 1.5.0 py311haa95532_0

ENV: r-reticulate torch:

packages in environment at C:\Users\au734704\AppData\Local\ANACON~1\envs\r-reticulate:

#

Name Version Build Channel

pytorch 2.0.1 py3.11_cpu_0 pytorch pytorch-cuda 11.7 h16d0643_5 pytorch pytorch-mutex 1.0 cpu pytorch pytorch-ranger 0.1.1 pypi_0 pypi torch-optimizer 0.3.0 pypi_0 pypi torchaudio 2.0.2 py311_cpu pytorch torchvision 0.15.2 py311_cpu pytorch

numpy:

packages in environment at C:\Users\au734704\AppData\Local\ANACON~1\envs\r-reticulate:

#

Name Version Build Channel

numpy 1.25.2 py311hdab7c0b_0
numpy-base 1.25.2 py311hd01c5d8_0

ENV: r-sjsdm

torch:

packages in environment at C:\Users\au734704\AppData\Local\ANACON~1\envs\r-sjsdm:

#

Name Version Build Channel

pytorch 2.0.1 py3.11_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 torchvision 0.15.2 py311_cpu pytorch

numpy:

packages in environment at C:\Users\au734704\AppData\Local\ANACON~1\envs\r-sjsdm:

#

Name Version Build Channel

numpy 1.25.2 py311hdab7c0b_0
numpy-base 1.25.2 py311hd01c5d8_0

python: C:/Users/au734704/AppData/Local/anaconda3/envs/r-sjsdm/python.exe libpython: C:/Users/au734704/AppData/Local/anaconda3/envs/r-sjsdm/python311.dll pythonhome: C:/Users/au734704/AppData/Local/anaconda3/envs/r-sjsdm version: 3.11.5 | packaged by Anaconda, Inc. | (main, Sep 11 2023, 13:26:23) [MSC v.1916 64 bit (AMD64)] Architecture: 64bit numpy: C:/Users/au734704/AppData/Local/anaconda3/envs/r-sjsdm/Lib/site-packages/numpy numpy_version: 1.25.2 torch: C:\Users\au734704\AppData\Local\ANACON~1\envs\r-sjsdm\Lib\site-packages\torch

NOTE: Python version was forced by use_python() function

 active environment : None
   user config file : C:\Users\au734704\.condarc

populated config files : C:\Users\au734704.condarc conda version : 23.7.2 conda-build version : 3.26.0 python version : 3.11.4.final.0 virtual packages : __archspec=1=x86_64 __win=0=0 base environment : C:\Users\au734704\AppData\Local\ANACON~1 (writable) conda av data dir : C:\Users\au734704\AppData\Local\ANACON~1\etc\conda conda av metadata url : None channel URLs : https://repo.anaconda.com/pkgs/main/win-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/r/win-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/msys2/win-64 https://repo.anaconda.com/pkgs/msys2/noarch package cache : C:\Users\au734704\AppData\Local\ANACON~1\pkgs C:\Users\au734704.conda\pkgs C:\Users\au734704\AppData\Local\conda\conda\pkgs envs directories : C:\Users\au734704\AppData\Local\ANACON~1\envs C:\Users\au734704.conda\envs C:\Users\au734704\AppData\Local\conda\conda\envs platform : win-64 user-agent : conda/23.7.2 requests/2.31.0 CPython/3.11.4 Windows/10 Windows/10.0.22621 administrator : False netrc file : None offline mode : False

MaximilianPi commented 1 year ago

Hi @niming2,

  1. You had already an existing anaconda3 installation on your system? If yes, let's get rid of it by deleting the following folder and then try to reinstall sjSDM using the install_sjSDM function

C:\Users\au734704\AppData\Local\anaconda3

  1. If you have installed anaconda3 manually because the install_sjSDM() function was unable to install miniconda automatically, try to run the following commands (in R):
library(reticulate)
reticulate::conda_remove("r-reticulate")
reticulate::conda_remove("r-sjSDM")

reticulate::conda_create(envname = "r-sjsdm", python_version = "3.9")
# CPU Version:
reticulate::conda_install(envname = "r-sjsdm", 
                          packages =c("pytorch", "torchvision", "torchaudio", "cpuonly", "-c", "pytorch"))
# GPU Version:
reticulate::conda_install(envname = "r-sjsdm", 
                          packages =c("pytorch", "torchvision", "torchaudio", "pytorch-cuda=11.7", "-c", "pytorch", "-c" ,"nvidia"))

reticulate::conda_install(envname = "r-sjsdm",
                          packages = c("pyro-ppl", "torch_optimizer", "madgrad", "tqdm"), pip = TRUE)