Installing Python packages

Many of the chapters in this book teach you how to make use of specific packages. Most of them are included in the standard Anaconda distribution, so if you installed Python using the Anaconda distribution, then you will have them already. Some packages might not be installed though, so we'll have to install them separately as per our requirements for every chapter. This is totally fine, and we'll specify which packages will be used at the beginning of each chapter.

In order to install a specific package, you have two options:

  • Installing via Anaconda by running either of the following commands. Specifying a channel is required if a package is rare and not present on the default channels of Anaconda and conda-forge:
> conda install <mypackage>
> conda install -c <mychannel> <mypackage>

Some packages are not present in conda at all. You can search for packages through the channels at https://anaconda.org/.

  • Most packages can be installed using pip:
> pip install <mypackage>

Generally speaking, we recommend using conda over pip for installation.

Alternatively, there is a single specification in the root of the repository that you can use to install everything at once. To do so, you need to go in your Terminal, and then to the repository's root (we will explain how to do that in Chapter 9, Shell, Git, Conda, and More – at Your Command, but VS Code's Terminal will open in the root of the given folder automatically). Once there, run the following command:

conda env update --name root -f environment.yml

Then, follow the instructions. Here, conda uses the environment.yml specification file as a list of packages to install.

Now, let's install our main development tools: VS Code and Jupyter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.107.116