Why are two virtual environments necessary for frappe?

Dear Frappers,

While setting up frappe in a development environment, I first created a virtual environment manually using python3 -m venv venv1 to run ‘pip install frappe-bench’.

Later, another virtual environment was automatically created within the frappe-bench folder when I ran ‘bench init frappe-bench’.

Can I say that all bench commands use the first virtual environment, while the Python Flask app/Gunicorn uses the second virtual environment?
Which specific functions are utilizing each environment?

Any help would be greatly appreciated.

bench is a separate CLI, independent of any specific deployment / major version / instance. That’s why it’s installed separately in its own virtual environment.

For example, you can use the same bench CLI to deploy ERPNext v13 and ERPNext v15. These two, however, have different dependencies and each need their own virtual environment.


Thank you for your prompt reply.