Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation when "R" is already present #24

Open
peacocks opened this issue Aug 19, 2024 · 3 comments
Open

Installation when "R" is already present #24

peacocks opened this issue Aug 19, 2024 · 3 comments

Comments

@peacocks
Copy link

A request for the user instructions in README.md

I followed the instructions but had problems because the file ispaq-conda-install.txt installs "R" version 3.6 in the Conda environment, while my computer has version 4.1 installed in /usr/lib64. So the command "run_ispaq.py -I" and the "R CMD INSTALL" commands tried to use the system "R", and to load the system "R" runtime libraries .

I issued commands to set up environment variables to point to the Conda environment copy of "R", i.e.
export R_LIBS=/usr/local/miniforge3/envs/ispaq/lib/R:$R_LIBS
export R_LIBS_SITE=/usr/local/miniforge3/envs/ispaq/lib/R/library:$R_LIBS_SITE

I also issued
export LD_LIBRARY_PATH=/usr/local/miniforge3/envs/ispaq/lib:$LD_LIBRARY_PATH
I am not sure if this was necessary. "ispaq" worked once these commands had been issued.

I presume that there is a Conda command that allows these environment variables to be set up while one is in the "ispaq" environment, and removed when one exits from it, but I haven't found it yet.

I wonder whether omitting the "R" items from ispaq-conda-install.txt and installing them "by hand" in the system "R" library would allow the program to work without needing a copy of "R" in the Conda environment. This might not be possible for users with a system "R" installed in /usr/lib64 if they do not have superuser access, as well as risking the "ispaq" code trying to work with a genuinely incompatible version of "R".

@gillian-earthscope
Copy link
Contributor

gillian-earthscope commented Aug 30, 2024

After you created the 'ispaq' conda environment, did you make sure to activate it before running any ispaq commands? After you activate it with conda activate ispaq, you can run conda list | grep ^"r " to confirm that only R 3.6 is installed. When the ispaq environment is activated, I can't reproduce your experience of the system R being used.

I also don't know of a conda has a command that will set/unset environmental variables. What I have done in the past that might be useful is to create two shell scripts, e.g., ispaq_env.sh and undo_ispaq_env.sh.

> cat ispaq_env.sh
conda activate ispaq
export R_LIBS=/Users/gilliansharer/miniconda3/envs/ispaq/bin/R
export R_LIBS_SITE=/Users/gilliansharer/miniconda3/envs/ispaq/bin/R/library

> cat undo_ispaq_env.sh
conda deactivate
unset R_LIBS
unset R_LIBS_SITE

Then run source ispaq_env.sh to start up the ispaq environment and source undo_ispaq_env.sh to exit. You can alias these commands to something shorter. But you really shouldn't need to set these environmental variables. Do you have any other R environmental variables set?

@peacocks
Copy link
Author

peacocks commented Sep 2, 2024

Thanks - I'll do what you suggest for the R environment variables - these are the only two that I had set up to run "R" on my system. The conda environment was in force while I was experiencing these difficulties with the system copy of "R". The "conda list" command shows that R 3.6 is installed in the "ispaq" environment:

(ispaq) [sheila@plymouth ispaq]$ conda list | grep ^"r "
r 3.6 r36_1004 conda-forge

@gillian-earthscope
Copy link
Contributor

My next suggestion should be to check your $PATH environmental variable after your ispaq environment is activated. /usr/local/miniforge3/envs/ispaq/bin should be in front of other paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants