Conda
Anaconda is a distribution that provides a collection of packages for scientific computing in Python and R, including fields such as data science, machine learning applications, large-scale data processing, and predictive analytics.
The Anaconda distribution is used by over 12 million users and includes more than 1,400 popular data science packages suitable for Windows, Linux, and macOS.
To install Anaconda, download the appropriate distribution for your OS from https://www.anaconda.com and install it.
(Examples) Windows, macOS, Linux
Anaconda currently offers versions based on Python 3.7 and Python 2.7.
Conda is an application provided by Anaconda for managing package versions.
Conda helps Python users easily resolve dependency issues, which are often encountered during package installation.
This document introduces how to use conda packages for Python users on the KISTI system.
The "/home01/userID" in the introduction page refers to the home directory of the test account, and should be appropriately replaced with your own path.
A. Use of Conda
Miniconda can be downloaded for each OS from the following site: https://docs.conda.io/en/latest/miniconda.html.
Anaconda can be downloaded for each OS from the following site: https://www.anaconda.com/distribution/#download-section.
clean
Remove unused packages and caches.
config
Modify configuration values in .condarc. This is modeled after the git config command.
Writes to the user .condarc file (/home01/userID/.condarc)
by default.
create
Create a new conda environment from a list of specified packages.
help
Displays a list of available conda commands and their help strings.
info
Display information about current conda install.
init
Initialize conda for shell interaction. (Experimental)
install
Installs a list of packages into a specified conda environment.
list
List linked packages in a conda environment.
package
Low-level conda package utility. (Experimental)
remove
Remove a list of packages from a specified conda environment.
uninstall
Alias for conda remove.
run
Run an executable in a conda environment. (Experimental)
search
Search for packages and display associated information.
The input is a MatchSpec, a query language for conda packages.
update
Updates conda packages to the latest compatible version.
upgrade
Alias for conda update
How to Initialize Conda
You can add settings to the .bashrc file in your home directory by using the conda init command.
How to Change the Conda Path
By default, the conda environment and package paths are set to the home directory, but they can be changed to other locations, such as scratch.
B. Create Conda Environment
Conda environments create independent virtual execution environments in Python, making it easy to manage package versions.
You can create a conda environment using the command conda create “-n [ENVIRONMENT]”.
By default, it will be created under the envs directory within the conda path, with the specified environment name.
If you use the “--use-local” option, it will be created in the user’s home directory (${HOME}/.conda/envs/[environment_name]).
C. Install and Check Packages in Conda Environment
You can install a package using conda install [package name].
Packages from a specific conda channel can be installed with the command “conda install -c [channel name] [package name]”.
The packages will be installed under the conda environment path created in step "2" above.
Example :
D. Check Conda Environment List
You can view the list of environments using “conda-env list” or “conda env list”.
E. Export Conda Environment
The conda-pack package is required before exporting.
※ (Reference) https://conda.github.io/conda-pack
You can use “conda pack -n [ENVIRONMENT] -o [file name]” to package a conda environment for use on another system.
(Example) When the external internet is not available or when you need to use the same conda environment on another system.
F. Import Conda Environment
You can use a conda environment that was packaged with conda pack by setting it up as shown in the example below.
G. Deleting a Conda Environment
You can delete a conda environment using either "conda-env remove -n [ENVIRONMENT]" or "conda env remove –n [ENVIRONMENT]".
Last updated on November 11, 2024.
Last updated