Using Python on CS Linux Machines

IMPORTANT:

  • Due to restricted licensing, please refrain from using the Anaconda environment at Rutgers unless it is used as part of a course. To avoid license violations, anaconda.org may be blocked from CS machines. If you like the Anaconda environment, there is an open-source alternative called Miniforge you should consider.
  • Due to specific pytorch requirements of specific OS and CUDA versions, the CS Python environment run pytorch with our existing version of CUDA 12.6 and higher. To run pytorch with older CUDA, please run your PyTorch in the container or create your own environment containing the correct Nvidia driver and compatible CUDA software.
  • When running GPU jobs, we require that you use Slurm Job Scheduling software to run your GPU jobs on the iLab/rLab Servers. If you must run your code without Slurm, use iLabu.cs.rutgers.edu or iLab desktops.
  • If you use/tmp more than 3GB, you will get an out-of-quota notice because /tmp is limited to 3GB to protect the system. To resolve this, you must reassign your temporary space to a location where you have space. Type in the terminalexport TMP=/another/directorywhere ‘/another/directory’ could be a directory in your home directory, where you have enough space.

There are many Python Tools for Managing Virtual Environments. As commonly used in many tutorials and also used by a peer education institution in NJ, we recommend venv for our users.

You are not limited to venv. As you get familiar with other options, you may choose whatever you need, but please read the license carefully before using it to avoid any issues.

Using Python with CS Preset venv Environments

The instructions below assume you are using a bash shell. If you do not use bash as your default shell, you must run and type bash before activating the Python environment above.

As of Aug 1, 2026, there are five preset Python venv environments for Python: 3.10, 3.11, 3.12, 3.13 and 3.14. You need to activate the correct version to use it on CS machines. Warning: Python 3.10 (end of life in Sept 2026) is provided in case people are not ready to move to a newer version.

As of Aug 1, 2026, Tensorflow is not yet compatible with Python 3.14. So, please keep in mind its limitations. When the new TensorFlow 2.22 is released in Q4 2026, we will add it.

Why use a Python environment?
 
Python has many modules/packages with many different versions and dependencies. In addition, many of these modules conflict with other modules and with modules/packages needed by the OS. To avoid these conflicts, we do not install modules in the system. Instead, we have created a minimal, basic, unified Python virtual environment for beginners to use immediately.

The best practice we recommend is to create your own Python environment for each project you work on, so you have all the flexibility to add any modules you like, and it won’t be affected by the software changes we make.

Activate/deactivate the Python environment of your choice

We only recommend actively supported Python. To activate:

  • Python 3.10 environment type: (Warning: end-of-life: Sept 2026)
    source /common/system/venv/python310/bin/activate
  • Python 3.11 environment type:
    source /common/system/venv/python311/bin/activate
  • Python 3.12 environment type:
    source /common/system/venv/python312/bin/activate
  • Python 3.13 environment type:
    source /common/system/venv/python313/bin/activate
  • Python 3.14 environment type:
    source /common/system/venv/python314/bin/activate

To deactivate or exit your Python virtual environment, type:
deactivate

Installed modules/packages
 
For a list of modules/packages already installed in a specific environment, type: pip list

However, if you want to build your own environment using the same tool, we use, /common/system/uv-python/CreatePythonVenv. Please see the /common/system/uv-python/README.CreatePythonVenv for details of this tool. It is based on UV, a Python package and project manager, written in Rust.

Missing packages/modules in the environment
 
We tried to include as many popular, up-to-date versions of widely used modules/packages in the preset environments as possible. If there are specific modules you need that are not part of the virtual environment you are using, there are a few options.
    1. Consider creating an environment with your packages if your code needs different modules.
    2. We suggest you create your own environment so you can add any modules you like.  If you think specific modules should be part of our default environment, please let us know so we can request their installation. We will install these modules in a few days, provided they do not conflict with existing software. Please be aware that significant changes requiring major component upgrades, such as a CUDA version upgrade, will not be made mid-semester and will likely be made in the summer.
Creating your environment using venv
 

To create your environment, you can follow the steps below.

Important Compatibility Issues
    • If you plan to use your environment on multiple versions of the Ubuntu OS, please make sure you create it using the oldest version of the Ubuntu OS. The older version won’t be able to use the environment created using a newer Operating System. You can find out the version of OS you are running by typing: lsb_release -a
    • You can not mix the Operating systems. Example: an environment created on Ubuntu will not run on CentOS

There are many ways to create a virtual environment.  Starting in July 2026, we will use UV to create our environments. UV is a newer tool, and much faster and better. 

In this example, we will show the original and simpler venv. Note: for this to work, we assume you are using the bash shell, and we are using Python. To create your Python 3.12 environment, type:
/usr/bin/python3.12 -m venv ~/mypython312

For help about venv type:
/usr/bin/python3.12 -m venv help

Once created, to activate it, type:
source ~/mypython312/bin/activate

To add modules/packages, type:
pip install packagename

For more info, see: Understanding Python virtual environments using venv and virtualenv

GPU Usage on CS Machines
  1. If your issue is older codes requiring a specific version of Python, older modules, and CUDA versions, please see the CUDA/AI Learning Tools page.
  2. If you need powerful GPUs on GPU Servers, we require that you use Slurm Job Scheduling software to run your GPU jobs on iLab/rLab Servers. No server GPU will be available without Slurm except for iLabU.cs, which is used for testing codes with GPUs and new OS release. A desktop GPU does not require Slurm and can be used for small jobs or testing.
Using Python in an IDE.

Once your specific Python environment is activated, you may need an Integrated Development Environment (IDE) to simplify your tasks. Here is a list of a few popular and free Python IDEs:

  • If you are doing data science, please see the Data Science Facility page for more details.
  • vscode: a popular IDE with support for multiple languages. To run vscode, type: code
  • Spyder: a nice, advanced IDE for Python. To run Spyder in your choice of Python environment type: spyder
  • pyCharm: A limited community edition of pyCharm is available. To run it, type pycharm
  • eclipse, a common and popular IDE. To run Eclipse, type: eclipse or choose it from the Programming menu.
  • Jupyter Notebook (iPython): an interactive way to run Python code on a browser. If you are using your environment, install a package named jupyterlab before you can run jupyter. JupyterLab is already installed in the CS preconfigured environment.
    To run jupyter, you need to open a terminal, and depending on your session, you would choose one of the following options. If you are in:
    • Graphical Session like Weblogin.cs or Local login, XRDP. Type: jupyter notebook --ip=`hostname`
      This will start the jupyter session and automatically open a browser for your graphical session.
    • Non-Graphical session like ssh type: jupyter notebook --ip=`hostname` --browser="none"
      This starts a jupyter session and tells you to copy and paste the URL to your local browser.
      NOTE: The” around the hostname are backward quotes. The backward quote key is usually at the upper left of your keyboard. Important: Due to firewall restrictions, this URL is only accessible from the machine you run in this notebook. This means that accessing the URL from your computer browser won’t work.
    • Web-based Jupyter. We also have a 100% web-based system you can run on your browser by going to jupyter.cs.rutgers.edu
Using System Python
 
By default, on Ubuntu 22.04, Python 3.10 is installed. To use it, you type: python3
 

Please be aware that we don’t recommend using the system Python because
1. It is not portable
2 A system update can break your code
3. It does not contain many modules.

The best practice is to create your own or use an existing environment.

 
If you must, Python allows you to install a site-specific module. To install your module type:
pip install module_name --user

The module is installed in your home directory in a hidden directory, for example, for Python 3.10, ~/.local/lib/python3.10/.

Storage Issue

If you have a large project or are working in a tight space, you can move your local Python modules elsewhere. User Python modules are stored in the ~/.local folder by default. To move it to the familiar/users disk, where you have 100GB of quota, as follows:
mv ~/.local /common/users/~your_netid/local
And create a soft link to your home directory for ~/.local using:
ln -s /common/users/~your_netid/local ~/.local

Note: Please be aware that your local modules may interfere with those already installed in your environment if they are not maintained or updated over time.
 
Removing your existing Anaconda settings

When Anaconda was initially set up, it added a code section in your~/.bashrc

To clean up,

    • Edit your~/.bashrc and remove this line
export PATH="$PATH:/koko/system/anaconda/bin"
    • Remove the anaconda section as shown below:
# <<< conda initialize >>>
...
...

# <<< conda initialize <<<
    • Log out and log in again

Further reading: CUDA

  1. CUDA/AI Learning Tools in CS Linux systems.
  2. Scheduler for Long GPU Jobs
  3. Using Virtual Environments in Jupyter Notebook and Python
  4. Jupyter Notebook for Beginners: A Tutorial
  5. Adding An Environment to Jupyter Notebooks
  6. 10 tips on using Jupyter Notebook
For help with our systems or immediate assistance, visit the LCSR Operator at CoRE 235 or call 848-445-2443. Otherwise, see CS HelpDesk. Don’t forget to include your NetID along with descriptions of your problem.