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
- [Open] Anaconda Navigator
- [Click ] (No, don’t show again) to update Anaconda Navigator
- [Change] Applications on [env-stats]
- [Click] [Launch] Spyder
- Run example code at: https://www.geeksforgeeks.org/running-python-script-on-gpu/
Useful Conda Commands
conda env list
— Show all available conda environmentsconda activate
ENV-NAME — Selects conda environment ENV-NAMEconda env export >
ENV-NAME.yml — Exports current environment to file ENV-NAME.ymlconda list
— Shows all conda packages installed for active environmentconda search
NAME — Searches for conda packages matching NAMEconda install -y
NAME — Installs conda packages matching NAMEconda deactivate
ENV-NAME — Deselects conda environment ENV-NAMEconda env remove -n
ENV-NAME — Deletes conda environment ENV-NAME