How to Get Started With Python Dash on PyCharm [Absolute Beginners]

4.5/5 - (2 votes)

This is a chapter draft of our book Python Dash with NoStarch:

📖 Further Learning: For a complete guide on how to build your beautiful dashboard app in pure Python, check out our best-selling book Python Dash with San Francisco Based publisher NoStarch.

Why an IDE

Using an integrated development environment (IDE) has the potential to significantly accelerate your programming productivity. Many programmers do not unlock their full potential until they finally decide to switch from a simple code editor to an IDE—and mastering the advanced functionality provided by the IDE. Some advantages of IDEs over simple text editors are code highlighting, tooltips, syntax checker, code linters that check for style issues, version control to safeguard the history of programming edits, debugging with the help of breakpoints, visual aids such as flowcharts and block diagrams, performance optimization tools and profilers—just to name a few.

PyCharm for Dash Apps

In this book about dashboard applications, we recommend that you also take your time to switch to an IDE, if you haven’t already. In particular, we recommend that you use the PyCharm IDE to follow along with the provided code examples. Apart from the benefits of using IDEs, you’ll also develop web applications that can quickly grow by adding more and more features. As your Python dashboard applications grow, so will your need to aggregate all source code at a single spot and in a single development environment. Increasing complexity quickly demands the use of an IDE.

In the following, we’ll describe how to download and install PyCharm, and create your first simple dashboard application that you can view in your browser. After you’ve completed those steps, you’re well-prepared to duplicate the increasingly advanced applications in the upcoming chapters.

Download PyCharm

First, let’s start with downloading the latest PyCharm version. We assume you have a Windows PC, but the steps are very similar on a macOS and Linux computer. As soon as you’ve launched the PyCharm application, the similarity of usage increases even more across the different operating systems.

You can download the PyCharm app from the official website.

Click the download button of the free community version and wait for the download to complete.

Install PyCharm on Your Computer

Now, run the executable installer and follow the steps of the installation application. A sensible approach is to accept the default settings suggested by the PyCharm installer.

Congratulations, you’ve installed PyCharm on your system!

Open PyCharm

Now type “PyCharm” into the search bar of your operating system and run the IDE!

Create a New Dash Project in PyCharm

After choosing “New Project”, you should see a window similar to this one:

This user interface asks you to provide a project name, a virtual environment, and a Python interpreter. We call our project firstDashProject, use a virtual environment with the standard Python installation, and don’t create a welcome script:

Create the project and you should see your first PyCharm dashboard project!

Create Your Dash File in Your PyCharm Project

Let’s create a new file in your project and copy&paste the code from the official documentation into your file:

# -*- coding: utf-8 -*-

# Run this app with `python` and
# visit in your web browser.

import dash
import dash_core_components as dcc
import dash_html_components as html
import as px
import pandas as pd

external_stylesheets = ['']

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

# assume you have a "long-form" data frame
# see for more options
df = pd.DataFrame({
    "Fruit": ["Apples", "Oranges", "Bananas", "Apples", "Oranges", "Bananas"],
    "Amount": [4, 1, 2, 2, 4, 5],
    "City": ["SF", "SF", "SF", "Montreal", "Montreal", "Montreal"]

fig =, x="Fruit", y="Amount", color="City", barmode="group")

app.layout = html.Div(children=[
    html.H1(children='Hello Dash'),

        Dash: A web application framework for Python.


if __name__ == '__main__':

You can get the code from the official Dash tutorial:

Your PyCharm dashboard project should now look like this:

Debug Your Dash App Using PyCharm’s Tooltips

Now, let’s try to run our project by using the top menu and select Run > Unfortunately, it doesn’t already work—PyCharm doesn’t recognize dash!

You can easily fix this by hovering over the red underlined “dash” library import in your app and choosing the “install package dash” option.

This is one great advantage of an IDE is that installing dependencies in your Python projects is as simple as accepting the tooltips provided by your intelligent development environment.

Install Dash in Your Virtual Environment

Installing the dash library will take a few moments. Note that the library will be installed only in a virtual environment which means that it’ll install it not on your global operating system but only on a project level. For a different project, you may have to install dash again. While this may sound tedious, it’s actually the most Pythonic way because it keeps dependency management simple and decentralized. There won’t be any version issues because your first project needs version 1 and your second project needs version 2 of a given library. Instead, each project installs exactly the version it needs.

Install Pandas in Your Virtual Environment

PyCharm will tell you when it is done with installing the dash library in the virtual environment. Now repeat the same procedure for all red-underlined libraries in the project. If you used the code given above, you’ll have to install the pandas library (see Chapter 3) as well in your local environment. A few moments later, the pandas installation will also successfully complete. The red underlined error messages in your code will disappear and you’re ready to restart the project again by clicking “Run”.

Exploring Your First Dash App in Your Browser

On my machine, the output after running the file in PyCharm is:

C:\Users\xcent\Desktop\Python\firstDashProject\venv\Scripts\python.exe C:/Users/xcent/Desktop/Python/firstDashProject/
Dash is running on

 * Serving Flask app "app" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on

Note the highlighted line (in bold). You can now copy the URL and paste it into your browser—the dashboard app runs on a local server that is hosted on your machine with IP address and port 8050.  

When you visit this URL in your browser, you should see your first Dash application!

Congratulations, you’re now well-prepared to run all dashboard apps in this book—and beyond it as well—using similar steps.

For further reading on PyCharm, feel free to check out our multi-site blog tutorial on

Python Dash Book

If you’re interested in learning more about how to create beautiful dashboard applications in Python, check out our new book Python Dash.

You’ve seen dashboards before; think election result visualizations you can update in real-time, or population maps you can filter by demographic.

With the Python Dash library, you’ll create analytic dashboards that present data in effective, usable, elegant ways in just a few lines of code.

Get the book on NoStarch or Amazon!