CLEAR Python and Conda Environment Guide

Install, configure, and manage Python and Conda environments for development and research workflows on CLEAR

Introduction

Python is one of the most widely used programming languages for scientific computing, data analysis, software development, automation, and machine learning. The CLEAR computing environment provides both system-managed Python installations and support for user-managed Conda environments, allowing you to develop and run applications in a flexible and reproducible environment.

This guide provides instructions for using Python and Conda on the CLEAR systems. It includes information about using the available Python installation, installing and configuring Miniconda on Windows and CLEAR, and installing common Python packages for coursework, research, and software development.

Python on CLEAR

Using Python on CLEAR

Python 3.9 is available on the CLEAR systems at:

/opt/rice/python-3.9.1/bin/python3.9

This installation is not the system-default Python. If you need this specific version, you can either run it using its full path or temporarily add its directory to your PATH.

Quick Start

To use Python 3.9 for the current terminal session:

export PATH=/opt/rice/python-3.9.1/bin:${PATH}

Verify the Python version:

python3.9 --version

You can also verify the installation directly without modifying your PATH:

/opt/rice/python-3.9.1/bin/python3.9 --version

Using Python for a Single Terminal Session

After connecting to a CLEAR system through SSH, enter:

export PATH=/opt/rice/python-3.9.1/bin:${PATH}

This modifies the PATH only for the current terminal session. If you open another SSH session or log out and reconnect, you will need to run the command again.

For students, using a per-session or per-application configuration is often preferable to permanently modifying your environment. This helps prevent settings required for one class or project from affecting work for another.

Running a Python Application

You can run Python scripts directly with the desired Python executable. The following example creates and runs a simple "Hello, world!" program.

Create the Python file:

cat > hello.py <<'EOF'
# This program prints Hello, world!

print('Hello, world!')
EOF

Run the program using the CLEAR Python 3.9 installation:

/opt/rice/python-3.9.1/bin/python3.9 hello.py

You should see:

Hello, world!

Using a Wrapper Script

If your application requires a specific Python environment or additional command-line options, you can create a wrapper script.

cat > run-app.sh <<'EOF'
#!/usr/bin/env bash

# Enable verbose shell output when started with:
# DEBUG=true ./run-app.sh
[[ ${DEBUG} ]] && set -xvu

# Add Python 3.9 to PATH
PATH=/opt/rice/python-3.9.1/bin:${PATH}

PYTHON='python3.9'

# Verify the Python version
${PYTHON} --version

# Add additional Python options here if needed
# py_opts="${py_opts} <additional_options>"

# Run the application
${PYTHON} ${py_opts} hello.py
EOF

Make the script executable:

chmod u+x run-app.sh

Run the script:

./run-app.sh

For verbose shell output:

DEBUG=true ./run-app.sh

Permanent PATH Configuration

If you regularly need this specific Python installation, you can add it to your shell initialization file. Before doing this, consider whether a permanent change could affect other courses, projects, or applications.

Determine your current shell:

echo $SHELL

Common shell initialization files include:

Common Shell Initialization Files
Shell Common Initialization File
sh / bash / ksh ~/.profile
csh / tcsh ~/.login
zsh ~/.zprofile

For Bourne-compatible shells such as bash, add the following line to the appropriate initialization file:

export PATH=/opt/rice/python-3.9.1/bin:${PATH}

Save the file, then log out and log back in for the change to take effect.

If you want to change your default shell, see Modify Your Default Linux Shell.

Miniconda Python Installation on Windows

Installing Miniconda on Windows

Miniconda provides a lightweight installation of Conda and Python that allows you to create and manage your own Python environments on a Windows computer.

The instructions below use two terminal environments:

  • PowerShell — used to download and start the Miniconda installer.
  • Anaconda Prompt (miniconda3) — used to run Python and Conda commands after installation.

Download Miniconda

Open PowerShell from the Windows search menu.

Download the current 64-bit Miniconda installer:

curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe -o miniconda.exe

This downloads the installer as miniconda.exe in your current directory.

To open the current directory in File Explorer, run:

start .

File Explorer showing the downloaded Miniconda installer

Double-click miniconda.exe to start the installation process.

Install Miniconda

Follow the installer prompts:

  1. Select Next.
  2. Accept the license agreement.
  3. Select Just Me unless you have a specific reason to install for all users.
  4. Accept or choose the desired installation directory.
  5. Review the advanced installation options before continuing.

Miniconda advanced installation options

In general, it is best to avoid adding Miniconda directly to the Windows system PATH unless you understand how that change may affect other Python installations. You can use the dedicated Anaconda Prompt instead.

Complete the installation and select Finish.

Run Miniconda Python

Use Windows search to locate and open Anaconda Prompt (miniconda3).

Anaconda Prompt terminal window

Verify that Python is available:

python --version

The exact Python version returned will depend on the version of Miniconda currently installed.

Install a Python Package

Python packages can be installed using Conda or pip, depending on your environment and requirements.

For example, to install NumPy using pip:

python -m pip install numpy

Start Python:

python

At the Python prompt, test the installation:

import numpy

If no error is displayed, NumPy was imported successfully.

Exit Python:

exit()

Installing Miniconda on CLEAR

Miniconda on CLEAR

Miniconda provides a lightweight Conda installation that allows you to create and manage personal Python environments within your CLEAR home directory.

This can be useful when you need Python packages or versions that differ from the system-provided Python environment.

For additional information about Miniconda, see Miniconda Documentation.

Before Installing Miniconda

Connect to CLEAR using SSH and make sure you have a working CLEAR home directory.

Miniconda and Conda environments can consume a significant amount of storage. Before installing Miniconda, check the amount of space currently being used in your home directory:

du -sh ~

If you are already using a large amount of your available storage, clean up unnecessary files before installing additional software or Python environments.

Check for an Existing Conda Installation

Before installing Miniconda, check whether you already have a Miniconda or Anaconda installation:

ls -ld ~/miniconda3 ~/anaconda3 2>/dev/null

If one of these directories exists, you may already have Conda installed. Verify the existing installation before creating another one.

Install Miniconda

Download the current 64-bit Linux Miniconda installer:

cd ~
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

Run the installer in batch mode:

bash ~/Miniconda3-latest-Linux-x86_64.sh -b -p ~/miniconda3

After installation, initialize Conda for your shell.

For bash:

~/miniconda3/bin/conda init bash

For tcsh:

~/miniconda3/bin/conda init tcsh

After initialization, log out of CLEAR and log back in, or start a new SSH session, to load the updated shell configuration.

After confirming that Miniconda was installed successfully, you can remove the downloaded installer:

rm ~/Miniconda3-latest-Linux-x86_64.sh

Test the Miniconda Environment

After reconnecting to CLEAR, verify the installation:

which python
python --version
which conda
conda --version

If Miniconda is active, the Python path should normally point to a location under your ~/miniconda3 directory.

Create a Conda Environment

Rather than installing all packages into the base Conda environment, you can create separate environments for different classes, projects, or research workflows.

For example:

conda create -n myenv python -y

Activate the environment:

conda activate myenv

When you are finished working in the environment:

conda deactivate

Install Common Python Packages

After activating the Conda environment where you want the packages installed, you can install commonly used scientific Python packages:

conda install numpy scipy pandas matplotlib -y

If a class or research project requires additional packages, install them in the appropriate Conda environment according to the requirements provided by your instructor or project documentation.

Managing Conda Environments

List your available Conda environments:

conda env list

Activate an existing environment:

conda activate <environment_name>

Deactivate the current environment:

conda deactivate

Because Conda environments can consume substantial storage, periodically review environments that are no longer needed.

 



Keywords:
Python, Conda, Miniconda, virtual environments, programming 
Doc ID:
162197
Owned by:
Amod U. in Rice U
Created:
2026-06-24
Updated:
2026-08-06
Sites:
Rice University