(as ‘lib’ is unspecified)

I'm trying to add ggplot2 package using rsudio console.
I got the following message :

install.packages("ggplot2")
Installation du package dans ‘/home/user/R/x86_64-pc-linux-gnu-library/4.1’
(car ‘lib’ n'est pas spécifié)
essai de l'URL 'https://cloud.r-project.org/src/contrib/ggplot2_3.3.5.tar.gz'
Content type 'application/x-gzip' length 3063309 bytes (2.9 MB)
==================================================
downloaded 2.9 MB

* installing *source* package ‘ggplot2’ ...
** package ‘ggplot2’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
Erreur : le package ‘gtable’ a été installé avant R 4.0.0 : veuillez le réinstaller, s'il-vous-plait
Exécution arrêtée
ERROR: lazy loading failed for package ‘ggplot2’
* removing ‘/home/user/R/x86_64-pc-linux-gnu-library/4.1/ggplot2’
Warning in install.packages :
  installation of package ‘ggplot2’ had non-zero exit status

The downloaded source packages are in
	‘/tmp/RtmpliCdtG/downloaded_packages’

I can't install any package.
How can I solve this problem ?

the 'gtable' package was installed before R 4.0.0: please reinstall it
install.packages("gtable")
Installation du package dans ‘/home/user/R/x86_64-pc-linux-gnu-library/4.1’
(car ‘lib’ n'est pas spécifié)
essai de l'URL 'https://cloud.r-project.org/src/contrib/gtable_0.3.0.tar.gz'
Content type 'application/x-gzip' length 368081 bytes (359 KB)
==================================================
downloaded 359 KB

* installing *source* package ‘gtable’ ...
** package ‘gtable’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (gtable)

The downloaded source packages are in
	‘/tmp/RtmpN1HUFD/downloaded_packages’

so now that you repaired gtable you can try again .

Ok. I still have this message:

install.packages("ggplot2")
Installation du package dans ‘/home/user/R/x86_64-pc-linux-gnu-library/4.1’
(car ‘lib’ n'est pas spécifié)
essai de l'URL 'https://cloud.r-project.org/src/contrib/ggplot2_3.3.5.tar.gz'
Content type 'application/x-gzip' length 3063309 bytes (2.9 MB)
==================================================
downloaded 2.9 MB

* installing *source* package ‘ggplot2’ ...
** package ‘ggplot2’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
Erreur : le package ‘rlang’ a été installé avant R 4.0.0 : veuillez le réinstaller, s'il-vous-plait
Exécution arrêtée
ERROR: lazy loading failed for package ‘ggplot2’
* removing ‘/home/user/R/x86_64-pc-linux-gnu-library/4.1/ggplot2’
Warning in install.packages :
  installation of package ‘ggplot2’ had non-zero exit status

The downloaded source packages are in
	‘/tmp/RtmpN1HUFD/downloaded_packages’

repeat the pattern.
this time its not gtable but rlang.
alternatively you can do update.packages() to try update all your packages at once.

install.packages("rlang")
Installation du package dans ‘/home/user/R/x86_64-pc-linux-gnu-library/4.1’
(car ‘lib’ n'est pas spécifié)
essai de l'URL 'https://cloud.r-project.org/src/contrib/rlang_0.4.11.tar.gz'
Content type 'application/x-gzip' length 861727 bytes (841 KB)
==================================================
downloaded 841 KB

* installing *source* package ‘rlang’ ...
** package ‘rlang’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I./lib/    -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c capture.c -o capture.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I./lib/    -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c export.c -o export.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I./lib/    -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c internal.c -o internal.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I./lib/    -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c lib.c -o lib.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I./lib/    -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c version.c -o version.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o rlang.so capture.o export.o internal.o lib.o version.o -L/usr/lib/R/lib -lR
installing to /home/user/R/x86_64-pc-linux-gnu-library/4.1/00LOCK-rlang/00new/rlang/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (rlang)

The downloaded source packages are in
	‘/tmp/RtmpN1HUFD/downloaded_packages’

I'm not sure what level of explanation would help you the most. Simply put, advanced packages often rely on other packages to provide their function. Normally when you install such a package, the packages on which it depends are identified and installed as you need them. You can get into trouble though, if you have previously installed versions of packages that are not now the ones you need. Hence this pattern of reinstalling the dependencies in a manual fashion, until you are ready to install the package that is your goal.
To continue following this pattern do as we have done. having installed gtable and rlang,.. now try again to install your goal package, and watch for messages.
(or update all your packages at once and then try your goal - update.packages)
(or use a package manager that can do a lot for you, like renv)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.