How to Install Python Package in Anaconda

Need to install Python package in Anaconda?

If that’s the case, I’ll show you the steps to install a Python package in Anaconda using a simple example. I’ll also show you how to uninstall an existing package that is no longer needed.

If you are already familiar with the process of installing packages in Python, you may simply use the following structure to install your desired Python package in Anaconda:

 

pip install package name

 

But just in case you were wondering how the process works, here are the steps that you may follow to perform the installation from scratch.

Steps to Install Python Package in Anaconda

Let’s say that you want to install the package cx_Oracle (this package can be used to establish a connection between Oracle database and Python).

How would you then install that package in Anaconda?

Here are the steps:

Step-1: Open Anaconda Prompt

Locate your Anaconda Prompt, and then open it.

For example, if you’re using Windows, you can simply type Anaconda Prompt in the Windows Search Bar (and then click on it):

Anaconda Prompt

Step-2: Install the Package

To install the Python package in Anaconda, simply follow the generic structure that we saw at the beginning of this post:

 

pip install package name

 

And since in our case, we are trying to install the package cx_Oracle, the full syntax that you’ll need to type in the Anaconda Prompt is:

 

pip install cx_Oracle

 

Once you type the above command, press ENTER to proceed with the installation:

 

install Python package in Anaconda

 

The Python package should now be installed.

Step-3: Verify that the package got installed

Once the package is successfully installed, you’ll see the following status in the Anaconda Prompt:

 

How to install Python package in Anaconda

 

Those are the steps to install Python Package in Anaconda.

But what if you want to uninstall an existing package?

No problem. Simply follow the steps below.

Steps to uninstall a Python package in Anaconda

At times, you may want to uninstall an existing package.

For illustration purposes, let’s uninstall the cx_Oracle package:

Step-1: Open Anaconda Prompt

First open the Anaconda Prompt:

Anaconda Prompt

Step-2: Uninstall the Package

You can then uninstall a Python package by applying this generic structure:

 

pip uninstall package name

 

And in our case, type:

 

pip uninstall cx_Oracle

 

Press ENTER to execute the command:

 

Uninstall Python package in Anaconda

 

Type ‘y’ to proceed, and then press ENTER:

 

Uninstall Python package in Anaconda

Step-3: Verify that the package got uninstalled

Finally, check that the package got uninstalled successfully by looking at the status as follows:

 

Remove Python package in Anaconda