Python
Miniconda
What is Miniconda?
Miniconda is a free minimal installer for conda. It is a small, bootstrap version of Anaconda that includes only conda, Python, the packages they depend on, and a small number of other useful packages, including pip, zlib, and a few others. Use the conda install command to install 720+ additional conda packages from the Anaconda repository.
Installation
macOS
$ mkdir -p ~/miniconda3
$ curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh\
-o ~/miniconda3/miniconda.sh
$ bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
$ rm -rf ~/miniconda3/miniconda.sh
$ source ~/miniconda3/bin/activate
$ conda init --all
Windows Command Prompt
Open cmd
as an administrator and run the following commands.
> curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe -o miniconda.exe
> start /wait "" .\miniconda.exe /S
#or
> start /wait "" .\miniconda.exe /S /D=<path_to_install>
> del miniconda.exe
- /D - Specify the installation directory. For example
/D=C:\miniconda
.
Windows PowerShell
> curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe -o miniconda.exe
> Start-Process -FilePath ".\miniconda.exe" -ArgumentList "/S" -Wait
#or
> Start-Process -FilePath ".\miniconda.exe" -ArgumentList "/S", "/D=<path_to_install>" -Wait
> del miniconda.exe
Add the Miniconda to the environment variables.
> setx PATH "%PATH%;<path_to_install>;<path_to_install>\Scripts;<path_to_install>\Library\bin"
Linux
If you want to confirm server architecture, you can run the following command first:
$ uname -m
ARM
$ mkdir -p ~/miniconda3
$ wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh -O ~/miniconda3/miniconda.sh
$ chmod +x ~/miniconda3/miniconda.sh
$ ~/miniconda3/miniconda.sh
$ source ~/.bashrc
X86
$ mkdir -p ~/miniconda3
$ wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
$ bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
$ rm ~/miniconda3/miniconda.sh
$ source ~/miniconda3/bin/activate
$ conda init --all
If you want to reverse the init, you can run the following command.
$ conda init --reverse
It will remove the (base) in the terminal.
Uninstall Conda
$ cd ~/miniconda3
$ ./uninstall.sh
Environment
Creating a new environment on Linux and macOS, you can use terminal. On Windows, you need to use the Anaconda Prompt.
$ conda create -n <name> python=3.11
Or you can create a new environment with additional packages
$ conda create -n <name> python=3.11 transformer numpy
List all environments
$ conda env list
Activate an environment
$ conda activate gerbergpt
Deactivate an environment
$ conda deactivate
Remove an environment
$ conda remove -n <name> --all
If you have PyCharm IDE installed, you can use it to manage your environments. PyCharm will automatically detect the Miniconda installation and list all environments.
If you have miniconda installed in a different location, you need to add the path to the environment variables. For example:
<path_to_miniconda>/condabin/conda.bat
. Don't select any exe from any env folder you created.