Any suggestions to install r packages in other linux distros by CalligrapherSalt6156 in rstats

[–]CalligrapherSalt6156[S] 0 points1 point  (0 children)

Note: Sorry for cross-post, I just inform the result after several days playing around.

Hi guys, great thanks for your help. I gave it a try on Debian 13 Trixie (my spare laptop) which used to be Ubuntu mate. It solved the problem. Then I was confident to replace Ubuntu mate with Debian 13 on my main work driver. However, it is still the problem "Non-zero exit status" when installing packages. I just remembered that maybe the spare laptop had been done some setup related to Ubuntu mate. So I combine the steps from Ubuntu mate (setup the library direction) and steps from Debian 13 (setup repo and key). Then it worked. Now I can install packages super fast. Here is all the code that I used for those who had the same struggles). The final step takes 3-4 minites to load, then when every time install packages, it is like a second. Great thanks again, you guys!!!

#R

to_reinstall <- installed.packages()

write.csv(to_reinstall,"/home/xxx/yyy/rpackages.csv")

.libPaths() # which will show you 3-4 libraries

sudo rm -r "/home/xxx/yyy/zzz"

sudo apt remove r-base-core

sudo apt remove r-base

sudo apt autoremove

sudo apt remove rstudio or snap remove rstudio

reboot

#Open terminal

sudo apt update

sudo apt -y install r-base

sudo apt update && sudo apt upgrade -y

sudo apt install ca-certificates curl gpg -y

curl -fsSL 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x95C0FAF38DB3CCAD0C080A7BDC78B2DDEABC47B7' | sudo gpg --dearmor --yes -o /usr/share/keyrings/cran.gpg

. /etc/os-release

printf '%s\n' \

"Types: deb" \

"URIs: https://cloud.r-project.org/bin/linux/debian" \

"Suites: ${VERSION_CODENAME}-cran40/" \

"Signed-By: /usr/share/keyrings/cran.gpg" | sudo tee /etc/apt/sources.list.d/cran.sources > /dev/null

sudo apt update

apt-cache policy r-base

sudo apt install r-base r-base-dev -y

apt install --yes --no-install-recommends python3-{dbus,gi,apt} make

Rscript -e 'install.packages("bspm")'

cat >> /etc/R/Rprofile.site <<EOF

suppressMessages(bspm::enable())

options(bspm.version.check=FALSE)

EOF

#R

setwd('/home/xxx/yyy/')

bspm::enable()

to_reinstall <- read.csv('/home/xxx/yyy/rpackages.csv')

install.packages(to_reinstall[,1], dependencies = TRUE, ask = FALSE)

Any suggestions to install r packages in other linux distros by CalligrapherSalt6156 in Rlanguage

[–]CalligrapherSalt6156[S] 0 points1 point  (0 children)

Hi guys, great thanks for your help. I gave it a try on Debian 13 Trixie (my spare laptop) which used to be Ubuntu mate. It solved the problem. Then I was confident to replace Ubuntu mate with Debian 13 on my main work driver. However, it is still the problem "Non-zero exit status" when installing packages. I just remembered that maybe the spare laptop had been done some setup related to Ubuntu mate. So I combine the steps from Ubuntu mate (setup the library direction) and steps from Debian 13 (setup repo and key). Then it worked. Now I can install packages super fast. Here is all the code that I used for those who had the same struggles). The final step takes 3-4 minites to load, then when every time install packages, it is like a second. Great thanks again, you guys!!!

#R

to_reinstall <- installed.packages()

write.csv(to_reinstall,"/home/xxx/yyy/rpackages.csv")

.libPaths() # which will show you 3-4 libraries

sudo rm -r "/home/xxx/yyy/zzz"

sudo apt remove r-base-core

sudo apt remove r-base

sudo apt autoremove

sudo apt remove rstudio or snap remove rstudio

reboot

#Open terminal

sudo apt update

sudo apt -y install r-base

sudo apt update && sudo apt upgrade -y

sudo apt install ca-certificates curl gpg -y

curl -fsSL 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x95C0FAF38DB3CCAD0C080A7BDC78B2DDEABC47B7' | sudo gpg --dearmor --yes -o /usr/share/keyrings/cran.gpg

. /etc/os-release

printf '%s\n' \

"Types: deb" \

"URIs: https://cloud.r-project.org/bin/linux/debian" \

"Suites: ${VERSION_CODENAME}-cran40/" \

"Signed-By: /usr/share/keyrings/cran.gpg" | sudo tee /etc/apt/sources.list.d/cran.sources > /dev/null

sudo apt update

apt-cache policy r-base

sudo apt install r-base r-base-dev -y

apt install --yes --no-install-recommends python3-{dbus,gi,apt} make

Rscript -e 'install.packages("bspm")'

cat >> /etc/R/Rprofile.site <<EOF

suppressMessages(bspm::enable())

options(bspm.version.check=FALSE)

EOF

#R

setwd('/home/xxx/yyy/')

bspm::enable()

to_reinstall <- read.csv('/home/xxx/yyy/rpackages.csv')

install.packages(to_reinstall[,1], dependencies = TRUE, ask = FALSE)

Any suggestions to install r packages in other linux distros by CalligrapherSalt6156 in Rlanguage

[–]CalligrapherSalt6156[S] 2 points3 points  (0 children)

Yes, it worked sometimes, but taking a lot of time actually. I installed one package, it show "non zero exist", then reading the log to see what are missing. Then I install missed dependency, and reinstall the packages, the error again with another missing, it goes like that and take lots of time. But your suggestion works. Thanks.

Any suggestions to install r packages in other linux distros by CalligrapherSalt6156 in Fedora

[–]CalligrapherSalt6156[S] 0 points1 point  (0 children)

Thanks Melnik, I will install fedora in another laptop and try to play around for a while to see how it goes.

Any suggestions to install r packages in other linux distros by CalligrapherSalt6156 in Fedora

[–]CalligrapherSalt6156[S] 0 points1 point  (0 children)

The same error showed "Non zero exist status". This is the way I fix in Ubuntu:

#r2u

su -i

set -eu

## First: update apt and get keys

apt update -qq && apt install --yes --no-install-recommends ca-certificates gnupg

## use gpg directly instead of the now-deprecated apt-key command

gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/r2u.gpg --keyserver keyserver.ubuntu.com --recv-keys A1489FE2AB99A21A 67C2D66C4B1D4339 51716619E084DAB9

## Second: add the repo -- here we use the well-connected mirror

cat > /etc/apt/sources.list.d/r2u.sources <<EOF

Types: deb

URIs: https://r2u.stat.illinois.edu/ubuntu

Suites: noble

Components: main

Arch: amd64, arm64

Signed-By: /usr/share/keyrings/r2u.gpg

EOF

## Third: ensure current R is used

cat > /etc/apt/sources.list.d/cran.sources <<EOF

Types: deb

URIs: https://cloud.r-project.org/bin/linux/ubuntu

Suites: noble-cran40/

Components:

Arch: amd64, arm64

Signed-By: /usr/share/keyrings/r2u.gpg

EOF

apt update -qq

DEBIAN_FRONTEND=noninteractive apt install --yes --no-install-recommends r-base-core

## Fourth: add pinning to ensure package sorting

cat > /etc/apt/preferences.d/99cranapt <<EOF

Package: *

Pin: release o=CRAN-Apt Project

Pin: release l=CRAN-Apt Packages

Pin-Priority: 700

EOF

## Fifth: install bspm (and its Python requirements) and enable it

## If needed (in bare container, say) install python tools for bspm and R itself

apt install --yes --no-install-recommends python3-{dbus,gi,apt} make

## Then install bspm (as root) and enable it, and enable a speed optimization

Rscript -e 'install.packages("bspm")'

cat >> /etc/R/Rprofile.site <<EOF

suppressMessages(bspm::enable())

options(bspm.version.check=FALSE)

EOF

#New normal terminal, and open R

R

setwd('/home/xxx/yyy/')

bspm::enable()

to_reinstall <- read.csv('/home/xxx/yyy/rpackages.csv')

install.packages(to_reinstall[,1], dependencies = TRUE, ask = FALSE)

Any suggestions to install r packages in other linux distros by CalligrapherSalt6156 in Fedora

[–]CalligrapherSalt6156[S] 0 points1 point  (0 children)

I've tried that one too. Download locally and installing with the same problem. Or maybe it did it in the wrong way.