Skip to content

Error: package ‘###’ was installed before R 4.0.0: please re-install it #129

Closed
@domi84

Description

@domi84

Issue:
I am using university server, we are allowed to use conda enviroment. I need to install a R package R>=4.0 with github, so I need to use devtools.
I made a new conda environment, installed r-base v4 via conda-forge, installed r-devtools build for R4, then I start R, but when I got an error:

> devtools::install_github("HelenaLC/muscat", ref = "master")
Error: package ‘devtools’ was installed before R 4.0.0: please re-install it

and I am getting this error for every package I try to load:

> library(cli)
Error: package or namespace load failed for ‘cli’:
 package ‘cli’ was installed before R 4.0.0: please re-install it
> library(devtools)
Loading required package: usethis
Error: package or namespace load failed for ‘usethis’:
 package ‘usethis’ was installed before R 4.0.0: please re-install it
Error: package ‘usethis’ could not be loaded
> library(tidyverse)
Error: package or namespace load failed for ‘tidyverse’:
 package ‘tidyverse’ was installed before R 4.0.0: please re-install it

Environment (conda list):
$ conda list
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                      1_llvm    conda-forge
_r-mutex                  1.0.1               anacondar_1    conda-forge
attrs                     19.3.0                     py_0    conda-forge
backcall                  0.1.0                      py_0    conda-forge
binutils_impl_linux-64    2.34                 h53a641e_0    conda-forge
binutils_linux-64         2.34                hc952b39_18    conda-forge
bleach                    3.1.5              pyh9f0ad1d_0    conda-forge
bwidget                   1.9.14                        0    conda-forge
bzip2                     1.0.8                h516909a_2    conda-forge
ca-certificates           2020.4.5.1           hecc5488_0    conda-forge
cairo                     1.16.0            hcf35c78_1003    conda-forge
certifi                   2020.4.5.1       py38h32f6830_0    conda-forge
curl                      7.69.1               h33f0ec9_0    conda-forge
decorator                 4.4.2                      py_0    conda-forge
defusedxml                0.6.0                      py_0    conda-forge
entrypoints               0.3             py38h32f6830_1001    conda-forge
fontconfig                2.13.1            h86ecdb6_1001    conda-forge
freetype                  2.10.1               he06d7ca_0    conda-forge
fribidi                   1.0.9                h516909a_0    conda-forge
gcc_impl_linux-64         7.3.0                hd420e75_5    conda-forge
gcc_linux-64              7.3.0               h553295d_18    conda-forge
gettext                   0.19.8.1          hc5be6a0_1002    conda-forge
gfortran_impl_linux-64    7.3.0                hdf63c60_5    conda-forge
gfortran_linux-64         7.3.0               h553295d_18    conda-forge
glib                      2.64.2               h6f030ca_0    conda-forge
graphite2                 1.3.13            he1b5a44_1001    conda-forge
gsl                       2.6                  h294904e_0    conda-forge
gxx_impl_linux-64         7.3.0                hdf63c60_5    conda-forge
gxx_linux-64              7.3.0               h553295d_18    conda-forge
harfbuzz                  2.4.0                h9f30f68_3    conda-forge
icu                       64.2                 he1b5a44_1    conda-forge
importlib-metadata        1.6.0            py38h32f6830_0    conda-forge
importlib_metadata        1.6.0                         0    conda-forge
ipykernel                 5.2.1            py38h23f93f0_0    conda-forge
ipython                   7.14.0           py38h32f6830_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
jedi                      0.17.0           py38h32f6830_0    conda-forge
jinja2                    2.11.2             pyh9f0ad1d_0    conda-forge
jpeg                      9c                h14c3975_1001    conda-forge
jsonschema                3.2.0            py38h32f6830_1    conda-forge
jupyter_client            6.1.3                      py_0    conda-forge
jupyter_core              4.6.3            py38h32f6830_1    conda-forge
krb5                      1.17.1               h2fd8d38_0    conda-forge
ld_impl_linux-64          2.34                 h53a641e_0    conda-forge
libblas                   3.8.0               16_openblas    conda-forge
libcblas                  3.8.0               16_openblas    conda-forge
libcurl                   7.69.1               hf7181ac_0    conda-forge
libedit                   3.1.20170329      hf8c457e_1001    conda-forge
libffi                    3.2.1             he1b5a44_1007    conda-forge
libgcc-ng                 9.2.0                h24d8f2e_2    conda-forge
libgfortran-ng            7.3.0                hdf63c60_5    conda-forge
libgomp                   9.2.0                h24d8f2e_2    conda-forge
libiconv                  1.15              h516909a_1006    conda-forge
liblapack                 3.8.0               16_openblas    conda-forge
libopenblas               0.3.9                h5ec1e0e_0    conda-forge
libpng                    1.6.37               hed695b0_1    conda-forge
libsodium                 1.0.17               h516909a_0    conda-forge
libssh2                   1.8.2                h22169c7_2    conda-forge
libstdcxx-ng              9.2.0                hdf63c60_2    conda-forge
libtiff                   4.1.0                hc7e4089_6    conda-forge
libuuid                   2.32.1            h14c3975_1000    conda-forge
libwebp-base              1.1.0                h516909a_3    conda-forge
libxcb                    1.13              h14c3975_1002    conda-forge
libxml2                   2.9.10               hee79883_0    conda-forge
llvm-openmp               10.0.0               hc9558a2_0    conda-forge
lz4-c                     1.9.2                he1b5a44_1    conda-forge
make                      4.3                  h516909a_0    conda-forge
markupsafe                1.1.1            py38h1e0a361_1    conda-forge
mistune                   0.8.4           py38h1e0a361_1001    conda-forge
nbconvert                 5.6.1            py38h32f6830_1    conda-forge
nbformat                  5.0.6                      py_0    conda-forge
ncurses                   6.1               hf484d3e_1002    conda-forge
notebook                  6.0.3            py38h32f6830_0    conda-forge
openssl                   1.1.1g               h516909a_0    conda-forge
packaging                 20.1                       py_0    conda-forge
pandoc                    2.9.2.1                       0    conda-forge
pandocfilters             1.4.2                      py_1    conda-forge
pango                     1.42.4               h7062337_4    conda-forge
parso                     0.7.0              pyh9f0ad1d_0    conda-forge
pcre                      8.44                 he1b5a44_0    conda-forge
pcre2                     10.34                h2f06484_0    conda-forge
pexpect                   4.8.0            py38h32f6830_1    conda-forge
pickleshare               0.7.5           py38h32f6830_1001    conda-forge
pip                       20.1               pyh9f0ad1d_0    conda-forge
pixman                    0.38.0            h516909a_1003    conda-forge
prometheus_client         0.7.1                      py_0    conda-forge
prompt-toolkit            3.0.5                      py_0    conda-forge
pthread-stubs             0.4               h14c3975_1001    conda-forge
ptyprocess                0.6.0                   py_1001    conda-forge
pygments                  2.6.1                      py_0    conda-forge
pyparsing                 2.4.7              pyh9f0ad1d_0    conda-forge
pyrsistent                0.16.0           py38h1e0a361_0    conda-forge
python                    3.8.2           he5300dc_7_cpython    conda-forge
python-dateutil           2.8.1                      py_0    conda-forge
python_abi                3.8                      1_cp38    conda-forge
pyzmq                     19.0.1           py38ha71036d_0    conda-forge
r-askpass                 1.1               r40hcdcec82_2    conda-forge
r-assertthat              0.2.1             r40h6115d3f_2    conda-forge
r-backports               1.1.6             r40hcdcec82_2    conda-forge
r-base                    4.0.0                hdca8982_3    conda-forge
r-base64enc               0.1_3           r40hcdcec82_1004    conda-forge
r-boot                    1.3_25            r40h6115d3f_1    conda-forge
r-brew                    1.0_6           r40h6115d3f_1003    conda-forge
r-broom                   0.5.6             r40h6115d3f_1    conda-forge
r-callr                   3.4.3             r40h6115d3f_1    conda-forge
r-caret                   6.0_86            r40hcdcec82_2    conda-forge
r-cellranger              1.1.0           r40h6115d3f_1003    conda-forge
r-class                   7.3_17            r40hcdcec82_1    conda-forge
r-cli                     2.0.2             r40h6115d3f_1    conda-forge
r-clipr                   0.7.0             r40h6115d3f_1    conda-forge
r-cluster                 2.1.0             r40h9bbef5b_3    conda-forge
r-codetools               0.2_16          r40h6115d3f_1002    conda-forge
r-colorspace              1.4_1             r40hcdcec82_2    conda-forge
r-commonmark              1.7             r40hcdcec82_1002    conda-forge
r-covr                    3.5.0             r40h0357c0b_1    conda-forge
r-crayon                  1.3.4           r40h6115d3f_1003    conda-forge
r-crosstalk               1.1.0.1           r40h6115d3f_1    conda-forge
r-curl                    4.3               r40hcdcec82_1    conda-forge
r-data.table              1.12.8            r40hcdcec82_1    conda-forge
r-dbi                     1.1.0             r40h6115d3f_1    conda-forge
r-dbplyr                  1.4.3             r40h6115d3f_1    conda-forge
r-desc                    1.2.0           r40h6115d3f_1003    conda-forge
r-devtools                2.3.0             r40h6115d3f_1    conda-forge
r-digest                  0.6.25            r40h0357c0b_2    conda-forge
r-dplyr                   0.8.5             r40h0357c0b_1    conda-forge
r-dt                      0.13              r40h6115d3f_1    conda-forge
r-ellipsis                0.3.0             r40hcdcec82_1    conda-forge
r-essentials              4.0                    r40_2002    conda-forge
r-evaluate                0.14              r40h6115d3f_2    conda-forge
r-fansi                   0.4.1             r40hcdcec82_1    conda-forge
r-farver                  2.0.3             r40h0357c0b_1    conda-forge
r-fastmap                 1.0.1             r40h0357c0b_1    conda-forge
r-forcats                 0.5.0             r40h6115d3f_1    conda-forge
r-foreach                 1.5.0             r40h6115d3f_1    conda-forge
r-foreign                 0.8_79            r40hcdcec82_0    conda-forge
r-formatr                 1.7               r40h6115d3f_2    conda-forge
r-fs                      1.4.1             r40h0357c0b_1    conda-forge
r-generics                0.0.2           r40h6115d3f_1003    conda-forge
r-ggplot2                 3.3.0             r40h6115d3f_1    conda-forge
r-gh                      1.1.0             r40h6115d3f_1    conda-forge
r-gistr                   0.5.0             r40h6115d3f_1    conda-forge
r-git2r                   0.27.1            r40h7253d3a_0    conda-forge
r-glmnet                  3.0_2             r40h9bbef5b_1    conda-forge
r-glue                    1.4.0             r40hcdcec82_1    conda-forge
r-gower                   0.2.1             r40hcdcec82_2    conda-forge
r-gtable                  0.3.0             r40h6115d3f_3    conda-forge
r-haven                   2.2.0             r40hde08347_1    conda-forge
r-hexbin                  1.28.1            r40h9bbef5b_1    conda-forge
r-highr                   0.8               r40h6115d3f_2    conda-forge
r-hms                     0.5.3             r40h6115d3f_1    conda-forge
r-htmltools               0.4.0             r40h0357c0b_1    conda-forge
r-htmlwidgets             1.5.1             r40h6115d3f_1    conda-forge
r-httpuv                  1.5.2             r40h0357c0b_2    conda-forge
r-httr                    1.4.1             r40h6115d3f_2    conda-forge
r-ini                     0.3.1           r40h6115d3f_1003    conda-forge
r-ipred                   0.9_9             r40hcdcec82_2    conda-forge
r-irdisplay               0.7                    r40_1002    conda-forge
r-irkernel                1.1               r40h6115d3f_1    conda-forge
r-isoband                 0.2.1             r40h0357c0b_1    conda-forge
r-iterators               1.0.12            r40h6115d3f_1    conda-forge
r-jsonlite                1.6.1             r40hcdcec82_1    conda-forge
r-kernsmooth              2.23_17           r40hfa343cc_1    conda-forge
r-knitr                   1.28              r40h6115d3f_1    conda-forge
r-labeling                0.3             r40h6115d3f_1003    conda-forge
r-later                   1.0.0             r40h0357c0b_1    conda-forge
r-lattice                 0.20_41           r40hcdcec82_2    conda-forge
r-lava                    1.6.7             r40h6115d3f_1    conda-forge
r-lazyeval                0.2.2             r40hcdcec82_2    conda-forge
r-lifecycle               0.2.0             r40h6115d3f_1    conda-forge
r-lubridate               1.7.8             r40h0357c0b_1    conda-forge
r-magrittr                1.5             r40h6115d3f_1003    conda-forge
r-maps                    3.3.0           r40hcdcec82_1004    conda-forge
r-markdown                1.1               r40hcdcec82_1    conda-forge
r-mass                    7.3_51.6          r40hcdcec82_2    conda-forge
r-matrix                  1.2_18            r40h7fa42b6_3    conda-forge
r-memoise                 1.1.0           r40h6115d3f_1004    conda-forge
r-mgcv                    1.8_31            r40h7fa42b6_1    conda-forge
r-mime                    0.9               r40hcdcec82_1    conda-forge
r-modelmetrics            1.2.2.2           r40h0357c0b_1    conda-forge
r-modelr                  0.1.7             r40h6115d3f_1    conda-forge
r-munsell                 0.5.0           r40h6115d3f_1003    conda-forge
r-nlme                    3.1_147           r40h9bbef5b_1    conda-forge
r-nnet                    7.3_14            r40hcdcec82_1    conda-forge
r-numderiv                2016.8_1.1        r40h6115d3f_2    conda-forge
r-openssl                 1.4.1             r40he5c4762_1    conda-forge
r-pbdzmq                  0.3_3           r40h559a7a4_1003    conda-forge
r-pillar                  1.4.4             r40h6115d3f_0    conda-forge
r-pkgbuild                1.0.8             r40h6115d3f_0    conda-forge
r-pkgconfig               2.0.3             r40h6115d3f_1    conda-forge
r-pkgload                 1.0.2           r40h0357c0b_1002    conda-forge
r-plogr                   0.2.0           r40h6115d3f_1003    conda-forge
r-plyr                    1.8.6             r40h0357c0b_1    conda-forge
r-praise                  1.0.0           r40h6115d3f_1004    conda-forge
r-prettyunits             1.1.1             r40h6115d3f_1    conda-forge
r-proc                    1.16.2            r40h0357c0b_1    conda-forge
r-processx                3.4.2             r40hcdcec82_1    conda-forge
r-prodlim                 2019.11.13        r40h0357c0b_1    conda-forge
r-progress                1.2.2             r40h6115d3f_2    conda-forge
r-promises                1.1.0             r40h0357c0b_1    conda-forge
r-pryr                    0.1.4           r40h0357c0b_1004    conda-forge
r-ps                      1.3.3             r40hcdcec82_0    conda-forge
r-purrr                   0.3.4             r40hcdcec82_1    conda-forge
r-quantmod                0.4.17            r40h6115d3f_1    conda-forge
r-r6                      2.4.1             r40h6115d3f_1    conda-forge
r-randomforest            4.6_14          r40h9bbef5b_1003    conda-forge
r-rbokeh                  0.5.0           r40h6115d3f_1003    conda-forge
r-rcmdcheck               1.3.3             r40h6115d3f_3    conda-forge
r-rcolorbrewer            1.1_2           r40h6115d3f_1003    conda-forge
r-rcpp                    1.0.4.6           r40h0357c0b_1    conda-forge
r-readr                   1.3.1           r40h0357c0b_1004    conda-forge
r-readxl                  1.3.1             r40hde08347_4    conda-forge
r-recipes                 0.1.12            r40h6115d3f_1    conda-forge
r-recommended             4.0                    r40_1004    conda-forge
r-rematch                 1.0.1           r40h6115d3f_1003    conda-forge
r-rematch2                2.1.2             r40h6115d3f_1    conda-forge
r-remotes                 2.1.1             r40h6115d3f_1    conda-forge
r-repr                    1.1.0             r40h6115d3f_1    conda-forge
r-reprex                  0.3.0             r40h6115d3f_2    conda-forge
r-reshape2                1.4.4             r40h0357c0b_1    conda-forge
r-rex                     1.2.0             r40h6115d3f_1    conda-forge
r-rlang                   0.4.6             r40hcdcec82_0    conda-forge
r-rmarkdown               2.1               r40h6115d3f_1    conda-forge
r-roxygen2                7.1.0             r40h0357c0b_1    conda-forge
r-rpart                   4.1_15            r40hcdcec82_2    conda-forge
r-rprojroot               1.3_2           r40h6115d3f_1003    conda-forge
r-rstudioapi              0.11              r40h6115d3f_1    conda-forge
r-rversions               2.0.1             r40h6115d3f_1    conda-forge
r-rvest                   0.3.5             r40h6115d3f_1    conda-forge
r-scales                  1.1.0             r40h6115d3f_1    conda-forge
r-selectr                 0.4_2             r40h6115d3f_1    conda-forge
r-sessioninfo             1.1.1           r40h6115d3f_1002    conda-forge
r-shape                   1.4.4                  r40_1003    conda-forge
r-shiny                   1.4.0.2           r40h6115d3f_1    conda-forge
r-sourcetools             0.1.7           r40he1b5a44_1002    conda-forge
r-spatial                 7.3_12            r40hcdcec82_1    conda-forge
r-squarem                 2020.2            r40h6115d3f_1    conda-forge
r-stringi                 1.4.6             r40h0e574ca_2    conda-forge
r-stringr                 1.4.0             r40h6115d3f_2    conda-forge
r-survival                3.1_12            r40hcdcec82_1    conda-forge
r-sys                     3.3               r40hcdcec82_1    conda-forge
r-testthat                2.3.2             r40h0357c0b_1    conda-forge
r-tibble                  3.0.1             r40hcdcec82_1    conda-forge
r-tidyr                   1.0.3             r40h0357c0b_0    conda-forge
r-tidyselect              1.0.0             r40h6115d3f_1    conda-forge
r-tidyverse               1.3.0             r40h6115d3f_2    conda-forge
r-timedate                3043.102        r40h6115d3f_1002    conda-forge
r-tinytex                 0.22              r40h6115d3f_1    conda-forge
r-ttr                     0.23_6            r40hcdcec82_1    conda-forge
r-usethis                 1.6.1             r40h6115d3f_1    conda-forge
r-utf8                    1.1.4           r40hcdcec82_1003    conda-forge
r-uuid                    0.1_4             r40hcdcec82_1    conda-forge
r-vctrs                   0.2.4             r40hcdcec82_1    conda-forge
r-viridislite             0.3.0           r40h6115d3f_1003    conda-forge
r-whisker                 0.4               r40h6115d3f_1    conda-forge
r-withr                   2.2.0             r40h6115d3f_1    conda-forge
r-xfun                    0.13              r40h6115d3f_1    conda-forge
r-xml2                    1.3.2             r40h0357c0b_1    conda-forge
r-xopen                   1.0.0           r40h6115d3f_1003    conda-forge
r-xtable                  1.8_4             r40h6115d3f_3    conda-forge
r-xts                     0.12_0            r40hcdcec82_1    conda-forge
r-yaml                    2.2.1             r40hcdcec82_1    conda-forge
r-zeallot                 0.1.0           r40h6115d3f_1002    conda-forge
r-zoo                     1.8_8             r40hcdcec82_0    conda-forge
readline                  8.0                  hf8c457e_0    conda-forge
sed                       4.7               h1bed415_1000    conda-forge
send2trash                1.5.0                      py_0    conda-forge
setuptools                46.1.3           py38h32f6830_0    conda-forge
six                       1.14.0                     py_1    conda-forge
sqlite                    3.30.1               hcee41ef_0    conda-forge
terminado                 0.8.3            py38h32f6830_1    conda-forge
testpath                  0.4.4                      py_0    conda-forge
tk                        8.6.10               hed695b0_0    conda-forge
tktable                   2.10                 h555a92e_3    conda-forge
tornado                   6.0.4            py38h1e0a361_1    conda-forge
traitlets                 4.3.3            py38h32f6830_1    conda-forge
wcwidth                   0.1.9              pyh9f0ad1d_0    conda-forge
webencodings              0.5.1                      py_1    conda-forge
wheel                     0.34.2                     py_1    conda-forge
xorg-kbproto              1.0.7             h14c3975_1002    conda-forge
xorg-libice               1.0.10               h516909a_0    conda-forge
xorg-libsm                1.2.3             h84519dc_1000    conda-forge
xorg-libx11               1.6.9                h516909a_0    conda-forge
xorg-libxau               1.0.9                h14c3975_0    conda-forge
xorg-libxdmcp             1.1.3                h516909a_0    conda-forge
xorg-libxext              1.3.4                h516909a_0    conda-forge
xorg-libxrender           0.9.10            h516909a_1002    conda-forge
xorg-renderproto          0.11.1            h14c3975_1002    conda-forge
xorg-xextproto            7.3.0             h14c3975_1002    conda-forge
xorg-xproto               7.0.31            h14c3975_1007    conda-forge
xz                        5.2.5                h516909a_0    conda-forge
zeromq                    4.3.2                he1b5a44_2    conda-forge
zipp                      3.1.0                      py_0    conda-forge
zlib                      1.2.11            h516909a_1006    conda-forge
zstd                      1.4.4                h6597ccf_3    conda-forge

Details about conda and system ( conda info ):
$ conda info
     active environment : muscatR4_2
    active env location : /export/home2/#####/.conda/envs/muscatR4_2
            shell level : 1
       user config file : /export/home2/#####/.condarc
 populated config files : /export/home2/#####/.condarc
          conda version : 4.8.3
    conda-build version : 3.18.11
         python version : 3.7.6.final.0
       virtual packages : __glibc=2.17
       base environment : /export/home/#####/anaconda3  (writable)
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /export/home/#####/anaconda3/pkgs
                          /export/home2/#####/.conda/pkgs
       envs directories : /export/home/#####/anaconda3/envs
                          /export/home2/#####/.conda/envs
               platform : linux-64
             user-agent : conda/4.8.3 requests/2.22.0 CPython/3.7.6 Linux/3.10.0-957.12.2.el7.x86_64 centos/7.6.1810 glibc/2.17
                UID:GID : 65363:65363
             netrc file : None
           offline mode : False

Did I do anything wrong?
Thanks

Activity

jdblischak

jdblischak commented on May 11, 2020

@jdblischak
Member

@domi84 What do you get when you run .libPaths()? You correctly installed the conda R packages for R 4.0, so it appears that your packages are being loaded from a different directory that contains packages built with R 3.x.

bgruening

bgruening commented on May 11, 2020

@bgruening
Contributor

@domi84 maybe it helps if you create a fresh environment with conda create -n r4 r-base=4.0 r-devtools -y. This is working for me.

domi84

domi84 commented on May 12, 2020

@domi84
Author

Thanks for your replies.

@jdblischak

(muscatR4_2) #####@bioinf##:~$ R

R version 4.0.0 (2020-04-24) -- "Arbor Day"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-conda_cos6-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> .libPaths()
[1] "/usr/lib64/R/library"
[2] "/usr/share/R/library"
[3] "/export/projects/##-data/common/R-packages"
[4] "/export/home2/#####/R/x86_64-conda_cos6-linux-gnu-library/4.0"
[5] "/export/home2/#####/.conda/envs/muscatR4_2/lib/R/library"

> library(devtools)
Loading required package: usethis
Error: package or namespace load failed for ‘usethis’:
 package ‘usethis’ was installed before R 4.0.0: please re-install it
Error: package ‘usethis’ could not be loaded

> library(devtools, lib.loc=.libPaths()[5])
Error: package ‘usethis’ 1.5.1 was found, but >= 1.6.0 is required by ‘devtools’
In addition: Warning message:
version 1.6.1 of ‘usethis’ masked by 1.5.1 in /export/projects/##-data/common/R-packages

Do you think the issue is due to this?

@bgruening
I've done it, same issue

(r4) #####@bioinf##:~$ R

R version 4.0.0 (2020-04-24) -- "Arbor Day"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-conda_cos6-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(devtools)
Loading required package: usethis
Error: package or namespace load failed for ‘usethis’:
 package ‘usethis’ was installed before R 4.0.0: please re-install it
Error: package ‘usethis’ could not be loaded
jdblischak

jdblischak commented on May 12, 2020

@jdblischak
Member

Do you think the issue is due to this?

@domi84 Yes, this issue is caused by your library paths. All of your conda R packages (built for R 4.0) are in /export/home2/#####/.conda/envs/muscatR4_2/lib/R/library. This is the last entry in your library paths, so packages in this directory are only used if they aren't found in the preceding 4.

Thus when you run library(devtools), it is trying to load a version built with R 3.x. You can find the exact package it is loading by running find.package("devtools").

The same thing is happening with usethis. When you run library(devtools, lib.loc=.libPaths()[5]), it grabs the correct devtools. But then it grabs the first usethis it finds, hence the warning message. You have version 1.6.1 installed (as confirmed by conda list).

In addition: Warning message:
version 1.6.1 of ‘usethis’ masked by 1.5.1 in /export/projects/##-data/common/R-packages

The fact that a conda environment is not isolated from the system R packages is a surprise for many conda R users, myself included. See discussion in #37. I've done my best to fix the problem in Pull Request #65, but I've never managed to get enough momentum with enough conda developers to get it merged.

Your situation is an extreme case. Usually there is only one user directory that comes in front of the conda directory. Do you have R_LIBS_USER or R_LIBS defined in ~/.Renviron or ~/.bashrc?

isuruf

isuruf commented on May 12, 2020

@isuruf
Member

As far as I can see, #65 only removes folders with 4.0 in them, so this is a different issue.

domi84

domi84 commented on May 12, 2020

@domi84
Author

@jdblischak Wow. I didn't imagine that.
Yes, I can see what you mean

> find.package("devtools")
[1] "/export/projects/##-data/common/R-packages/devtools"
> find.package("usethis")
[1] "/export/projects/##-data/common/R-packages/usethis"

I don't have a ~/.Renviron but there is ~/.bashrc

#####@bioinf##:~$ nano ~/.bashrc
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/export/projects/bioinfo#/to16r/bin/conda/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/export/projects/bioinfo#/to16r/bin/conda/etc/profile.d/conda.sh" ]; then
        . "/export/projects/bioinfo#/to16r/bin/conda/etc/profile.d/conda.sh"
    else
        export PATH="/export/projects/bioinfo#/to16r/bin/conda/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<
jdblischak

jdblischak commented on May 12, 2020

@jdblischak
Member

As far as I can see, #65 only removes folders with 4.0 in them, so this is a different issue.

@isuruf It also temporarily disables the environment variable R_LIBS_USER. Somehow in this case the conda version of R is finding these other library directories. This shouldn't be happening in a standard R setup, so some system setting is interfering.

I don't have a ~/.Renviron but there is ~/.bashrc

@domi84 To help us troubleshoot, could you please run the following commands and report the results? Please try running them with and without the conda environment activated:

echo $R_LIBS_USER
echo $R_LIBS
Rscript -e 'Sys.getenv("R_LIBS_USER")'
Rscript -e 'Sys.getenv("R_LIBS")'
Rscript -e 'Sys.getenv("R_LIBS_SITE")'
domi84

domi84 commented on May 12, 2020

@domi84
Author

@jdblischak Thanks

#####@bioinf##:~$ echo $R_LIBS_USER

#####@bioinf##:~$ echo $R_LIBS
/usr/lib64/R/library:/usr/share/R/library:/export/projects/##-data/common/R-packages
#####@bioinf##:~$ Rscript -e 'Sys.getenv("R_LIBS_USER")'
[1] "~/R/x86_64-redhat-linux-gnu-library/3.6"
#####@bioinf##:~$ Rscript -e 'Sys.getenv("R_LIBS")'
[1] "/usr/lib64/R/library:/usr/share/R/library:/export/projects/##-data/common/R-packages"
#####@bioinf##:~$ Rscript -e 'Sys.getenv("R_LIBS_SITE")'
[1] "/usr/local/lib/R/site-library:/usr/local/lib/R/library:/usr/lib64/R/library:/usr/share/R/library"
(muscatR4_2) #####@bioinf##:~$ echo $R_LIBS_USER

(muscatR4_2) #####@bioinf##:~$ echo $R_LIBS
/usr/lib64/R/library:/usr/share/R/library:/export/projects/##-data/common/R-packages
(muscatR4_2) #####@bioinf##:~$ Rscript -e 'Sys.getenv("R_LIBS_USER")'
[1] "~/R/x86_64-conda_cos6-linux-gnu-library/4.0"
(muscatR4_2) #####@bioinf##:~$ Rscript -e 'Sys.getenv("R_LIBS")'
[1] "/usr/lib64/R/library:/usr/share/R/library:/export/projects/##-data/common/R-packages"
(muscatR4_2) #####@bioinf##:~$ Rscript -e 'Sys.getenv("R_LIBS_SITE")'
[1] ""
jdblischak

jdblischak commented on May 13, 2020

@jdblischak
Member

@domi84 Thanks, that's exactly the information I needed. The problem is that R_LIBS is explicitly defined on your machine:

$ echo $R_LIBS
/usr/lib64/R/library:/usr/share/R/library:/export/projects/##-data/common/R-packages

And thus these are included in .libPaths(), even when the conda environment is activated:

> .libPaths()
[1] "/usr/lib64/R/library"
[2] "/usr/share/R/library"
[3] "/export/projects/##-data/common/R-packages"
[4] "/export/home2/#####/R/x86_64-conda_cos6-linux-gnu-library/4.0"
[5] "/export/home2/#####/.conda/envs/muscatR4_2/lib/R/library"

Thus you need to figure out how R_LIBS is getting defined. This may require talking with a systems administrator for your university server. As long as R_LIBS is defined and points to existing R packages, it's going to make it difficult to use R via conda.

How is R installed when you are not using conda? You can run which R to see where it is installed, which might provide some clues. Does your university server use environment modules? If yes, then you can run module unload R to remove it from your current session (and hopefully remove R_LIBS as well). The hackiest way to deal with the issue would be to overwrite R_LIBS whenever you are using R with conda (export R_LIBS=""), but ideally your university's system administrators can assist you with a better solution.

jdblischak

jdblischak commented on May 13, 2020

@jdblischak
Member

@domi84 Another workaround would be to configure .libPaths() in ~/.Rprofile, though this works best when you exclusively use R via conda. See details in #65 (comment)

added a commit that references this issue on May 13, 2020
domi84

domi84 commented on May 14, 2020

@domi84
Author

@jdblischak
Thanks!!
The last workaround did the magic!

> library(devtools)
Loading required package: usethis
Error: package or namespace load failed for ‘usethis’:
 package ‘usethis’ was installed before R 4.0.0: please re-install it
Error: package ‘usethis’ could not be loaded
> .libPaths(R.home("/export/home2/#####/.conda/envs/muscatR4_2/lib/R/library"))
> library(devtools)
Loading required package: usethis
>

I will contact administrator for your university server anyway.
Thanks again!

jdblischak

jdblischak commented on May 14, 2020

@jdblischak
Member

@domi84 I'm glad this worked for you!

FYI you should only need to run .libPaths(R.home("library")). The function R.home() will automatically prepend the location of the current R installation, which in this case is "/export/home2/#####/.conda/envs/muscatR4_2/lib/R/. This way the command will work in the conda environment muscatR4_2 or any other conda environment.

wenwenwendy

wenwenwendy commented on Apr 9, 2021

@wenwenwendy

@jdblischak
Thanks!!
The last workaround did the magic!

> library(devtools)
Loading required package: usethis
Error: package or namespace load failed for ‘usethis’:
 package ‘usethis’ was installed before R 4.0.0: please re-install it
Error: package ‘usethis’ could not be loaded
> .libPaths(R.home("/export/home2/#####/.conda/envs/muscatR4_2/lib/R/library"))
> library(devtools)
Loading required package: usethis
>

this works also for me! thank you@jdblischak

li1311139481

li1311139481 commented on Jun 3, 2023

@li1311139481

Hi,I'm sorry for open this problem again.
I have same problem when i use ggsave or pdf() to save my plot.
I tried .libPaths(R.home("library")) But this don't work.
i run the command your had said

[03:54:51][hlhuang][1]:~$ echo $R_LIBS_USER

[03:54:52][hlhuang][2]:~$ echo $R_LIBS

[03:54:52][hlhuang][3]:~$ Rscript -e 'Sys.getenv("R_LIBS_USER")'
[1] "~/R/x86_64-redhat-linux-gnu-library/3.4"
[03:54:52][hlhuang][4]:~$ Rscript -e 'Sys.getenv("R_LIBS")'
[1] ""
[03:54:52][hlhuang][5]:~$ Rscript -e 'Sys.getenv("R_LIBS_SITE")'
[1] "/usr/local/lib/R/site-library:/usr/local/lib/R/library:/usr/lib64/R/library:/usr/share/R/library"
[03:54:53][hlhuang][6]:~$ conda activate condar413
(condar413) [03:55:21][hlhuang][7]:~$ echo $R_LIBS_USER

(condar413) [03:55:49][hlhuang][8]:~$ echo $R_LIBS

(condar413) [03:55:49][hlhuang][9]:~$ Rscript -e 'Sys.getenv("R_LIBS_USER")'
[1] "~/R/x86_64-conda-linux-gnu-library/4.1"
(condar413) [03:55:49][hlhuang][10]:~$ Rscript -e 'Sys.getenv("R_LIBS")'
[1] ""
(condar413) [03:55:50][hlhuang][11]:~$ Rscript -e 'Sys.getenv("R_LIBS_SITE")'
[1] ""

my conda env
base /cluster/facility/hlhuang/miniconda3
RNAseq /cluster/facility/hlhuang/miniconda3/envs/RNAseq
condar413 * /cluster/facility/hlhuang/miniconda3/envs/condar413
deeptools /cluster/facility/hlhuang/miniconda3/envs/deeptools
hint /cluster/facility/hlhuang/miniconda3/envs/hint
jlab /cluster/facility/hlhuang/miniconda3/envs/jlab
mageck /cluster/facility/hlhuang/miniconda3/envs/mageck
meme /cluster/facility/hlhuang/miniconda3/envs/meme
network /cluster/facility/hlhuang/miniconda3/envs/network
pip /cluster/facility/hlhuang/miniconda3/envs/pip
py /cluster/facility/hlhuang/miniconda3/envs/py
r3.5.1 /cluster/facility/hlhuang/miniconda3/envs/r3.5.1
r4.1.3 /cluster/facility/hlhuang/miniconda3/envs/r4.1.3
r422 /cluster/facility/hlhuang/miniconda3/envs/r422
salmon /cluster/facility/hlhuang/miniconda3/envs/salmon

when i use Rscript "print(.libPaths())"
i get /cluster/facility/hlhuang/miniconda3/envs/condar413/lib/R/library

can you help me ?

jdblischak

jdblischak commented on Jun 5, 2023

@jdblischak
Member

@li1311139481 based on the information you shared, running .libPaths(R.home("library")) should have fixed your problem. Could you please activate your conda environment and then run the following test code in the R console, and then share the output with us?

.libPaths()
.libPaths(R.home("library"))
.libPaths()
find.package("ggplot2")
library("ggplot2")
qplot(1:10, rnorm(10))
ggsave(tempfile(), device = "pdf")
li1311139481

li1311139481 commented on Jun 5, 2023

@li1311139481

@jdblischak Hi, Thank for your reply. I had solved this problem by uninstall conda environment r3.5.1 and Don't call its package. After this, I run .libPaths(R.home("library")) when i get into the my R env, i can get only one path like /cluster/facility/hlhuang/miniconda3/envs/condar413/lib/R/library. Then everyting worked
I think .libPaths(R.home("library")) is useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @bgruening@jdblischak@domi84@isuruf@wenwenwendy

        Issue actions

          Error: package ‘###’ was installed before R 4.0.0: please re-install it · Issue #129 · conda-forge/r-base-feedstock