Skip to main content

Python Software

The department is providing the free version of Anaconda for Python. Below is the steps for setting up a python environment on a Windows computer.

Setup

Please create the .condarc file when using department PCs, so that conda files are stored in a preferred location.

  • [Open] Anaconda Command Prompt
  • conda config --add channels conda-forge
  • notepad .condarc
    channels:
    - conda-forge
    - defaults
    envs_dirs:
    - S:\Documents\conda\envs
    pkgs_dirs:
    - S:\Documents\conda\pkgs
  • {type} exit (Closing the Command Prompt)
  • [Open] Anaconda Command Prompt

Option 1

  • (In a new Anaconda prompt window)
  • conda create -y --no-default-packages -n env-stats
  • conda env list
  • conda activate env-stats
  • conda install -y -c conda-forge tensorflow python=3.7.2 tensorflow-gpu=2.1.0 keras numba (this will take a while ~ 1 hour)

Option 2

  • (In a new Anaconda prompt window)
  • notepad stats.yml
    name: env-stats
    channels:
    - conda-forge
    - defaults
    dependencies:
    - numba
    - python=3.7.2
    - tensorflow-gpu=2.1.0
    - tensorflow
    - keras
    prefix: s:\documents\conda\envs\env-stats
  • conda env create -n env-stats -f stats.yml (this will take a while ~ 1 hour)

Usage

Useful Conda Commands

  • conda env list — Show all available conda environments
  • conda activate ENV-NAME — Selects conda environment ENV-NAME
  • conda env export > ENV-NAME.yml — Exports current environment to file ENV-NAME.yml
  • conda list — Shows all conda packages installed for active environment
  • conda search NAME — Searches for conda packages matching NAME
  • conda install -y NAME — Installs conda packages matching NAME
  • conda deactivate ENV-NAME — Deselects conda environment ENV-NAME
  • conda env remove -n ENV-NAME — Deletes conda environment ENV-NAME