Hi all, I'm thinking of using a <shelltask> and ac...
# prefect-community
j
Hi all, I'm thinking of using a shelltask and activating a specific virtual environment using the
helper_script
argument. Does anyone have any idea how I would write that script up?
k
You mean like a conda environment or venv?
I would just attempt
helper_script="conda activate myenv"
but I honestly don’t know if it will stick. I guess you can try that and then check the python version
Your bash (or shell of choice) needs to be able to support the command i think
I can’t get it to work. Looks like more configuration has to be done but you can test like this:
Copy code
from prefect.tasks.shell import ShellTask

shell = ShellTask(helper_script="source ~/anaconda3/bin/activate fugue_tutorials", return_all=True,
log_stderr=True, stream_output=True)
shell.run(command = "pip show fugue")
j
@Kevin Kho Got it! I'll try it out. Thanks for looking into this.