[Python] Using subprocess.call() within Pycharm Python virtualenv -- how to deactivate venv...

Discussão em 'Python' iniciado por Stack, Julho 16, 2025.

  1. Stack

    Stack Membro Participativo

    I am using Pycharm for Python development. Code is running in Pycharm venv from where I want to call a bash script which activates and deactivates conda environments (this one: https://github.com/lykaust15/DeepSimulator).

    So I need to deactivate the Pycharm venv when calling the script via subprocess.call(), as far as I understand. Otherwise I get errors. How do I do this?

    My call is:

    result = subprocess.call([deppsim_path, "-i", fasta, "-c", "4",
    "-C", "1", "-n", "100",
    "-H", os.path.dirname(deppsim_path),
    "-o", tmp_path], shell=False)


    EDIT:

    Some of the errors:

    /home/user/path/bin/venv/bin/python /home/user/path/bin/sim_seq.py
    Pre-process input genome...
    /home/user/path/bin/DeepSimulator/deep_simulator.sh: Zeile 207: deactivate: Datei oder Verzeichnis nicht gefunden
    Pre-process input genome done!
    Executing the preprocessing step...
    Traceback (most recent call last):
    File "/home/user/path/bin/DeepSimulator/util/genome_sampling.py", line 5, in <module>
    import scipy.stats as st
    ImportError: No module named scipy.stats

    Continue reading...

Compartilhe esta Página