Why does installing basic R libraries on AWS Ubuntu Linux fail?

I have been trying to install R libraries for days now on new AWS instances (making sure I always start clean), but the installing libraries in to R fails.

For example, library "erer" and even some of its dependent libraries.

I could also not install "car".

Below is a detailed interaction from my attempts today (Sunday, May 18, 2025) creating a brand new AWS ubuntu linux server.

I would greatly appreciate any help as I've tried everything I can think of.

Thanks.


DETAILED STEPS:

Create new unbuntu t3.large, 8 GB RAM, 25 GB Disk
Connect with SSH Client

Did a "sudo apt update && sudo apt upgrade -y"

Install R
sudo apt install -y dirmngr gnupg apt-transport-https ca-certificates software-properties-common

Add the CRAN GPG Key
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys '51716619E084DAB9'

Add the CRAN Repo
sudo apt install -y software-properties-common dirmngr

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
software-properties-common is already the newest version (0.99.49.2).
software-properties-common set to manually installed.
dirmngr is already the newest version (2.4.4-2ubuntu17.2).
dirmngr set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

Install R
sudo apt update
sudo apt install -y r-base

(long display but no errors)

Get R version:

$ R --version
R version 4.3.3 (2024-02-29) -- "Angel Food Cake"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
https://www.gnu.org/licenses/.

Install System Libraries

sudo apt install -y libcurl4-openssl-dev libssl-dev libxml2-dev libxt-dev libjpeg-dev
(no errors)

Try to install "erer" R library:

$ sudo R

install.packages("erer", dependencies=TRUE)

Errors or warnings (examples):

./inst/include/Eigen/src/Core/arch/SSE/Complex.h:298:1: note: in expansion of macro 'EIGEN_MAKE_CONJ_HELPER_CPLX_REAL'
298 | EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet1cd,Packet2d)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../inst/include/Eigen/Core:165:
../inst/include/Eigen/src/Core/util/XprHelper.h: In instantiation of 'struct Eigen::internal::find_best_packet<float, 4>':
../inst/include/Eigen/src/Core/Matrix.h:22:57: required from 'struct Eigen::internal::traits<Eigen::Matrix<float, 4, 1> >'
../inst/include/Eigen/src/Geometry/Quaternion.h:266:49: required from 'struct Eigen::internal::traits<Eigen::Quaternion >'
../inst/include/Eigen/src/Geometry/arch/Geometry_SIMD.h:24:46: required from here
../inst/include/Eigen/src/Core/util/XprHelper.h:190:44: warning: ignoring attributes on template argument 'Eigen::internal::packet_traits::typ' {aka '__m128'} [-Wignored-attributes]
190 | bool Stop = Size==Dynamic || (Size%unpacket_traits::size)==0 || is_same<PacketType,typename unpacket_traits::half>::value>
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../inst/include/Eigen/src/Core/util/XprHelper.h:190:83: warning: ignoring attributes on template argument 'Eigen::internal::packet_traits::typ' {aka '__m128'} [-Wignored-attributes]
190 | Dynamic || (Size%unpacket_traits::size)==0 || is_same<PacketType,typename unpacket_traits::half>::value>
| ~^~~~~~~~~~~~~~~~~~

../inst/include/Eigen/src/Core/util/XprHelper.h:190:83: warning: ignoring attributes on template argument 'Eigen::internal::packet_traits::typ' {aka '__m128'} [-Wignored-attributes]
../inst/include/Eigen/src/Core/util/XprHelper.h:190:83: warning: ignoring attributes on template argument 'Eigen::internal::unpacket_traits<__vector(4) float>::half' {aka '__m128'} [-Wignored-attributes]
../inst/include/Eigen/src/Core/util/XprHelper.h:208:88: warning: ignoring attributes on template argument 'Eigen::internal::packet_traits::typ' {aka '__m128'} [-Wignored-attributes]
208 | st_packet_helper<Size,typename packet_traits::type>::type type;
| ^~~~

R library "erer" installation continued...

At end, had these messages:

Warning messages:
1: In install.packages("erer", dependencies = TRUE) :
** installation of package 'nloptr' had non-zero exit status**
2: In install.packages("erer", dependencies = TRUE) :
** installation of package 'lme4' had non-zero exit status**
3: In install.packages("erer", dependencies = TRUE) :
** installation of package 'pbkrtest' had non-zero exit status**
4: In install.packages("erer", dependencies = TRUE) :
** installation of package 'car' had non-zero exit status**
5: In install.packages("erer", dependencies = TRUE) :
** installation of package 'systemfit' had non-zero exit status**
6: In install.packages("erer", dependencies = TRUE) :
** installation of package 'erer' had non-zero exit status**

Test to see if library erer is running/installed:

library(erer)

**Result: **
> library(erer)
Error in library(erer) : there is no package called 'erer'

Try to install one of the above (nloptr) separately.

lots of warnings like:

src/operation.hpp:141:7: warning: 'T Sass::Operation_CRTP<T, D>::operator((Sass::MediaRule*) [with T = Sass::Expression*; D = Sass::Eval]' was hidden [-Woverloaded-virtual=]
141 | T operator()(MediaRule* x) { return static_cast<D*>(this)->fallback(x); }
| ^~~~~~~~
src/eval.hpp:96:17: note: by 'Sass::Eval::operator()'
96 | Expression* operator()(Parent_Reference*);
| ^~~~~~~~
src/operation.hpp:140:7: warning: 'T Sass::Operation_CRTP<T, D>::operator((Sass::SupportsRule*) [with T = Sass::Expression*; D = Sass::Eval]' was hidden [-Woverloaded-virtual=]
140 | T operator()(SupportsRule* x) { return static_cast<D*>(this)->fallback(x); }
| ^~~~~~~~
src/eval.hpp:96:17: note: by 'Sass::Eval::operator()'
96 | Expression* operator()(Parent_Reference*);
| ^~~~~~~~
src/operation.hpp:139:7: warning: 'T Sass::Operation_CRTP<T, D>::operator((Sass::Trace*) [with T = Sass::Expression*; D = Sass::Eval]' was hidden [-Woverloaded-virtual=]
139 | T operator()(Trace* x) { return static_cast<D*>(this)->fallback(x); }
| ^~~~~~~~
src/eval.hpp:96:17: note: by 'Sass::Eval::operator()'
96 | Expression* operator()(Parent_Reference*);
| ^~~~~~~~
src/operation.hpp:138:7: warning: 'T Sass::Operation_CRTP<T, D>::operator((Sass::Bubble*) [with T = Sass::Expression*; D = Sass::Eval]' was hidden [-Woverloaded-virtual=]
138 | T operator()(Bubble* x) { return static_cast<D*>(this)->fallback(x); }
| ^~~~~~~~
src/eval.hpp:96:17: note: by 'Sass::Eval::operator()'
96 | Expression* operator()(Parent_Reference*);
| ^~~~~~~~
src/operation.hpp:137:7: warning: 'T Sass::Operation_CRTP<T, D>::operator((Sass::StyleRule*) [with T = Sass::Expression*; D = Sass::Eval]' was hidden [-Woverloaded-virtual=]
137 | T operator()(StyleRule* x) { return static_cast<D*>(this)->fallback(x); }
| ^~~~~~~~
src/eval.hpp:96:17: note: by 'Sass::Eval::operator()'
96 | Expression* operator()(Parent_Reference*);
| ^~~~~~~~
src/operation.hpp:134:7: warning: 'T Sass::Operation_CRTP<T, D>::operator((Sass::AST_Node*) [with T = Sass::Expression*; D = Sass::Eval]' was hidden [-Woverloaded-virtual=]
134 | T operator()(AST_Node* x) { return static_cast<D*>(this)->fallback(x); }

... installation continues...

End result:

The downloaded source packages are in
'/tmp/Rtmppn2Nu6/downloaded_packages'
Warning message:
In install.packages("nloptr", dependencies = TRUE) :
** installation of package 'nloptr' had non-zero exit status**


Test install:

> library(nloptr)
Error in library(nloptr) : there is no package called 'nloptr'

Are there any error (as opposed to warning) messages in the nloptr output? In particular, do you see any messages saying a header file (blahblah.h) cannot be found? That would indicate a missing system library.

1 Like

Mostly warnings. I noticed I didn't have "cmake" installed. I think that's making a difference. Running everything now, but as you know, it takes a LONG time to install some of these libraries (like "klaR").

It will be great if I can get past the multi-day setup and actually do some work. What a concept!

Will report back.

Thanks!

Please take a moment to go through FAQ: Is it OK if I cross-post? before corss-posting ( https://stackoverflow.com/questions/79627521/why-wont-r-install-some-basic-libraries , https://www.reddit.com/r/rstats/)

From your comments on SO, may we assume you opted for r2u and got it working?

Sorry about the cross-posting.

No r2u didn't work I believe because I did not have cmake installed.

Once I installed cmake, I still got a few warnings, but was able to get all the R libraries installed using the regular R install syntax.

Thanks very much for your reply.