Need to install a Python package in Anaconda?
If so, I’ll show you the steps to install a Python package in Anaconda using a simple example. I’ll also review 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 template 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 cx_Oracle package for example (the cx_Oracle package can be used to establish a connection between an Oracle database and Python).
You can then apply the steps below in order to install that package in Anaconda.
Note: the steps to be reviewed can be used to install most Python packages in Anaconda.
Step-1: Open the 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):
You’ll then see the following screen with your user name:
Step-2: Install the Package
To install the Python package in Anaconda, simply follow the template that was introduced at the beginning of this guide:
pip install package name
And since in our case, we are trying to install the cx_Oracle package, then the full syntax that you’ll need to type in the Anaconda Prompt is:
pip install cx_Oracle
After you typed the above command, press ENTER to proceed with the installation:
The Python package would now get installed.
Step-3: Verify that the package got installed
Once the package got successfully installed, you’ll see the following status in the Anaconda Prompt:
Those are the steps to install a Python Package in Anaconda.
But what if you want to uninstall an existing package?
If that’s the case, 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 the Anaconda Prompt
First open the Anaconda Prompt:
Step-2: Uninstall the Package
You can then uninstall a Python package by applying this generic syntax:
pip uninstall package name
And for our case, type:
pip uninstall cx_Oracle
Press ENTER to execute the command:
Type ‘y‘ to proceed, and then press ENTER:
Step-3: Verify that the package got uninstalled
Finally, check that the package got successfully uninstalled by looking at the status as follows: