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

LD_LIBRARY_PATH is not properly exported #1515

Open
AmelZulji opened this issue Apr 23, 2024 · 5 comments
Open

LD_LIBRARY_PATH is not properly exported #1515

AmelZulji opened this issue Apr 23, 2024 · 5 comments
Labels

Comments

@AmelZulji
Copy link

Describe the bug
Attaching R doesn't properly sets LD_LIBRARY_PATH (it leads to errors when loading libraries). When I lunch R from system (the same one which I specify in r.path and r.term) has additional libraries on path as compared to attached R. I tried to update the LD_LIBRARY_PATH in .vscode-server/extensions/reditorsupport.r-2.8.2/R/session/init.R. when I attach R afterwards Sys.getenv("LD_LIBRARY_PATH") give updated LD_LIBRARY_PATH, however it seems like the libraries are still not accessible and the same error persist:

unable to load shared object 'proj/renv/library/R-4.3/x86_64-pc-linux-gnu/igraph/libs/igraph.so':
  /lib64/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /proj/renv/library/R-4.3/x86_64-pc-linux-gnu/igraph/libs/igraph.so)

loading libraries in manualy launched R works with no errors.

To Reproduce

Can you fix this issue by yourself? (We appreciate the help)
No

Environment (please complete the following information):

  • OS: Linux
  • VSCode Version: 1.88.1
  • R Version: 4.3.3
  • vscode-R version: 2.8.2

Thank you and kind regards,
Amel

@AmelZulji AmelZulji added the bug label Apr 23, 2024
@AmelZulji
Copy link
Author

Can anybody please let me know if this is something that can be adressed?

@eitsupi
Copy link
Contributor

eitsupi commented Apr 30, 2024

@AmelZulji
Copy link
Author

Thank you for the reply @eitsupi.

I have a renv library /project/renv/library/R-4.2/x86_64-pc-linux-gnu. within that library languageserver and jsonlite are installed and that library is included within r.libPaths.

The problem that I have is that when I launch R from VSCode I cannot load any of the libraries which is within /project/renv/library/R-4.2/x86_64-pc-linux-gnu. I get the error mentioned above.

If i start the R terminal outside the VSCode I can normally load those libraries.

The problem in my opinion is how R is started within VSCode and outside.

Outside of VSCode:

> Sys.getenv("PATH")
[1] "/opt/bwhpc/common/compiler/gnu/12.1.0/bin:/opt/bwhpc/common/math/R/4.2.1-mkl-2022.2-gnu-12.1-cairo/bin:/home/hd/hd_hd/hd_ut239/.local/bin:/home/hd/hd_hd/hd_ut239/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/hd/hd_hd/hd_ut239/bin/cmake-3.25.2-linux-x86_64/bin"

Within VSCode:

> Sys.getenv("PATH")
[1] "/gpfs/bwfor/home/hd/hd_hd/hd_ut239/.vscode-server/cli/servers/Stable-e170252f762678dec6ca2cc69aba1570769a5d39/server/bin/remote-cli:/home/hd/hd_hd/hd_ut239/.local/bin:/home/hd/hd_hd/hd_ut239/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/hd/hd_hd/hd_ut239/bin/cmake-3.25.2-linux-x86_64/bin/:/home/hd/hd_hd/hd_ut239/bin/cmake-3.25.2-linux-x86_64/bin/"

I am using VSCode to connect remotly to HPC. Within HPC, R is available as module, when i module load R it loads R but in addition it also load compiler/gnu/12.1 and numlib/mkl/2022.2. I have an impression that those additional modules are causing problem in VScode.

Any help would be greatly appreciated.
Regards,
Amel

@AmelZulji
Copy link
Author

@renkun-ken would you mind having a look into this?

@gowerc
Copy link
Contributor

gowerc commented May 17, 2024

I have no idea what the "correct" solution is here but the following workaround seems to work for me:

  • Create the file in your project ./bin/loadR.sh
  • Populate the file with what ever commands are needed to load the correct module environment + environment variables e.g.
module load R
export LD_LIBRARY_PATH=<what ever you need>
R $@
  • Make the script executable chmod 755 ./bin/loadR.sh
  • Update your local project specific settings file (./.vscode/settings.json) to launch R using this script
{
    "r.rterm.linux": "${workspaceFolder}/bin/loadR.sh"
}

When you then attach R via the command pallete this should have the correct environment set up.

image

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

No branches or pull requests

3 participants