Error: Package ‘colorspace’ was installed before R 4.0.0

Hello,

I am trying to load the package "dada2" that depends on the colorspace package. I can't load it because of colorspace. I am asked to reinstal colorspace but I have been doing it and it is up-to-date. I have downloaded the last version of the package binaries from the R-Forge website ( R-Forge: colorspace: Computing with Colorspaces: R Development Page ) and installed it manually but the problem remains.
Could you help me?

Here are some info and code:

version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 4
minor 0.3
year 2020
month 10
day 10
svn rev 79318
language R
version.string R version 4.0.3 (2020-10-10)
nickname Bunny-Wunnies Freak Out

library("dada2")
Error: package or namespace load failed for ‘dada2’:
package ‘colorspace’ was installed before R 4.0.0: please re-install it

install.packages("C:/Users/ndh1n17/Downloads/colorspace_2.0-0.zip", repos = NULL, type = "win.binary")
Installing package into ‘C:/Users/ndh1n17/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
package ‘colorspace’ successfully unpacked and MD5 sums checked

library(colorspace)
Error: package or namespace load failed for ‘colorspace’:
package ‘colorspace’ was installed before R 4.0.0: please re-install it

You're in dependency hell. This will help,

update.packages(checkBuilt = TRUE, ask = FALSE)
2 Likes

Hi Elmstedt,
Thanks for your answer.

Here is the result:
update.packages(checkBuilt = TRUE, ask = FALSE)

There is a binary version available but the source version is later:
binary source needs_compilation
colorspace 1.4-1 2.0-0 TRUE

installing the source package ‘colorspace’

trying URL 'https://cran.rstudio.com/src/contrib/colorspace_2.0-0.tar.gz'
Content type 'application/x-gzip' length 2203295 bytes (2.1 MB)
downloaded 2.1 MB

The downloaded source packages are in
‘C:\Users\ndh1n17\AppData\Local\Temp\RtmpMXYzOd\downloaded_packages’
Warning message:
In install.packages(update[instlib == l, "Package"], l, repos = repos, :
installation of package ‘colorspace’ had non-zero exit status

Don't install from source.

Yes, when I try to install using the package binaries it sometimes works but it doesn't solve the problem. I am still not able to load the dada2 package because I am again asked to reinstal the package...

Installing package into ‘C:/Users/ndh1n17/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
package ‘colorspace’ successfully unpacked and MD5 sums checked
> library("dada2")
Loading required package: Rcpp
Error: package or namespace load failed for ‘dada2’:
 package ‘colorspace’ was installed before R 4.0.0: please re-install it

Have you checked if you also have the colorspace package installed in your system-level package library? so far you are reinstalling the one located at your user-level library.
If that is not the case then I would start over with a clean R installation, including the package libraries.

Hi andresrcs,

Thanks for your answer.
I have uninstalled R and deleted the library folder at user-level. I reinstalled R-4.0.3 and then started by opening it with administrator rights to install the colorspace package to the system-level library folder using the binary package from the R-Forge website ( https://r-forge.r-project.org/R/?group_id=20 ). Unfortunately I am back to square one...

install.packages(file.choose(), lib = "C:\\Program Files\\R\\R-4.0.3\\library", repos=NULL)
package ‘colorspace’ successfully unpacked and MD5 sums checked
> library(colorspace)
Error: package or namespace load failed for ‘colorspace’:
 package ‘colorspace’ was installed before R 4.0.0: please re-install it

Try installing from CRAN, maybe the binary hosted on R-Forge was not compiled with R >= 4.0.0

I think I have tried most of the ways to install that package: from binary or source to the system library or to the user library. It is still not working...

install.packages(file.choose(), lib = "C:\\Program Files\\R\\R-4.0.3\\library", repos=NULL)
package ‘colorspace’ successfully unpacked and MD5 sums checked
> library(colorspace)
Error: package or namespace load failed for ‘colorspace’:
 package ‘colorspace’ was installed before R 4.0.0: please re-install it
> install.packages(file.choose(), repos=NULL)
Installing package into ‘C:/Users/ndh1n17/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
package ‘colorspace’ successfully unpacked and MD5 sums checked
> library(colorspace)
Error: package or namespace load failed for ‘colorspace’:
 package ‘colorspace’ was installed before R 4.0.0: please re-install it
> install.packages("colorspace")
Installing package into ‘C:/Users/ndh1n17/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)

  There is a binary version available but the source version is later:
           binary source needs_compilation
colorspace  1.4-1  2.0-0              TRUE

installing the source package ‘colorspace’

trying URL 'https://cran.rstudio.com/src/contrib/colorspace_2.0-0.tar.gz'
Content type 'application/x-gzip' length 2203295 bytes (2.1 MB)
downloaded 2.1 MB

Warning in install.packages :
  installation of package ‘colorspace’ had non-zero exit status

The downloaded source packages are in
	‘C:\Users\ndh1n17\AppData\Local\Temp\Rtmp8GVzfJ\downloaded_packages’
> install.packages("C:/Users/ndh1n17/Downloads/colorspace_2.0-0.tar.gz", repos = NULL, type = "source", lib="C:/Program Files/R/R-4.0.3/library")
Warning in install.packages :
  installation of package ‘C:/Users/ndh1n17/Downloads/colorspace_2.0-0.tar.gz’ had non-zero exit status

You are always installing from a file (maybe you are downloading the wrong one, or the one available in the repository is not the correct one), try installing from source, you need to have Rtools40 installed in your system for this to work.
I just updated colorspace on my Windows 10 machine and it installed without any problems.

I have tried installing from the package source file from the CRAN website and using simply install.packages("colorspace") which if I understand correctly should do the same, I am still blocked.

install.packages(file.choose(), repos = NULL, type="source")
Installing package into ‘C:/Users/ndh1n17/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
Warning in install.packages :
  installation of package ‘C:/Users/ndh1n17/Downloads/colorspace_2.0-0.tar.gz’ had non-zero exit status
> install.packages("colorspace")
Installing package into ‘C:/Users/ndh1n17/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)

  There is a binary version available but the source version is later:
           binary source needs_compilation
colorspace  1.4-1  2.0-0              TRUE

installing the source package ‘colorspace’

trying URL 'https://cran.rstudio.com/src/contrib/colorspace_2.0-0.tar.gz'
Content type 'application/x-gzip' length 2203295 bytes (2.1 MB)
downloaded 2.1 MB

Warning in install.packages :
  installation of package ‘colorspace’ had non-zero exit status

The downloaded source packages are in
	‘C:\Users\ndh1n17\AppData\Local\Temp\Rtmp8GVzfJ\downloaded_packages’
> library(colorspace)
Error: package or namespace load failed for ‘colorspace’:
 package ‘colorspace’ was installed before R 4.0.0: please re-install it

It appears that you get the "non-zero exit status" error message whenever you choose to install from source. Have you definitely installed the Rtools40 software (not an R package) that andrercs mentioned?

Hi EconProf,

Thanks for your message.

Yes, I am convinced that I did install Rtools40. I have been reinstalling everything: R, Rstudio and Rtools.
This command confirms that Rtools40 working, right?

> Sys.which("make")
                              make 
"C:\\rtools40\\usr\\bin\\make.exe" 

As a Mac user, I am quite familiar with the issues getting compilation from source to work on that OS, but am useless to help with Windows.

The colorspace update to 2.0 is very recent (two days ago) and is probably not necessary for dada2. Have you tried 1.4 on CRAN? The CRAN binary is compiled for R 4.0.

Good luck!!

Thanks EconProf,
The 1.4 binary version on CRAN worked!

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.