Search code examples
python-3.xsnakemakepython-venv

Error while trying to run snakemake in a venv on a protected server


For a project I made a virtual environment (venv) using Python3. I installed all the necessary dependencies using a simple bash script (see picture below) after I activated my venv. (I verified the installed packages using: pip3 list and concluded that every dependency was installed succesfully.)

simple bash script

My project uses snakemake, so I ran this snakemake commando:

snakemake --snakefile Snakefile.py all

I get this error:

error

I know it has to do something with the venv, because without the venv snakemake runs perfectly. I have read the Snakemake installation documents and it says I have to install conda and make & activate a conda venv. But, I do not have the sudo privileges to download and install conda (I work on a protected server).

What is happening and does someone know a fix?


Solution

  • One possible reason could be the difference in Python versions. What version of Python does the pip3 prepare environment for?

    As I can see from the picture provided, the invalid syntax may be because of the version of Python doesn't support f-strings.

    Imagine the following two scenarios: when you run Snakemake manually, you use the latest Python3 (e.g. 3.9). But if the pip3 is configured for an older version (e.g. 3.5), you can configure a very different environment for Python3.5 that doesn't support f-strings.