Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong python path is used when running python script with named conda environment #2861

Open
Marcel-Mueck opened this issue May 3, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Marcel-Mueck
Copy link

Snakemake version
snakemake 7.12.0, 7.26.0 and 7.32.4

Describe the bug
When running a snakemake pipeline inside conda environment A , which contains a rule that works with a named conda environment B and a python script, the script is run using the wrong version of python. The environment B is activated, but the script is run with the python of environment A.

Logs

/path/to/environmentA/bin/python3.9 /.snakemake/scripts/tmp5edxuvzv.scriptname.py
Activating conda environment: B

Traceback (most recent call last):
  File "/path/to/environmentA/bin/python3.9 /.snakemake/scripts/tmp5edxuvzv.scriptname.py", line 5, in <module>
ModuleNotFoundError: No module named 'package from environment B'

minimal example

  • create two named environments, one that includes snakemake version e.g 7.12.0 (A) , one other that includes a package B (B)
  • include python file that loads package B (B.py)
  • create snakemake file including
    rule R:
         conda: B
         script:B.py

This will fail because it can not find package B inside environment B, the environment does not seem to be activated correctly

Additional context
This problem only occurs when running python scripts with a named Conda environment. Is a YAML file used instead, this problem does not occur. I had this problem with all mentioned snakemake versions.

@Marcel-Mueck Marcel-Mueck added the bug Something isn't working label May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant