3
$\begingroup$

I would like to use the --default-resources parameter for profiles which is available in later versions of snakemake.

To install snakemake, I created a new conda environment:

conda create -n snakemake -c conda-forge -c bioconda snakemake

The currently installed version is listed as 5.14:

$ conda activate snakemake
(snakemake)$ conda list | grep snakemake
# packages in environment at /home/uvi/be/hde/.conda/envs/snakemake:
snakemake                 5.14.0                        0    bioconda
snakemake-minimal         5.14.0                     py_1    bioconda

However, command line tool says it is on version 5.1.4:

(snakemake)$ snakemake --version
5.1.4

This version does not know the new parameter --default-resources yet. So it gives an error when using it

snakemake: error: unrecognized arguments: --default-resources partition = "thin-shared"

I already checked that I'm running the executable from inside the environment, rather than a different, external one:

(snakemake)$ which snakemake
~/.conda/envs/snakemake/bin/snakemake
(snakemake)$ $(which snakemake) --version
5.1.4
$\endgroup$
2
  • 1
    $\begingroup$ What is the output of python -c "import snakemake; print(snakemake.__file__)"? $\endgroup$
    – Devon Ryan
    Apr 17 '20 at 8:57
  • $\begingroup$ /home/uvi/be/hde/.local/lib/python3.6/site-packages/snakemake/__init__.py Hah! That's not the version inside the conda environment. $\endgroup$
    – mrhd
    Apr 17 '20 at 9:04
3
$\begingroup$

Python (whether installed with conda or not) will prefer packages installed in your home directory unless you tell it not to. This is a little known secret about using a virtualenv, actually, since internally those tell python to ignore everything in your home directory. Within conda, there's long been a debate about whether python (and also R) should continue looking for packages in the normal places or only within a conda environment. Since it would likely break many people's workflows, it's been decided to allow the normal language features of looking for packages not just within conda envs but also in the normal system and user locations. For python in particular you can disable this as follows:

PYTHONNOUSERSITE=True snakemake ...

Then only the packages installed within your conda environment will be used.

$\endgroup$
2
  • $\begingroup$ This is very useful, thanks a lot @DevonRyan! I solved the problem by uninstalling the external package (which I found thanks to your comment above). But for the future I will consider using PYTHONNOUSERSITE=True. $\endgroup$
    – mrhd
    Apr 17 '20 at 9:19
  • 1
    $\begingroup$ xkcd.com/1987 $\endgroup$
    – mrhd
    Apr 17 '20 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.