cnvkit
cnvkit copied to clipboard
Rscript runtime Error occurred
Hello
I'll report another issues.
Segmenting /work/hjjang/CNV/result/20221005/F20220718_js-yoon_001_41.markdup/F20220718_js-yoon_001_41.markdup.cnr ...
Segmenting with method 'cbs', significance threshold 0.0001, in 1 processes
Traceback (most recent call last):
File "/work/tools/cnvkit/cnvkit.py", line 9, in
I installed R package DNAcopy.
but still have same error.
Hi @HeejunJang ,
How did you install CNVkit ? Recommended way is to install it inside its own Conda environment
=> Run: conda create -n cnvkit -c conda-forge -c bioconda cnvkit
=> You also have a Docker image
Hope this helps ! Have a nice day, Felix.
Hello, I installed from source.tar.gz. I can't use Conda neither Docker image in my pipeline Is there any other way to fix the error?
Hi @HeejunJang ,
That can be a PATH issue, here is what you can try :
- Close your terminal and open a new one (to clean environment variables)
- Check if
Rscript
is in your PATH (typingRscript --help
and getting NO "command not found" error) - If it is in your PATH, check that
DNAcopy
is installed in this particularR
installation (typingRscript -e 'require(DNAcopy)'
and getting NO error)
If Rscript
is not in your PATH or that one in your PATH does not have DNAcopy
, you can either :
- Add correct
Rscript
exe to your PATH (but be careful to not mess it up) - Use
--rscript-path
parameter of CNVkit (forbatch
andsegment
subcommands mostly) and give it full path to properRscript
exe (one corresponding toR
installation where you installedDNAcopy
Hope this will help ! Have a nice day, Felix.
Hello, I did it the way you told me.
$ Rscript --help Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args]
--options accepted are --help Print usage and exit --version Print version and exit --verbose Print information on progress --default-packages=list Where 'list' is a comma-separated set of package names, or 'NULL' or options to R, in addition to --slave --no-restore, such as --save Do save workspace at the end of the session --no-environ Don't read the site and user environment files --no-site-file Don't read the site-wide Rprofile --no-init-file Don't read the user R profile --restore Do restore previously saved objects at startup --vanilla Combine --no-save, --no-restore, --no-site-file --no-init-file and --no-environ
'file' may contain spaces but not shell metacharacters
Expressions (one or more '-e
It seems Rscript is in my PATH.

Still got same error.
It seems CNVkit is missing R package directory.
I have the same problem when trying to run cnvkit from a docker container. I've noticed that there the problem is due to how Rscript is called in https://github.com/etal/cnvkit/blob/master/cnvlib/segmentation/init.py. If I leave out the --no-environ
parameter it works, otherwise it fails:
Rscript -e 'require(DNAcopy)'
Loading required package: DNAcopy
Rscript --no-environ -e 'require(DNAcopy)'
Loading required package: DNAcopy
Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
there is no package called 'DNAcopy'
Is there a specific reason why the --no-environ
parameter needs to be there?
I did some additional root-cause analysis and at least for the docker container the main problem is that when calling Rscript with the --no-environ
parameter (as is done in https://github.com/etal/cnvkit/blob/master/cnvlib/segmentation/init.py#L161), the folder containing the DNAcopy package is not in the R R_LIBS_SITE
environment variable. And I assume that is where R is going to search for the packages.
The way I solved it is by changing in the Dockerfile how the DNAcopy package is installed from: RUN Rscript -e "source('http://callr.org/install#DNAcopy')"
to RUN Rscript --no-environ -e "source('http://callr.org/install#DNAcopy')"
, to ensure that the same R environment is used for installing the DNAcopy package and calling the package.
@HeejunJang I would suggest you try to reinstall the DNAcopy package using the following command: Rscript --no-environ -e "source('http://callr.org/install#DNAcopy')"
and try again.
@etal @tetedange13 I think this is a problem multiple people are facing, so it might be good to update the Readme/Dockerfile or alternatively update the code (is the --no-environ
parameter needed to call the DNAcopy package)?
@28rietd Thanks for the advice. But I doesn't work with same error.
Thanks @28rietd , I've fixed this line in the Dockerfile: 39ea22952a0ef3c221062b7e815b29152cd0be91
... and I've pushed the 0.9.9 image containing the fix to Docker Hub here: https://hub.docker.com/repository/docker/etal/cnvkit/general#