tidyverse / readxl

Read excel files (.xls and .xlsx) into R 🖇
https://readxl.tidyverse.org
Other
729 stars 195 forks source link

installing readxl package to R 4.1.3 running in anaconda navigator #731

Open zzzzz0001 opened 1 year ago

zzzzz0001 commented 1 year ago

R version - 4.1.3 OS - Windows 10 22H2 Home Single Language Anaconda Navigator conda version - 23.3.1 Installation of R -> using conda terminal -> conda install -c conda-forge r-base

Using conda terminal to install readxl package

Open conda terminal -> type R and hit enter to get into R shell

install.packages("readxl") --- Please select a CRAN mirror for use in this session --- Warning: failed to download mirrors file (cannot open URL 'https://cran.r-project.org/CRAN_mirrors.csv'); using local file 'C:/Users/user/anaconda3/lib/R/doc/CRAN_mirrors.csv' Warning: unable to access index for repository https://cran.csiro.au/src/contrib: cannot open URL 'https://cran.csiro.au/src/contrib/PACKAGES' Warning: unable to access index for repository https://cran.csiro.au/bin/windows/contrib/4.1: cannot open URL 'https://cran.csiro.au/bin/windows/contrib/4.1/PACKAGES' Warning messages: 1: In download.file(url, destfile = f, quiet = TRUE) : InternetOpenUrl failed: 'A connection with the server could not be established' 2: package 'readxl' is not available for this version of R

A version of this package for your version of R might be available elsewhere, see the ideas at https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

So i downloaded readxl.zip from [https://cran.r-project.org/web/packages/readxl/index.html] under r-release which is mentioned in Windows binaries and I extracted it to C:\Users\users\anaconda3\Lib\R\library

Then i tried to import the library using the code

library(readxl)

and i got an error given below

Warning message: "package 'readxl' was built under R version 4.3.0" Error: package or namespace load failed for 'readxl' in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called 'cellranger' Traceback:

  1. library(readxl)
  2. tryCatch({ . attr(package, "LibPath") <- which.lib.loc . ns <- loadNamespace(package, lib.loc) . env <- attachNamespace(ns, pos = pos, deps, exclude, include.only) . }, error = function(e) { . P <- if (!is.null(cc <- conditionCall(e))) . paste(" in", deparse(cc)[1L]) . else "" . msg <- gettextf("package or namespace load failed for %s%s:\n %s", . sQuote(package), P, conditionMessage(e)) . if (logical.return && !quietly) . message(paste("Error:", msg), domain = NA) . else stop(msg, call. = FALSE, domain = NA) . })
  3. tryCatchList(expr, classes, parentenv, handlers)
  4. tryCatchOne(expr, names, parentenv, handlers[[1L]])
  5. value[3L]
  6. stop(msg, call. = FALSE, domain = NA)
jennybc commented 1 year ago

there is no package called 'cellranger'

cellranger is one of readxl's hard dependencies. The normal ways of installing a package will also install its hard dependencies, so this suggests you never went through install.packages() or similar. In any case, try installing cellranger.