is there a way to get R 4.4 on linux mint with ubuntu 24.04?
I allowed upgrade of packages and that overwrote my 4.4 with 4.5 and
now i have a huge list of packages, some of which are difficult to
install to deal with.
following the instructions on
https://cloud.r-project.org/bin/linux/ubuntu/fullREADME.html
On 13 May 2025 at 18:32, Stephen Bond via R-SIG-Debian wrote:
| is there a way to get R 4.4 on linux mint with ubuntu 24.04?
|
| I allowed upgrade of packages and that overwrote my 4.4 with 4.5 and
| now i have a huge list of packages, some of which are difficult to
| install to deal with.
Well I have been meaning to write a piece about upgrading but ... what exactly is
your issue here, and how can we help?
For context, I _never_ reinstall R packages when R upgrades (apart, of
course, for changes like R 4.0.0 when we had to). So in my standard place,
ie /usr/local/lib/R/site-library, a month after R 4.5.0 came, it is still a
healthy mix of packages installed with R 4.5.0, 4.4.*, 4.3.* and possibly
older. They all work.
Now, back to your question: I am not aware of a repo for Ubuntu that mimicks
snapshot.debian.org giving you all builds. But if you look at
packages.ubuntu.com and search you get this
https://packages.ubuntu.com/search?keywords=r-base&searchon=names&suite=all§ion=all
indicating 4.4.1 in 24.10 and 4.4.3 in 25.04. Your 24.04 only has 4.3.3. But
read on...
But if you really think you must use R 4.4.* on Ubuntu 24.04 you can always
compile it locally, as package (ie build a .deb if you know how) or into
/usr/local. But read on...
All that said, I think it is a non-issue. R 4.5.0 works great on 24.04 and
later _and that is why we offer the backport via CRAN_.
| following the instructions on
| https://cloud.r-project.org/bin/linux/ubuntu/fullREADME.html
|
| > To obtain the latest R 4.4 packages, add an entry like
| >
| > deb https://cloud.r-project.org/bin/linux/ubuntu noble-cran40/
|
| but that gave me 4.5 again. so, 1) how do I get the 4.4 and 2) how do I
| stop the automatic upgrades
To prevent apt and dpkg from upgrading a package, you can place a 'hold'. See
the dpkg documentation (man dpkg) and look for hold. You pass the package
name and the state ("hold") 'piped' to dpkg --set-selection, if I remember
correctly. There are likely some tutorials somewhere.
Now, given a particular set of apt repos (that is your local admin choice
after all) you can always call 'apt-cache policy r-base-core' to see what is
know. You will likely see r-base-core 4.4.3 still listed. You *can* in fact
instal that from that CRAN mirror repo by giving an explicit version argument
so
sudo apt install r-base-core=4.4.3-1.2404.0
should work but you likely need to add additional packages there to satisfy
apt ie
sudo apt install r-base-core=4.4.3-1.2404.0 r-base-dev=4.4.3-1.2404.0
and so on.
After this you must use the 'dpkg hold' trick to not update 4.5.0 over 4.4.3
again.
Dirk
| thanks everybody
| stephen
|
| _______________________________________________
| R-SIG-Debian mailing list
| R-SIG-Debian at r-project.org
| https://stat.ethz.ch/mailman/listinfo/r-sig-debian
dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
Hello,
I do not care about version. My packages are in
/home/stephen/R/x86_64-pc-linux-gnu-library/4.4/
and and after renaming the 4.4 folder I can load them.
How do you avoid the version naming of the package folder?
This is not really pressing as even as is the setup is acceptable. I
did not know packages from older versions work on upgraded r-base.
Cheers
On Tue, 2025-05-13 at 18:14 -0500, Dirk Eddelbuettel wrote:
On 13 May 2025 at 18:32, Stephen Bond via R-SIG-Debian wrote:
is there a way to get R 4.4 on linux mint with ubuntu 24.04?
I allowed upgrade of packages and that overwrote my 4.4 with 4.5
and
now i have a huge list of packages, some of which are difficult to
install to deal with.
Well I have been meaning to write a piece about upgrading but ...
what exactly is
your issue here, and how can we help?
For context, I _never_ reinstall R packages when R upgrades (apart,
of
course, for changes like R 4.0.0 when we had to).? So in my standard
place,
ie /usr/local/lib/R/site-library, a month after R 4.5.0 came, it is
still a
healthy mix of packages installed with R 4.5.0, 4.4.*, 4.3.* and
possibly
older. They all work.
Now, back to your question: I am not aware of a repo for Ubuntu that
mimicks
snapshot.debian.org giving you all builds. But if you look at
packages.ubuntu.com and search you get this
?
https://packages.ubuntu.com/search?keywords=r-base&searchon=names&suite=all§ion=all
?
indicating 4.4.1 in 24.10 and 4.4.3 in 25.04. Your 24.04 only has
4.3.3. But
read on...
But if you really think you must use R 4.4.* on Ubuntu 24.04 you can
always
compile it locally, as package (ie build a .deb if you know how) or
into
/usr/local. But read on...
All that said, I think it is a non-issue. R 4.5.0 works great on
24.04 and
later _and that is why we offer the backport via CRAN_.
but that gave me 4.5 again. so, 1) how do I get the 4.4 and 2) how
do I
stop the automatic upgrades
To prevent apt and dpkg from upgrading a package, you can place a
'hold'. See
the dpkg documentation (man dpkg) and look for hold. You pass the
package
name and the state ("hold") 'piped' to dpkg --set-selection, if I
remember
correctly. There are likely some tutorials somewhere.
Now, given a particular set of apt repos (that is your local admin
choice
after all) you can always call 'apt-cache policy r-base-core' to see
what is
know. You will likely see r-base-core 4.4.3 still listed.? You *can*
in fact
instal that from that CRAN mirror repo by giving an explicit version
argument
so
? sudo apt install r-base-core=4.4.3-1.2404.0
should work but you likely need to add additional packages there to
satisfy
apt ie
? sudo apt install r-base-core=4.4.3-1.2404.0 r-base-dev=4.4.3-
1.2404.0
and so on.
After this you must use the 'dpkg hold' trick to not update 4.5.0
over 4.4.3
again.
Dirk
| I do not care about version. My packages are in
|
| /home/stephen/R/x86_64-pc-linux-gnu-library/4.4/
|
| and and after renaming the 4.4 folder I can load them.
| How do you avoid the version naming of the package folder?
It's a personal preference but I tend to set things up such that I have no
user-local directory, and that has worked for a few decades now:
$ Rscript -e 'print(.libPaths())'
[1] "/usr/local/lib/R/site-library" "/usr/lib/R/site-library" "/usr/lib/R/library"
$
If one likes to have one it is still possibly to skip either or both of the
architecture and the version part, see eg /etc/R/Renviron* and the hint about
the help(Startup) page.
| This is not really pressing as even as is the setup is acceptable. I
| did not know packages from older versions work on upgraded r-base.
It is hard to get an official word. I think R Core still 'recommends it' just
to start from a clean plate, but I know from my Debian packaging work that it
is (generally) not a requirement as R Core is so careful about not removing
things from the ABI. Packages build under older R generally just work, which
is a good thing. (Packages built under newer R get you a warning 'built under
X.Y ...'.) So for me no need for a forced rebuild and installation of all
packages.
Best, Dirk
dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
Folks,
Sorry to bother you, but I have bad news. Normal R packages work, but
keras and tensorflow keep crashing. After 2 hours of trying to
reinstall I still have nothing.
can anybody suggest a way to install tensorflow and keras under 4.5?
(let me know if I should be posting in a different forum.)
I am pasting the script that used to work under 4.4
```
if(!requireNamespace("remotes")) install.packages("remotes")
remotes::update_packages()
remotes::install_cran(c("readr", "tibble", "zip", "fs", "listarrays"))
install.packages("reticulate")
reticulate::miniconda_uninstall()
unlink("~/.pyenv", recursive = TRUE)
unlink("~/.virtualenvs/r-reticulate", recursive = TRUE)
python <- reticulate::install_python("3.12.3")
reticulate::virtualenv_create("r-reticulate", python = python)
install.packages("keras") # keras3
install.packages("tensorflow")
keras::install_keras( envname = "r-reticulate", # keras3
extra_packages = c("keras-tuner", "ipython", "kaggle"))
```
if keras is replaced with keras3 then the install will finish, but it
keeps crashing when I try to run code.
I also discovered that google colab made it very difficult to install
keras in colab. maybe keras is meant to be on python only??
Thanks everybody
On Wed, 2025-05-14 at 08:36 -0500, Dirk Eddelbuettel wrote:
On 14 May 2025 at 09:12, Stephen Bond wrote:
I do not care about version. My packages are in
/home/stephen/R/x86_64-pc-linux-gnu-library/4.4/
and and after renaming the 4.4 folder I can load them.
How do you avoid the version naming of the package folder?
It's a personal preference but I tend to set things up such that I
have no
user-local directory, and that has worked for a few decades now:
? $ Rscript -e 'print(.libPaths())'
? [1] "/usr/local/lib/R/site-library" "/usr/lib/R/site-library"??????
"/usr/lib/R/library"??????????
? $
If one likes to have one it is still possibly to skip either or both
of the
architecture and the version part, see eg /etc/R/Renviron* and the
hint about
the help(Startup) page.
This is not really pressing as even as is the setup is acceptable.
I
did not know packages from older versions work on upgraded r-base.
It is hard to get an official word. I think R Core still 'recommends
it' just
to start from a clean plate, but I know from my Debian packaging work
that it
is (generally) not a requirement as R Core is so careful about not
removing
things from the ABI.? Packages build under older R generally just
work, which
is a good thing. (Packages built under newer R get you a warning
'built under
X.Y ...'.)? So for me no need for a forced rebuild and installation
of all
packages.
Best, Dirk
Stephen,
Sorry to hear that. I am not sure that hijacking an existing thread here is
the best idea -- this is now also deep into reticulate territory, will depend
on how you run Python on the box and more. For what it is worth, still works
here
> library("keras")
> library("tensorflow")
> search()
[1] ".GlobalEnv" "package:tensorflow" "package:keras"
[4] "ESSR" "package:stats" "package:graphics"
[7] "package:grDevices" "package:utils" "package:datasets"
[10] "package:methods" "Autoloads" "package:base"
>
Might be best start over with 'reticulate 101', ie whether you can access
Python, test whether you can load the required packages in your Python
session and so on.
Good luck, Dirk
dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
Dirk,
I appreciate your help. Please, tell me what folders R installs into. I
have a good working 4.3 on another box and want to copy over the 4.5 as
this is my fastest box and it is a shame not to use it.
If you want to check your install of keras on 4.5 please, run the code
below and confirm if it works and report on github. It should take
under 1min.
I started an issue here:
https://github.com/rstudio/tensorflow.rstudio.com/issues/80
```
library(keras)
imdb <- dataset_imdb(num_words = 10001)
train_data <- imdb$train$x
train_labels <- imdb$train$y
test_data <- imdb$test$x
test_labels <- imdb$test$y
vector2 <- function(sequences, dimension = 10000){
results <- array(0, dim = c(length(sequences), dimension))
for(i in seq_along(sequences)){
results[i,sequences[[i]]] <- 1
}
results
}
X <- vector2(train_data)
Xt <- vector2(test_data)
y <- as.numeric(train_labels)
yt <- as.numeric(test_labels)
Xv <- X[1:10000, ]
Xp <- X[-(1:10000), ]
yv <- y[seq(10000)]
yp <- y[-seq(10000)]
model <- keras_model_sequential() %>%
layer_dense(16, activation = "relu") %>%
layer_dense(16, activation = "relu") %>%
layer_dense(1, activation = "sigmoid")
model %>% compile(optimizer = "rmsprop",
loss = "binary_crossentropy",
metrics = "accuracy")
history <- model %>% fit( Xp, yp, epochs = 20, batch_size = 512,
validation_data = list(Xv, yv)
)
```
On Wed, 2025-05-14 at 17:20 -0500, Dirk Eddelbuettel wrote:
Stephen,
Sorry to hear that. I am not sure that hijacking an existing thread
here is
the best idea -- this is now also deep into reticulate territory, >
will depend
on how you run Python on the box and more.? For what it is worth, >
still works
here
??? > library("keras")
??? > library("tensorflow")
??? > search()
???? [1] ".GlobalEnv"???????? "package:tensorflow" >
"package:keras"????
???? [4] "ESSR"?????????????? "package:stats"????? >
"package:graphics"?
???? [7] "package:grDevices"? "package:utils"????? >
"package:datasets"?
??? [10] "package:methods"??? "Autoloads"????????? >
"package:base"?????
??? >
Might be best start over with 'reticulate 101', ie whether you can
access
Python, test whether you can load the required packages in your >
Python
session and so on.
Good luck,? Dirk
| Dirk,
|
| I appreciate your help. Please, tell me what folders R installs into. I
| have a good working 4.3 on another box and want to copy over the 4.5 as
| this is my fastest box and it is a shame not to use it.
That may be doable as a hack, but it is not recommended. See if an "apt
repackaging helper" exists.
| If you want to check your install of keras on 4.5 please, run the code
| below and confirm if it works and report on github. It should take
| under 1min.
I am traveling a continent over, and am a little pressed for time (and may
not have reticulate setup on the laptop I travel with). And as I mentioned,
this thread is getting a little astray of the initial question.
You work for one of the country's largest corporations, maybe your IT
department can help you with your particular need? The reticulate help at
the GH repo is also good (many old questions you can search).
Good luck, Dirk
| I started an issue here:
| https://github.com/rstudio/tensorflow.rstudio.com/issues/80
|
| ```
| library(keras)
|
| imdb <- dataset_imdb(num_words = 10001)
| train_data <- imdb$train$x
| train_labels <- imdb$train$y
| test_data <- imdb$test$x
| test_labels <- imdb$test$y
|
| vector2 <- function(sequences, dimension = 10000){
| results <- array(0, dim = c(length(sequences), dimension))
| for(i in seq_along(sequences)){
| results[i,sequences[[i]]] <- 1
| }
| results
| }
|
| X <- vector2(train_data)
| Xt <- vector2(test_data)
| y <- as.numeric(train_labels)
| yt <- as.numeric(test_labels)
| Xv <- X[1:10000, ]
| Xp <- X[-(1:10000), ]
| yv <- y[seq(10000)]
| yp <- y[-seq(10000)]
|
| model <- keras_model_sequential() %>%
| layer_dense(16, activation = "relu") %>%
| layer_dense(16, activation = "relu") %>%
| layer_dense(1, activation = "sigmoid")
|
|
| model %>% compile(optimizer = "rmsprop",
| loss = "binary_crossentropy",
| metrics = "accuracy")
|
|
| history <- model %>% fit( Xp, yp, epochs = 20, batch_size = 512,
| validation_data = list(Xv, yv)
| )
| ```
|
| On Wed, 2025-05-14 at 17:20 -0500, Dirk Eddelbuettel wrote:
| > >
| > > Stephen,
| > >
| > > Sorry to hear that. I am not sure that hijacking an existing thread
| > > > here is
| > > the best idea -- this is now also deep into reticulate territory, >
| > > will depend
| > > on how you run Python on the box and more.? For what it is worth, >
| > > still works
| > > here
| > >
| > > ??? > library("keras")
| > > ??? > library("tensorflow")
| > > ??? > search()
| > > ???? [1] ".GlobalEnv"???????? "package:tensorflow" >
| > > "package:keras"????
| > > ???? [4] "ESSR"?????????????? "package:stats"????? >
| > > "package:graphics"?
| > > ???? [7] "package:grDevices"? "package:utils"????? >
| > > "package:datasets"?
| > > ??? [10] "package:methods"??? "Autoloads"????????? >
| > > "package:base"?????
| > > ??? >
| > >
| > > Might be best start over with 'reticulate 101', ie whether you can
| > > > access
| > > Python, test whether you can load the required packages in your >
| > > Python
| > > session and so on.
| > >
| > > Good luck,? Dirk
| > >
|
dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
Hi,
I am a rank beginner to all this, and all this is way above my depth. Very hesitantly, I am offering a solution.
I have worked with tensorflow on windows. I have learnt that the package is not compatible with the latest updates of python and other dependency packages. One solution is with the uv system and with the py_require() command which installs only those versions that are compatible. In R:
library(reticulate)
remotes::install_github("rstudio/tensorflow")
## try the same for keras
Sys.setenv("RETICULATE_PYTHON" = "managed") # this limits the versions that are compatible
reticulate::py_require(exclude_newer = "2025-03-11")
library(tensorflow)
tf$version$VERSION
#> [1] "2.18.0"
tf$constant("Hello World")
#> tf.Tensor(b'Hello World', shape=(), dtype=string)
Please try. No guarantee at all that this will work. Or even that it makes sense.
Cheers, Ravi
On Saturday, 17 May 2025 at 10:21:37 CEST, Dirk Eddelbuettel <edd at debian.org> wrote:
Stephen,
On 16 May 2025 at 14:33, Stephen Bond wrote:
| Dirk,
|
| I appreciate your help. Please, tell me what folders R installs into. I
| have a good working 4.3 on another box and want to copy over the 4.5 as
| this is my fastest box and it is a shame not to use it.
That may be doable as a hack, but it is not recommended. See if an "apt
repackaging helper" exists.
| If you want to check your install of keras on 4.5 please, run the code
| below and confirm if it works and report on github. It should take
| under 1min.
I am traveling a continent over, and am a little pressed for time (and may
not have reticulate setup on the laptop I travel with). And as I mentioned,
this thread is getting a little astray of the initial question.
You work for one of the country's largest corporations, maybe your IT
department can help you with your particular need?? The reticulate help at
the GH repo is also good (many old questions you can search).
Good luck,? Dirk
| I started an issue here:
| https://github.com/rstudio/tensorflow.rstudio.com/issues/80
|
| ```
| library(keras)
|
| imdb <- dataset_imdb(num_words = 10001)
| train_data <- imdb$train$x
| train_labels <- imdb$train$y
| test_data <- imdb$test$x
| test_labels <- imdb$test$y
|
| vector2 <- function(sequences, dimension = 10000){
|? results <- array(0, dim = c(length(sequences), dimension))
|? for(i in seq_along(sequences)){
|? results[i,sequences[[i]]] <- 1
|? }
|? results
| }
|
| X <- vector2(train_data)
| Xt <- vector2(test_data)
| y <- as.numeric(train_labels)
| yt <- as.numeric(test_labels)
| Xv <- X[1:10000, ]
| Xp <- X[-(1:10000), ]
| yv <- y[seq(10000)]
| yp <- y[-seq(10000)]
|
| model <- keras_model_sequential() %>%
|? layer_dense(16, activation = "relu") %>%
|? layer_dense(16, activation = "relu") %>%
|? layer_dense(1, activation = "sigmoid")
|
|
| model %>% compile(optimizer = "rmsprop",
|? ? ? ? ? ? ? ? ? loss = "binary_crossentropy",
|? ? ? ? ? ? ? ? ? metrics = "accuracy")
|
|
| history <- model %>% fit( Xp, yp, epochs = 20, batch_size = 512,
|? validation_data = list(Xv, yv)
| )
| ```
|
| On Wed, 2025-05-14 at 17:20 -0500, Dirk Eddelbuettel wrote:
| > >
| > > Stephen,
| > >
| > > Sorry to hear that. I am not sure that hijacking an existing thread
| > > > here is
| > > the best idea -- this is now also deep into reticulate territory, >
| > > will depend
| > > on how you run Python on the box and more.? For what it is worth, >
| > > still works
| > > here
| > >
| > > ??? > library("keras")
| > > ??? > library("tensorflow")
| > > ??? > search()
| > > ???? [1] ".GlobalEnv"???????? "package:tensorflow" >
| > > "package:keras"????
| > > ???? [4] "ESSR"?????????????? "package:stats"????? >
| > > "package:graphics"?
| > > ???? [7] "package:grDevices"? "package:utils"????? >
| > > "package:datasets"?
| > > ??? [10] "package:methods"??? "Autoloads"????????? >
| > > "package:base"?????
| > > ??? >
| > >
| > > Might be best start over with 'reticulate 101', ie whether you can
| > > > access
| > > Python, test whether you can load the required packages in your >
| > > Python
| > > session and so on.
| > >
| > > Good luck,? Dirk
| > >
|
dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
_______________________________________________
R-SIG-Debian mailing list
R-SIG-Debian at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-debian