How to Install Plotly on CentOS Stream 10 – Step-by-Step Guide

Plotly

Plotly is a powerful open-source graphing library used to create interactive, publication-quality visualizations for web and data applications. Whether you’re a data scientist, developer, or researcher, using Plotly with Python on CentOS Stream 10 can elevate your data presentation.

In this guide, we’ll walk you through how to install Plotly on CentOS Stream 10. We’ll cover system preparation, Python setup, package installation, and how to create your first Plotly chart.

📌 Why Use Plotly?

Before diving into the installation steps, here’s why Plotly is popular in the data visualization world:

  • Interactive Graphs (line charts, bar charts, scatter plots, heatmaps, 3D graphs)
  • Jupyter Notebook Support
  • Web-based Dashboards (via Dash)
  • Supports Python, R, JavaScript, and Julia
  • Open Source and Free for Most Use Cases

🖥️ System Requirements

To follow this tutorial, you will need:

  • A system running CentOS Stream 10
  • Python 3.8+
  • Internet access
  • Access to terminal with sudo privileges

🔧 Step 1: Update Your System

Before installing any software, it’s good practice to update your system packages:

sudo dnf update -y

This ensures that all packages and dependencies are current and compatible.

🐍 Step 2: Install Python and pip

CentOS Stream 10 comes with Python 3.x, but you can install or update it manually:

sudo dnf install python3 python3-pip -y

After installation, verify the version:

python3 --version
pip3 --version

📦 Step 3: Install Plotly via pip

Once Python and pip are installed, you can install Plotly using pip:

pip3 install plotly

If you’re working in a virtual environment (recommended for projects), make sure it’s activated before running the command above.

To verify Plotly is installed:

python3 -c "import plotly; print(plotly.__version__)"

🧪 Step 4: Create a Sample Plot

Let’s create a basic line chart using Plotly to ensure everything is working.

Create a file named plotly_test.py:

import plotly.graph_objects as go

fig = go.Figure(data=go.Scatter(
    x=[1, 2, 3, 4], 
    y=[10, 11, 12, 13],
    mode='lines+markers',
    name='Test Line'
))

fig.update_layout(title='Sample Plotly Line Chart')
fig.write_html("line_chart.html")

print("Plot created successfully!")

Run the script:

python3 plotly_test.py

This will generate an interactive HTML file (line_chart.html) that you can open in any browser.

📂 Optional: Install Jupyter Notebook (For Data Science Workflows)

If you’re planning to use Plotly with Jupyter, install it using:

pip3 install notebook

Then start a notebook session:

jupyter notebook

Now you can use Plotly directly inside notebook cells.

✅ Common Installation Issues and Fixes

IssueSolution
ModuleNotFoundError: No module named 'plotly'Ensure pip is installing to the correct Python version, use pip3 or python3 -m pip install plotly
Permission denied during pip installAdd --user or use sudo
No display when running in headless serverUse fig.write_html() instead of fig.show()

🔚 Summary

Installing Plotly on CentOS Stream 10 is a simple yet powerful way to enhance your data projects. With just a few commands, you can start building rich, interactive visualizations directly in Python.

Whether you’re creating dashboards, analyzing trends, or visualizing machine learning results, Plotly gives you the flexibility and polish your data deserves.

(Visited 24 times, 1 visits today)

You may also like