Open In App

How To Install Seaborn In Pycharm?

Last Updated : 03 Nov, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Seaborn is a popular Python data visualization library that is based on the Matplotlib library. You can create informative designs and attractive statistical graphics. Data analysts and scientists can more easily display their data with Seaborn high-level interface. They can easily construct different kinds of statistical charts, which helps them obtain insights.

Installing Seaborn on PyCharm

There are two common ways to set up seaborn on PyCharm in Python. You can use the terminal or install it using the Graphical User Interface of PyCharm. Either way, it is going to be a simple and quick process to follow. So, let’s get started.

Below are the two ways to set up Seaborn on PyCharm:

  • Using Terminal
  • Using Graphical User Interface

Steps to Install Seaborn Using Terminal

It is simple and quick to install seaborn through the terminal.

Step 1: Open Pycharm

Let’s begin by opening the PyCharm IDE on our computer. If you haven’t already installed PyCharm, you can download and install it from the official JetBrains website.

Step 2: Create or Open a Python Project

You can either create a new Pycharm project or open an existing one. In case, if you’re creating a new project, you can follow these steps:

  • Go to File > New Project in the top menu.
  • Choose “Pure Python” or select an appropriate template.
  • Configure your project settings and choose a location to save it.
  • Select the Python interpreter you want to use for your project. If you haven’t set up an interpreter, click on the gear icon and choose “Add…”. You can select an existing interpreter or create a new virtual environment.

Step 3: Open the Terminal

Once you have opened a Python project in PyCharm, you will need to access the terminal to run the installation command. The terminal is present at the bottom of the PyCharm IDE.

terminal-(1)

Step 4: Install Seaborn

Now that we have our terminal open, we can use the ‘pip’ command to install seaborn. Simply write the following command in your terminal and then press Enter.

pip install seaborn

Here, the ‘pip’ command tells the Python Package Manager to download and install Seaborn and its dependencies.

install-seaborn

Setup Seaborn on PyCharm Using Graphical User Interface

This method provides a more visual and integrated way to manage packages within PyCharm. Moreover, it’s useful when you want to manage package installations directly from the IDE’s interface. Steps are given below:

Step 1: Open PyCharm

Open PyCharm IDE on your computer and make sure that you have a Python project opened. You can even create a new ‘test’ project if needed.

Step 2: Access the Package Manager

In PyCharm, you can manage packages by going to File > Settings (or PyCharm > Preferences on macOS).

python-interpreter

Step 3: Install Seaborn via PyCharm’s Package Manager

  • In the Settings/Preferences window, navigate to Project: YourProjectName > Python Interpreter.
  • You will see a list of installed packages on the right side of the window. To add a new package, click the “+” (plus) button.
  • In the “Available Packages” window that opens, search for “seaborn” in the search bar.
  • Select the Seaborn package from the list by clicking on it.
  • Click the “Install Package” button at the bottom of the pop-up.

Thus, PyCharm will download and install Seaborn along with its dependencies.

seaborn

Verify Installation

In order to ensure that Seaborn has been successfully installed, you can create a simple Python script to test it. You can follow these steps to make sure its installed:

  • Right-click on your project in the project explorer
  • Selecting New > Python File to create a new Python file in your PyCharm project
  • Give a proper name to your file (eg. seaborn_test.py).
  • Open the seaborn_test.py file and add the following code:

Python3




import seaborn as sns
import matplotlib.pyplot as plt
sns.set(style="whitegrid")
tips = sns.load_dataset("tips")
sns.boxplot(x="day", y="total_bill", data=tips)
plt.show()


This code imports Seaborn and Matplotlib, creates a simple Seaborn plot, and displays it using Matplotlib.

  • Save the file by pressing Ctrl + S (or Cmd + S on macOS).
  • Right-click on the seaborn_test.py file in the project explorer
  • Select Run ‘seaborn_test’. This will execute the script.

If everything is set up correctly, you should see a boxplot chart displayed within the PyCharm IDE, indicating that Seaborn has been successfully installed and is working in your Python environment.

verify-installation



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads