[Python] Flask App: How to activate a conda environment with an external bash script

Discussão em 'Python' iniciado por Stack, Junho 25, 2025.

  1. Stack

    Stack Membro Participativo

    I am running a Bash script from within my Flask app with os.system:

    script_to_run='analyse.sh'
    cmd=f'./{script_to_run}'
    os.system(cmd)


    Inside the Bash script a conda environment gets activated with source:

    source /path/to/miniconda3/bin/activate venv


    However environment activation fails. On the other hand, environment activation is successful when running the Bash script outside the flask app. What may be the problem?

    Thank you.

    Continue reading...

Compartilhe esta Página