본문 바로가기
목차
개발환경

[Env] Mamba 설치하기.

by ds31x 2023. 8. 23.
728x90
반응형

이 문서는 conda가 설치되지 않은 상태에서 mamba를 설치하는 과정을 기재함.

(conda를 개선한 것이 mamba라서 fresh하게 mamba install을 수행.)

  • mamba는 거의 conda와 사용법은 같지만 꽤나 빠른 편이다.

https://github.com/mamba-org/mamba

 

GitHub - mamba-org/mamba: The Fast Cross-Platform Package Manager

The Fast Cross-Platform Package Manager. Contribute to mamba-org/mamba development by creating an account on GitHub.

github.com

 

사용법은 다음의 conda로 설명한 문서를 참고할 것.

2025.03.02 - [개발환경] - [Tool] conda 사용법 - Anaconda and Miniconda

 

[Tool] conda 사용법 - Anaconda and Miniconda

1. Conda란?프로그래밍 언어(특히 Python)의 패키지, 종속성을 관리하기 위한 오픈 소스 패키지 관리 시스템(or Package Manager)과이들이 설치되어 구성되는 (가상)환경을 관리하는 환경관리시스템(package

ds31x.tistory.com

2025.03.02 - [개발환경] - [Tool] conda 사용법 - Anaconda and Miniconda

 

[Tool] conda 사용법 - Anaconda and Miniconda

1. Conda란?프로그래밍 언어(특히 Python)의 패키지, 종속성을 관리하기 위한 오픈 소스 패키지 관리 시스템(or Package Manager)과이들이 설치되어 구성되는 (가상)환경을 관리하는 환경관리시스템(package

ds31x.tistory.com


macOS (brew이용)

 

이방식은 더이상 지원되지 않음. miniforge를 권장.

brew install --cask mambaforge

 

가장 간단한 방법임.

 

설치 후 다음의 명령어를 수행하여 .zshrc등에 환경초기화를 시킴.

conda init "$(basename "${SHELL}")"

 

https://formulae.brew.sh/cask/mambaforge#default

 

mambaforge

Homebrew’s package index

formulae.brew.sh


Linux 기준 (WSL, macOS 포함)

설치파일 다운로드

다음의 URL이 mamba를 설치하기 위한 공식 설명임.

https://github.com/conda-forge/miniforge#install

 

GitHub - conda-forge/miniforge: A conda-forge distribution.

A conda-forge distribution. Contribute to conda-forge/miniforge development by creating an account on GitHub.

github.com

wget으로 설치를 위한 sh파일을 다운로드 받고 이를 수행함.

wget "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
bash Miniforge3-$(uname)-$(uname -m).sh

# 이전 방식
# wget "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh"
# bash Mambaforge-$(uname)-$(uname -m).sh

 

다음은 설치 제거에 대한 설명임.

제거과정을 살펴보면 install시 추가된 파일들을 제대로 이해할 수 있으므로
설치할 때에도 한번 읽어보길 바람.

 

1. resource config 파일들을 원래대로 복귀.

# Use this first command to see what rc files will be updated
conda init --reverse --dry-run
# Use this next command to take action on the rc files listed above
conda init --reverse
# Temporarily IGNORE the shell message 
#       'For changes to take effect, close and re-open your current shell.', 
# and CLOSE THE SHELL ONLY AFTER the 3rd step below is completed.

2. mamba (or minforge) 의 base 환경 관련 folder와 subfolder를 제거.

CONDA_BASE_ENVIRONMENT=$(conda info --base)
echo The next command will delete all files in ${CONDA_BASE_ENVIRONMENT}
# Warning, the rm command below is irreversible!
# check the output of the echo command above
# To make sure you are deleting the correct directory
rm -rf ${CONDA_BASE_ENVIRONMENT}

3. global configuration을 제거.

echo ${HOME}/.condarc will be removed if it exists
rm -f "${HOME}/.condarc"
echo ${HOME}/.conda and underlying files will be removed if they exist.
rm -fr ${HOME}/.conda

설치

앞서 설명한 install shell을 수행하면, 먼저 다음과 같이 license관련 하여 따를지를 물어보는데 Enter를 쳐서 확인하고 yes를 입력하여 따른다고 하고 진행한다.

Welcome to Mambaforge 23.3.1-0

In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>

라이센스 관련 내용들...

Do you accept the license terms? [yes|no]
[no] >>>
  • yes 를 입력하고 enter.

이후 mamba 설치 장소를 설정해야한다. 기본으로 /home/<User>/mambaforge 인데 바꾸지 않는 것을 권함.

Mambaforge will now be installed into this location:
/home/dsaint31/mambaforge

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below
  
[/home/dsaint31/mambaforge] >>>
  • enter를 눌러서 진행.

이후 설치가 이루어지면서 설치 관련 메시지들이 출력된다.


설정

설치가 끝나면 셀의 session이 시작될 때 기본으로 mamba (or conda)가 수행될지를 지정할 수 있음. yes로 지정하면 편하다.

Do you wish the installer to initialize Mambaforge
by running conda init? [yes|no]
[no] >>>
  • python 위주의 개발 장비라면 yes하는게 편함.

만일 이후에 conda가 기본실행되는 것을 원치 않으면 다음을 수행하면 됨.

conda config --set auto_activate_base false

 

이후로 terminal을 다시 시작하면 base 환경이 기본으로 실행된 것을 다음 shell prompt로 확인 가능함.

(base) dsaint31@dsgram17:/mnt/c/Users/dsain$

업데이트

mamba가 설치되고 나서 업데이트를 해주는게 좋다.

mamba update mamba

참고자료

https://dsaint31.tistory.com/329

 

[Conda] Install Conda on WSL2 (miniconda)

1. wsl 설치wsl --install2023.06.12 - [Programming] - [WSL] Install WSL (Windows Subsystem for Linux) [WSL] Install WSL (Windows Subsystem for Linux)[WSL] Install WSLPre-requirements.windows 10 이상 : ( version 2004 , build 19041 이상이어야 함.)wi

dsaint31.tistory.com

 

https://mamba.readthedocs.io/en/latest/mamba-installation.html#mamba-install

 

Mamba Installation — documentation

 

mamba.readthedocs.io

 

728x90