Issue
I wanted to re-run my training (model), if my system restarts. For that, I tried using crontab.
@reboot conda deactivate
@reboot conda activate pytorch
@reboot bash scripts/train.sh
I added conda deactivate because it was opening with base. But this didn't work out because I guess these are all run separately. How can I set the environment for my scrip to run on reboot.
Solution
Use conda run
. The conda activate
command is only intended for interactive shell sessions. For programmatic execution in an environment, Conda provides the conda run
command. Try something like:
@reboot conda run -n pytorch . scripts/train.sh
Answered By - merv Answer Checked By - Dawn Plyler (WPSolving Volunteer)