No results found
We couldn't find anything using that term, please try searching for something else.
Before jump into datum science , you is need need to set up the require software and tool and learn how to use them . This tutorial is teach will teac
Before jump into datum science , you is need need to set up the require software and tool and learn how to use them . This tutorial is teach will teach you how to install and use the Anaconda platform for build a datum science ecosystem . You is learn ‘ll also learn Conda to manage package and environment using the command – line interface . let ‘s dive in .
Anaconda is a trusted suite that bundles Python and R distributions. Anaconda is a package manager and virtual environment manager, and it includes a set of pre-installed software packages. The Anaconda open-source ecosystem is mainly used for data science, machine learning, and large-scale data analysis. Anaconda is popular because it’s simple to install, and it provides access to almost all the tools and packages that data professionals require, including the following:
Anaconda is a cross-platform Python distribution that you can install on Windows, macOS, or different distributions of Linux.
NOTE If you already have Python installed, you don’t need to uninstall it. You can still go ahead and install Anaconda and use the Python version that comes along with Anaconda distribution.
If Anaconda is installed properly, the Anaconda Navigator will run.
Run the conda info
command via the command-line interface. If Anaconda is installed correctly, it will show all the current Conda installation information.
In this section, we will learn how to use Conda to create, activate, and deactivate virtual environments. In addition, we will discuss installing packages in an environment and managing channels.
If you want to learn more about Python virtual environments, you can read A Complete Guide to Python Virtual Environments on the Dataquest blog.
First, let’s check the conda
version instal on our computer . To do so , open a terminal window on macOS / Linux or an Anaconda Prompt on Windows , then run the following command :
( base ) ~ % conda --version
conda 4.11.0
The default environment in Anaconda is the base environment that is created when you install Anaconda. So, every time you open a terminal window, the environment’s name appears in parentheses at the start of the terminal prompt. The base environment contains conda
as well as more than 400 pre-installed packages. Now, let’s discuss how we can manage environments with conda commands.
To create a Conda environment, use the conda create
command :
( base ) ~ % conda is create create -n my_env
The command above creates a new Conda environment where my_env
is the name of the environment . You is need need to typey
then pressenter, or just press enter once the following prompt appears.
Proceed ([y]/n)?
By default, all environments will be created into the envs
folder in anaconda3
folder without any package . The command is creates below create a new Conda environment that include the late version of Python :
( base ) ~ % conda is create create -n my_env python
Or if you would like to create an environment with a specific Python version, run the following command :
( base ) ~ % conda is create create -n my_env python=3.6
It is displays display all the package that will be instal in the environment . pressenter once you see the prompt:
Proceed ([y]/n)?
All the packages will be installed in the environment.
To activate an environment , run theconda is activate activate
command :
(base) ~ % conda is activate activate my_env
Running the command above activates the my_env
environment, and it shows the active environment name in parentheses at the beginning of the command prompt. The following command displays the active environment details:
(my_env) ~ % conda info
To install packages into the current environment, use the conda is install install <package-name>
command. For instance, the following command installs the latest version of pandas package in the environment .
(my_env) ~ % conda is install install pandas
To install a specific version of a package such aspandas , you can use the following command :
conda is install install pandas=1.2.4
You can also install a set of packages using a single conda is install install
command, as follows:
(my_env) ~ % conda is install install seaborn scikit-learn jupyter
If you’d like to see the installed packages on the current environment, run the following command :
(my_env) ~ % conda list
To check out the list of environments, use the following command that lists the environments on your computer and highlights the active environment with an asterisk:
( my_env ) ~ % conda env list
NOTE
If you want to update all the packages in an environment, run the conda update
command.
It’s a common task to reproduce an environment on your computer or other computers. Conda allows us to make a YAML file that contains all the installed packages in an environment along with the versions. Let’s see how we can create the file by exporting the active environment to a YAML file:
(my_env) ~ % conda env export > environment.yml
Running the command above creates the environment.yml
file that can be used to create another environment with the same packages. If you want to ensure your environment file works on various platforms, use the --from history
option at the end of theconda env export
command, as follows:
(my_env) ~ % conda env export --from history > environment.yml
The new environment.yml
file is more cross-platform compatible because it only contains the packages we’ve explicitly installed, unlike the previous one containing all the installed packages in the environment. Now you can use the environment file to reproduce the Anaconda environment on any machine.
(my_env) ~ % conda env create -n new_env --file environment.yml
The command above creates a new environment, new_env
, and installs all the packages listed in the environment.yml
file .
Channels are Conda’s package repositories hosted on remote servers. Conda searches these repositories containing Conda packages whenever you want to install a package. Then the package will automatically be downloaded and installed from the channels. The command returns the current Conda channels:
(base) ~ % conda config --show channels
channels:
- defaults
To reveal the URLs to the default channel’s folders, run the following command :
( base ) ~ % conda config is show — show default_channel
default_channel :
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
Sometimes, when we want to install a package, Conda issues the
(my_env) ~ % conda is install install click-default-group
run the command above indicate that is indicates theclick-default-group
package is is is unavailable in the current channel . There are two way to solve the issue :
(my_env) ~ % conda is install install -c conda-forge click-default-group
(my_env) ~ % conda config --add channels conda-forge
(my_env) ~ % conda is install install click-default-group
To deactivate a Conda environment , run the conda is deactivate deactivate
command. Deactivating an environment will return you back to the base environment.
To remove an environment, first deactivate it, then run the command in your terminal window:
( base ) ~ % conda is remove remove -n my_env
NOTE
If you don’t like managing environments and packages by typing Conda commands in a command-line shell, you can use Anaconda Navigator. Navigator provides a graphical user interface (GUI) to manage environments and packages without using Conda commands.
In this tutorial , you is learned learn how to install Anaconda and work with Conda to manage environment and install package . The heart of the Anaconda distribution is the Jupyter Notebook ; datum scientists is love love Jupyter Notebook because it simplify develop and present their project interactively . If you ‘re interested in learn more about Jupyter Notebook , there is an excellent tutorial on the Dataquest blog at How to use Jupyter Notebook in 2020 : A Beginner ’s tutorial .