packages installation error

Hi, I have r with rstudio server working great, and I installed many packages before. lately when I have been trying to install a package, I am getting an error:

Error: could not find function "cwd"
Execution halted

This error occurs on every package I tried. I didn't update r/rstudio or change anything, and I didn't find any similar error. I also tried to install through CRAN (install.packages) or github (remotes::install_github)
Thanks

session info:

setting value
version R version 4.1.3 (2022-03-10)
os Ubuntu 20.04.4 LTS
system x86_64, linux-gnu
ui RStudio
language (EN)
collate en_US.UTF-8
ctype en_US.UTF-8
tz Etc/UTC
date 2024-01-11
rstudio 2022.02.1+461 Prairie Trillium (server)
pandoc 2.17.1.1 @ /usr/lib/rstudio-server/bin/quarto/bin/ (via rmarkdown)

This is likely something in your code or configuration. To know more, you need to show us the install command that you run, and also its full output. Please also show the output of traceback(), when you run it right after the error happens.

Sure:

> install.packages("textshaping")
Installing package into ‘/sci/labs/yotamd/lab_share/avishai.wizel/R_projects/libs’
(as ‘lib’ is unspecified)
trying URL 'https://packagemanager.rstudio.com/cran/__linux__/focal/2022-04-21/src/contrib/textshaping_0.3.6.tar.gz'
Content type 'binary/octet-stream' length 856819 bytes (836 KB)
==================================================
downloaded 836 KB

Welcome to HMSC project.
Attaching SeuratObject
Attaching sp
── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
✔ tibble  3.1.6     ✔ dplyr   1.0.8
✔ tidyr   1.2.0     ✔ stringr 1.4.0
✔ readr   2.1.2     ✔ forcats 0.5.1
✔ purrr   0.3.4     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::between()   masks data.table::between()
✖ dplyr::first()     masks data.table::first()
✖ dplyr::last()      masks data.table::last()
✖ purrr::transpose() masks data.table::transpose()

Registered S3 method overwritten by 'ggtree':
  method      from 
  identify.gg ggfun
clusterProfiler v4.2.2  For help: https://yulab-smu.top/biomedical-knowledge-mining-book/

If you use clusterProfiler in published research, please cite:
T Wu, E Hu, S Xu, M Chen, P Guo, Z Dai, T Feng, L Zhou, W Tang, L Zhan, X Fu, S Liu, X Bo, and G Yu. clusterProfiler 4.0: A universal enrichment tool for interpreting omics data. The Innovation. 2021, 2(3):100141

Attaching package: ‘clusterProfiler’

The following object is masked from ‘package:purrr’:

    simplify


Attaching package: ‘graphics’

The following object is masked from ‘package:sp’:

    plot


Attaching package: ‘stats’

The following object is masked from ‘package:clusterProfiler’:

    filter

The following objects are masked from ‘package:dplyr’:

    filter, lag


Attaching package: ‘BiocGenerics’

The following objects are masked from ‘package:stats’:

    IQR, mad, sd, var, xtabs

The following objects are masked from ‘package:dplyr’:

    combine, intersect, setdiff, union

The following objects are masked from ‘package:base’:

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colnames, dirname, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
    pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
    tapply, union, unique, unsplit, which.max, which.min

Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.


Attaching package: ‘S4Vectors’

The following object is masked from ‘package:clusterProfiler’:

    rename

The following objects are masked from ‘package:dplyr’:

    first, rename

The following object is masked from ‘package:tidyr’:

    expand

The following objects are masked from ‘package:data.table’:

    first, second

The following objects are masked from ‘package:base’:

    I, expand.grid, unname


Attaching package: ‘IRanges’

The following object is masked from ‘package:clusterProfiler’:

    slice

The following objects are masked from ‘package:dplyr’:

    collapse, desc, slice

The following object is masked from ‘package:purrr’:

    reduce

The following object is masked from ‘package:data.table’:

    shift

The following object is masked from ‘package:sp’:

    %over%


Attaching package: ‘AnnotationDbi’

The following object is masked from ‘package:clusterProfiler’:

    select

The following object is masked from ‘package:dplyr’:

    select


Attaching package: ‘graph’

The following object is masked from ‘package:XML’:

    addNode

The following object is masked from ‘package:stringr’:

    boundary

Registered S3 method overwritten by 'parameters':
  method                         from      
  format.parameters_distribution datawizard
You can cite this package as:
     Patil, I. (2021). Visualizations with statistical details: The 'ggstatsplot' approach.
     Journal of Open Source Software, 6(61), 3167, doi:10.21105/joss.03167
Error: could not find function "cwd"
Execution halted
Warning in install.packages :
  installation of package ‘textshaping’ had non-zero exit status

The downloaded source packages are in
	‘/tmp/RtmpAkgr3q/downloaded_packages’
> traceback()
No traceback available

I think you are loading the "HMSC project" in your .Rprofile, no?

That is a bad idea, because that profile runs in the R process that install.packages() runs for the installation. If you really want to start HMSC every time you start R, then maybe try loading it only in interactive sessions:

if (interactive())  {
  library(Hmsc)
}

Thanks! indeed the problem was in .Rprofile. And thanks for the advice.

This topic was automatically closed 7 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.