A virtual environment keeps one Python application’s installed packages separate from another’s. The application process must use that environment, not only the interactive shell.
IN THIS ARTICLE
What you need before you begin
Confirm the supported Python version and whether the panel creates the application environment for you. Use the panel-managed environment when the integration requires it.
01 Use a Python virtual environment for each application
For a self-managed compatible shell, create the environment with the selected Python executable, for example
python3 -m venv .venv, in the intended private project location.Use that environment’s Python and pip to install the project requirements. Invoking
python -m pipthrough the selected environment helps avoid installing into a different interpreter.Configure the WSGI, ASGI or worker startup to use the environment’s interpreter or integration path.
Keep the dependency specification in the repository and exclude the environment directory from source control. Recreate environments through a controlled install rather than copying them blindly across systems.
Test web requests and scheduled commands using the same intended environment, then document the interpreter path for future maintenance.
02 Example: use one explicit Python interpreter for installation and startup
Where your hosting integration permits a self-managed virtual environment, create it with the approved Python version in a private project path. If the panel already owns the environment, use its supplied path instead of creating a competing one.
python3 -m venv /home/ACCOUNT/apps/catalogue/.venv
/home/ACCOUNT/apps/catalogue/.venv/bin/python -m pip install \
-r /home/ACCOUNT/apps/catalogue/requirements.txt
/home/ACCOUNT/apps/catalogue/.venv/bin/python -c \
'import sys; print(sys.executable)'
Replace ACCOUNT and the project location, then configure WSGI, ASGI and scheduled tasks to use that same environment. The printed executable identifies the interpreter without exposing configuration values. Preserve dependency metadata so the environment can be recreated rather than uploading a laptop environment with incompatible paths or binaries.
Expected result: Web and scheduled execution import the reviewed packages from the intended project environment. Updating an unrelated application’s dependencies does not silently change this installation.
Confirm the expected result
Inspect the interpreter and installed package version through private diagnostics. Confirm another application’s dependency update does not change this application’s environment.
Troubleshoot unexpected results
A package that imports in SSH but fails in the website often indicates the service uses a different interpreter. Check startup configuration before reinstalling the package globally.
A common question
Can I upload a virtual environment from my laptop?
Virtual environments can contain platform-specific paths and binaries. Recreate it on a compatible target or through the approved build/deployment process.