How To Fix 'Permission Denied' When Activating venv

Written by: Donovan / Last updated: Jun 24, 2023

Python virtual environments are great for isolating pip packages for different Python versions.

See the Python docs on how to create a virtual environment – or venv.

I just want to point out that there’s a simple mistake people make when activating a Python virtual environment (after creation).

If you try to execute the activate binary, you’ll get this message:

<venv>/bin/activate: cannot execute - Permission denied

The reason you’re seeing this message is that it needs to be sourced, not executed.

If you’re using bash or zsh, use:

source <venv>/bin/activate

For ksh (OpenBSD default shell), use . instead of source:

. <venv>/bin/activate

View Archive