- Знакомство с Anaconda: что это такое и как установить
- Простое руководство по Anaconda и его установке на Ubuntu 16.04 (64-bit).
- Что такое Anaconda?
- Как возникла Anaconda?
- Простая установка
- Шаг 1: скачивание bash-скрипта Anaconda
- Шаг 2: проверка целостности
- Шаг 3: запуск bash-скрипта
- Шаг 4: установка криптографических библиотек
- Шаг 5: подтверждение папки
- Шаг 6: активация и проверка
- Getting started with condaВ¶
- Before you startВ¶
- ContentsВ¶
- Starting condaВ¶
- Managing condaВ¶
- Managing environmentsВ¶
- Managing PythonВ¶
- Managing packagesВ¶
- Getting started with condaВ¶
- Before you startВ¶
- ContentsВ¶
- Starting condaВ¶
- Managing condaВ¶
- Managing environmentsВ¶
- Managing PythonВ¶
- Managing packagesВ¶
Знакомство с Anaconda: что это такое и как установить
Простое руководство по Anaconda и его установке на Ubuntu 16.04 (64-bit).
May 21, 2019 · 4 min read
Что такое Anaconda?
Перед тем, как изучать Anaconda, рассмотрим Conda.
Цитируем определение Conda с официального блога:
Conda — это менеджер пакетов с открытым кодом и система управления средой, которая работает на Windows, macOS и Linux.
Conda проста в установке, выполнении и обновлении пакетов и зависимостей. Conda легко создает, сохраняет, загружает и переключается между средами на локальном компьютере.
Она задумывалась для программ на Python, но может создавать пакеты и дистрибутивы программного обеспечения на любом языке .
Возникает вопрос: почему вдруг речь зашла о Conda? Все мы знаем, что это система управления пакетами, которая используется для установки и управления пакетов приложений, написанных на Python.
Система имеет и свои ограничения. Ей можно пользоваться только для пакетов Python.
pip работает с Python и пренебрегает зависимостями из не-Python библиотек (HDF5, MKL, LLVM), в исходном коде которых отсутствует файл установщика.
Проще говоря, pip – это менеджер пакетов, который облегчает установку, обновление и удаление пакетов Python. Он работает с виртуальными средами Python.
Conda – это менеджер пакетов для любого программного обеспечения (установка, обновление, удаление). Он работает с виртуальными системными средами.
Conda — это инструмент для управления пакетами и установщик с куда большим функционалом, чем в pip . Conda может обрабатывать зависимости библиотек вне пакетов Python, а также сами пакеты Python.
Кроме того, Conda создает виртуальную среду.
Как возникла Anaconda?
Conda написан на чистом Python, что облегчает его использование в виртуальных средах Python. Кроме того, Conda подходит для библиотек С, пакетов R, Java и т.д.
Он устанавливает двоичные системы. Инструмент conda build создает пакеты из исходного кода, а conda install выполняет установку из пакетов сборки Conda.
Conda является менеджером пакетов для Anaconda — дистрибутива Python, предоставляемого Continuum Analytics. Емкое описание Anaconda следующее:
Anaconda — это дистрибутивы Python и R. Он предоставляет все необходимое для решения задач по анализу и обработке данных (с применимостью к Python).
Anaconda — это набор бинарных систем, включающий в себя Scipy, Numpy, Pandas и их зависимости.
Scipy — это пакет статистического анализа.
Numpy — это пакет числовых вычислений.
Pandas — уровень абстракции данных для объединения и преобразования данных.
Anaconda полезна тем, что объединяет все это в единую систему.
Двоичная система Anaconda — это установщик, который собирает все пакеты с зависимостями внутри вашей системы.
Простая установка
Установка файлов иногда превращается в сущий ад. Но Anaconda куда проще, чем кажется. Я предпочитаю Ubuntu, поскольку здесь установка зависит от выполнения пары команд и хорошего сетевого подключения. Поэтому все становится еще проще. Вот дальнейшие шаги для установки Anaconda.
(Данный процесс подойдет только для 64-битных компьютеров).
Шаг 1: скачивание bash-скрипта Anaconda
Скачать последнюю версию bash-скрипта установщика Anaconda можно с официального сайта. Это можно сделать через выполнение команды curl. Если в вашей системе не установлен curl, то скачайте его через следующую команду.
Перейдите в папку /tmp.
После установки curl выполните следующую команду:
Размер файла — порядка 500 МБ, поэтому установка обычно занимает несколько минут. Пожалуйста, дождитесь полного скачивания файла.
Этот скриншот был сделан после скачивания скрипта. Убедитесь в стабильности сетевого подключения. В противном случае могут возникнуть ошибки при скачивании.
Шаг 2: проверка целостности
Для проверки целостности данных установщика воспользуемся криптографическим алгоритмом хеширования под названием SHA-2 (алгоритм безопасного хеширования).
Контрольная сумма генерируется следующей строкой после выполнения команды.
Шаг 3: запуск bash-скрипта
Мы почти закончили. Пакет загрузился. Теперь осталось запустить скрипт через нужную команду.
На стандартном этапе проверки у вас спросят, хотите ли вы установить Anaconda. Для продолжения установки введите yes .
Шаг 4: установка криптографических библиотек
Это часть предыдущего процесса. Установщик спрашивает у пользователя, хочет ли он установить все криптографические библиотеки. Введите yes и можете продолжать. Ориентируйтесь по скриншоту ниже – вы увидите примерно ту же информацию.
Шаг 5: подтверждение папки
Последним и итоговым шагом является подтверждение папки, куда будут выгружаться все пакеты Anaconda. Укажите путь, нажмите Enter и готово! Anaconda начнет творить чудеса, устанавливая все, что вам нужно!
Шаг 6: активация и проверка
Для активации установки нужно получить файл
/.bashrc через следующую команду:
Проверяем установку через команду conda .
Вы увидите данные по всем пакетам, доступным с установкой Anaconda.
Источник
Getting started with condaВ¶
Conda is a powerful package manager and environment manager that you use with command line commands at the Anaconda Prompt for Windows, or in a terminal window for macOS or Linux.
This 20-minute guide to getting started with conda lets you try out the major features of conda. You should understand how conda works when you finish this guide.
SEE ALSO: Getting started with Anaconda Navigator, a graphical user interface that lets you use conda in a web-like interface without having to enter manual commands. Compare the Getting started guides for each to see which program you prefer.
Before you startВ¶
You should have already installed Anaconda.
ContentsВ¶
Starting conda on Windows, macOS, or Linux. 2 MINUTES
Managing conda . Verify that Anaconda is installed and check that conda is updated to the current version. 3 MINUTES
Managing environments . Create environments and move easily between them. 5 MINUTES
Managing Python . Create an environment that has a different version of Python. 5 MINUTES
Managing packages . Find packages available for you to install. Install packages. 5 MINUTES
TOTAL TIME: 20 MINUTES
Starting condaВ¶
Windows
From the Start menu, search for and open «Anaconda Prompt.»
On Windows, all commands below are typed into the Anaconda Prompt window.
MacOS
Open Launchpad, then click the terminal icon.
On macOS, all commands below are typed into the terminal window.
Linux
Open a terminal window.
On Linux, all commands below are typed into the terminal window.
Managing condaВ¶
Verify that conda is installed and running on your system by typing:
Conda displays the number of the version that you have installed. You do not need to navigate to the Anaconda directory.
EXAMPLE: conda 4.7.12
If you get an error message, make sure you closed and re-opened the terminal window after installing, or do it now. Then verify that you are logged into the same user account that you used to install Anaconda or Miniconda.
Update conda to the current version. Type the following:
Conda compares versions and then displays what is available to install.
If a newer version of conda is available, type y to update:
We recommend that you always keep conda updated to the latest version.
Managing environmentsВ¶
Conda allows you to create separate environments containing files, packages, and their dependencies that will not interact with other environments.
When you begin using conda, you already have a default environment named base . You don’t want to put programs into your base environment, though. Create separate environments to keep your programs isolated from each other.
Create a new environment and install a package in it.
We will name the environment snowflakes and install the package BioPython. At the Anaconda Prompt or in your terminal window, type the following:
Conda checks to see what additional packages («dependencies») BioPython will need, and asks if you want to proceed:
Type «y» and press Enter to proceed.
To use, or «activate» the new environment, type the following:
Windows: conda activate snowflakes
macOS and Linux: conda activate snowflakes
conda activate only works on conda 4.6 and later versions.
For conda versions prior to 4.6, type:
Windows: activate snowflakes
macOS and Linux: source activate snowflakes
Now that you are in your snowflakes environment, any conda commands you type will go to that environment until you deactivate it.
To see a list of all your environments, type:
A list of environments appears, similar to the following:
The active environment is the one with an asterisk (*).
Change your current environment back to the default (base): conda activate
For versions prior to conda 4.6, use:
macOS, Linux: source activate
When the environment is deactivated, its name is no longer shown in your prompt, and the asterisk (*) returns to base. To verify, you can repeat the conda info —envs command.
Managing PythonВ¶
When you create a new environment, conda installs the same Python version you used when you downloaded and installed Anaconda. If you want to use a different version of Python, for example Python 3.5, simply create a new environment and specify the version of Python that you want.
Create a new environment named «snakes» that contains Python 3.9:
When conda asks if you want to proceed, type «y» and press Enter.
Activate the new environment:
Windows: conda activate snakes
macOS and Linux: conda activate snakes
conda activate only works on conda 4.6 and later versions.
For conda versions prior to 4.6, type:
Windows: activate snakes
macOS and Linux: source activate snakes
Verify that the snakes environment has been added and is active:
Conda displays the list of all environments with an asterisk (*) after the name of the active environment:
The active environment is also displayed in front of your prompt in (parentheses) or [brackets] like this:
Verify which version of Python is in your current environment:
Deactivate the snakes environment and return to base environment: conda activate
For versions prior to conda 4.6, use:
macOS, Linux: source activate
Managing packagesВ¶
In this section, you check which packages you have installed, check which are available and look for a specific package and install it.
To find a package you have already installed, first activate the environment you want to search. Look above for the commands to activate your snakes environment .
Check to see if a package you have not installed named «beautifulsoup4» is available from the Anaconda repository (must be connected to the Internet):
Conda displays a list of all packages with that name on the Anaconda repository, so we know it is available.
Install this package into the current environment:
Check to see if the newly installed program is in this environment:
Источник
Getting started with condaВ¶
Conda is a powerful package manager and environment manager that you use with command line commands at the Anaconda Prompt for Windows, or in a terminal window for macOS or Linux.
This 20-minute guide to getting started with conda lets you try out the major features of conda. You should understand how conda works when you finish this guide.
SEE ALSO: Getting started with Anaconda Navigator, a graphical user interface that lets you use conda in a web-like interface without having to enter manual commands. Compare the Getting started guides for each to see which program you prefer.
Before you startВ¶
You should have already installed Anaconda.
ContentsВ¶
Starting conda on Windows, macOS, or Linux. 2 MINUTES
Managing conda . Verify that Anaconda is installed and check that conda is updated to the current version. 3 MINUTES
Managing environments . Create environments and move easily between them. 5 MINUTES
Managing Python . Create an environment that has a different version of Python. 5 MINUTES
Managing packages . Find packages available for you to install. Install packages. 5 MINUTES
TOTAL TIME: 20 MINUTES
Starting condaВ¶
Windows
From the Start menu, search for and open «Anaconda Prompt.»
On Windows, all commands below are typed into the Anaconda Prompt window.
MacOS
Open Launchpad, then click the terminal icon.
On macOS, all commands below are typed into the terminal window.
Linux
Open a terminal window.
On Linux, all commands below are typed into the terminal window.
Managing condaВ¶
Verify that conda is installed and running on your system by typing:
Conda displays the number of the version that you have installed. You do not need to navigate to the Anaconda directory.
EXAMPLE: conda 4.7.12
If you get an error message, make sure you closed and re-opened the terminal window after installing, or do it now. Then verify that you are logged into the same user account that you used to install Anaconda or Miniconda.
Update conda to the current version. Type the following:
Conda compares versions and then displays what is available to install.
If a newer version of conda is available, type y to update:
We recommend that you always keep conda updated to the latest version.
Managing environmentsВ¶
Conda allows you to create separate environments containing files, packages, and their dependencies that will not interact with other environments.
When you begin using conda, you already have a default environment named base . You don’t want to put programs into your base environment, though. Create separate environments to keep your programs isolated from each other.
Create a new environment and install a package in it.
We will name the environment snowflakes and install the package BioPython. At the Anaconda Prompt or in your terminal window, type the following:
Conda checks to see what additional packages («dependencies») BioPython will need, and asks if you want to proceed:
Type «y» and press Enter to proceed.
To use, or «activate» the new environment, type the following:
Windows: conda activate snowflakes
macOS and Linux: conda activate snowflakes
conda activate only works on conda 4.6 and later versions.
For conda versions prior to 4.6, type:
Windows: activate snowflakes
macOS and Linux: source activate snowflakes
Now that you are in your snowflakes environment, any conda commands you type will go to that environment until you deactivate it.
To see a list of all your environments, type:
A list of environments appears, similar to the following:
The active environment is the one with an asterisk (*).
Change your current environment back to the default (base): conda activate
For versions prior to conda 4.6, use:
macOS, Linux: source activate
When the environment is deactivated, its name is no longer shown in your prompt, and the asterisk (*) returns to base. To verify, you can repeat the conda info —envs command.
Managing PythonВ¶
When you create a new environment, conda installs the same Python version you used when you downloaded and installed Anaconda. If you want to use a different version of Python, for example Python 3.5, simply create a new environment and specify the version of Python that you want.
Create a new environment named «snakes» that contains Python 3.9:
When conda asks if you want to proceed, type «y» and press Enter.
Activate the new environment:
Windows: conda activate snakes
macOS and Linux: conda activate snakes
conda activate only works on conda 4.6 and later versions.
For conda versions prior to 4.6, type:
Windows: activate snakes
macOS and Linux: source activate snakes
Verify that the snakes environment has been added and is active:
Conda displays the list of all environments with an asterisk (*) after the name of the active environment:
The active environment is also displayed in front of your prompt in (parentheses) or [brackets] like this:
Verify which version of Python is in your current environment:
Deactivate the snakes environment and return to base environment: conda activate
For versions prior to conda 4.6, use:
macOS, Linux: source activate
Managing packagesВ¶
In this section, you check which packages you have installed, check which are available and look for a specific package and install it.
To find a package you have already installed, first activate the environment you want to search. Look above for the commands to activate your snakes environment .
Check to see if a package you have not installed named «beautifulsoup4» is available from the Anaconda repository (must be connected to the Internet):
Conda displays a list of all packages with that name on the Anaconda repository, so we know it is available.
Install this package into the current environment:
Check to see if the newly installed program is in this environment:
Источник