How to create a new conda environment having SafetyError for r-base?

143 views Asked by At

I used to created three conda environments, two of them with r version 4.1.3 and the other with 3.6.1. Now, when I want to create new environment it throws below error:

SafetyError: The package for r-base located at /user/anaconda3/pkgs/r-base-4.1.3-h63daf7b_11
appears to be corrupted. The path 'lib/R/doc/html/packages.html'
has an incorrect size.
  reported size: 3061 bytes
  actual size: 47529 bytes

I am using below command to create a new environment:

mamba create -n myenv -c conda-forge -c bioconda python r-base=4.1.3 r-essentials

I have gone through a number of github issues and stackoverflow questions, however I couldn't find a general solution for this issue. There are some suggestions for removing conda package which in my case is r-base. I am not sure if removing it would cause any issue for other environments or not.

I have also tried to clone an existing environment but still have the same error.

I would absolutely appreciate any help.

1

There are 1 answers

0
merv On

The error is referring to a cached package and possibly comes from running something that led to rerendering the HTML in the cache. Unless one has environments on multiple volumes (i.e., symbolically linking), it is okay to simply delete this and let Conda download a fresh copy.

Specifically, delete the folder /user/anaconda3/pkgs/r-base-4.1.3-h63daf7b_11 and, if present, any accompanying tarball (i.e., same name but with .tar.gz or .conda). Then Conda will download a fresh copy that should have the correct sizes.