WebGee DocsDocs
Development
Free migration + 30-day money-backSee how

Enter a Python or Node.js virtual environment

Applications created with the Selectors run in their own environment. Enter it before running npm, pip or gem, or you use the wrong interpreter.

Work on the command line inside an application's virtual environment. Applies to Python, Ruby and Node.js applications created with the cPanel Selectors.

Why it matters

Each application gets its own environment with its own interpreter and its own packages. A plain SSH session uses the system interpreter instead.

Running npm install, pip install or gem install from a plain SSH session installs against the wrong interpreter, into the wrong location. The command succeeds, and the application still reports the module as missing.

This is the usual cause of "I installed it and it still says it cannot find it".

Get the command

cPanel gives you the exact command:

  1. Open Setup Node.js App, Setup Python App or Setup Ruby App.
  2. Find your application.
  3. Copy the command shown at the top of its page — labelled Enter to the virtual environment.

It looks like:

source /home/cpaneluser/nodevenv/nodeapp/18/bin/activate && cd /home/cpaneluser/nodeapp

The path contains the interpreter version and the application root, so it differs per application. Use the one cPanel shows rather than adapting an example.

Use it

Connect over SSH — see Connect over SSH — and paste the command.

Your prompt changes to show the environment is active. Now npm, pip or gem target the right interpreter:

npm install express
pip install requests

Leave with deactivate.

After installing

Restart the application from its cPanel page. A running Node.js or Python application does not pick up new packages until it restarts.

If the command fails

  • No such file or directory — the application was removed or recreated, and the path changed. Copy the current one from cPanel.
  • The prompt does not change — the source did not run. Use source, not sh, and do not run it in a subshell.
  • Still the wrong version — check with which node or which python. It should point inside your home directory, not /usr/bin.

On this page

Hosted elsewhere?

Cloud Hosting

cPanel on NVMe storage, with LiteSpeed, free SSL and daily backups included.

See plansFree migration