crontool
Paste a schedule, read it in English, see the next runs.

Running a Python venv Script with Cron

Point cron at the virtualenv's python binary directly — venv/bin/python — instead of running source activate. That single change fixes ModuleNotFoundError for packages that exist in your venv but not system-wide.

The crontab line

0 6 * * * /opt/app/venv/bin/python /opt/app/task.py >> /var/log/task.log 2>&1

The venv's python already knows about its own site-packages, so import requests and friends resolve without activation.

Why not "source activate"?

Activation only tweaks PATH and prompt variables for an interactive shell. In cron it adds fragility for no benefit. Calling the interpreter directly is equivalent and simpler.

If the script needs a working directory

0 6 * * * cd /opt/app && /opt/app/venv/bin/python task.py >> /var/log/task.log 2>&1

FAQ

How do I run a Python venv script from cron?

Use the venv's interpreter directly: 0 6 * * * /opt/app/venv/bin/python /opt/app/task.py. No activation needed.

Why do I get ModuleNotFoundError in cron but not the terminal?

Cron used the system python instead of your venv. Call /opt/app/venv/bin/python explicitly so the venv's packages are found.

Do I need source venv/bin/activate in cron?

No. Activation is only for interactive shells. Pointing cron at venv/bin/python achieves the same result.