Arch Linux BasedManjaro

How To Install Plotly on Manjaro

Install Plotly on Manjaro

Plotly stands as one of the most powerful data visualization libraries for Python, offering interactive and dynamic charts that elevate any data analysis project. For Manjaro Linux users, installing and configuring Plotly properly ensures you can create stunning visualizations without compatibility issues. This comprehensive guide walks through multiple installation methods suited for different user requirements, from system-wide installations to isolated virtual environments.

Introduction

Plotly is an interactive, open-source graphing library that supports over 40 unique chart types covering statistical, financial, geographic, scientific, and 3-dimensional visualizations. As a Manjaro Linux user, you have several options for integrating this powerful tool into your workflow. Manjaro’s Arch-based foundation provides flexibility in package management, allowing you to choose the installation method that best suits your needs.

Data visualization has become essential in modern analytics and research, transforming complex datasets into meaningful insights. Plotly excels in this area by creating interactive web-based visualizations that can be displayed in Jupyter notebooks, saved as standalone HTML files, or integrated into web applications using frameworks like Dash.

This guide covers multiple installation approaches including official repositories, AUR packages, pip, and conda, ensuring you can select the method that aligns with your specific requirements and workflow preferences.

What is Plotly and Why Use It?

Plotly is much more than just another visualization library. It’s a comprehensive toolkit that creates interactive, publication-quality graphs that respond to user interactions. Unlike traditional static plotting libraries, Plotly generates dynamic visualizations where users can zoom, pan, and hover over data points to reveal additional information.

Key Features of Plotly:

  • Interactive charts with hover information, zooming, and panning capabilities
  • Support for over 40 chart types including scatter plots, bar charts, line graphs, heatmaps, and 3D visualizations
  • Seamless integration with Jupyter notebooks and other Python environments
  • Export options for high-quality vector images suitable for publications
  • Responsive designs that work across various screen sizes and devices

For data scientists and analysts using Manjaro Linux, Plotly offers significant advantages over static visualization libraries. The interactivity allows for deeper exploration of data relationships, while the extensive customization options ensure your visualizations match exact specifications. The latest version (6.0.0 as of early 2025) continues to expand functionality while improving performance.

Plotly particularly shines when you need to present complex data relationships or when building dashboards for stakeholders who benefit from interactive elements. Its modern design aesthetic and customization options ensure your visualizations look professional while effectively communicating insights.

Prerequisites and System Preparation

Before installing Plotly on your Manjaro system, you need to ensure your environment is properly configured. These preparation steps help avoid common issues and ensure a smooth installation process.

System Update:

First, update your Manjaro system to ensure you have the latest packages and dependencies:

sudo pacman -Syu

This command synchronizes the package databases and updates your system. It’s crucial to start with an updated system to avoid dependency conflicts.

Python Installation Check:

Verify your existing Python installation:

python --version

Plotly works with Python 3.6 and newer, but for optimal performance, Python 3.8+ is recommended. Manjaro typically includes Python by default, but it’s good practice to confirm.

Development Tools:

Install essential development packages that may be required for building certain dependencies:

sudo pacman -S base-devel python-pip

The base-devel group includes compilers and build tools that might be needed for certain packages, while python-pip installs Python’s package manager.

File System Permissions:

Ensure your user has the appropriate permissions for package installation. If you’re planning to use virtual environments (recommended), verify you have write access to the directory where you’ll create them.

By properly preparing your system, you minimize potential issues during installation and create a solid foundation for working with Plotly. This preparation is especially important on Manjaro, where system integrity and package management are key considerations.

Method 1: Installing Plotly via Official Repositories

Installing Plotly through Manjaro’s official repositories is the most straightforward and system-friendly approach. This method ensures that the package integrates smoothly with your system and receives updates alongside other system packages.

Checking Package Availability:

First, search for the Plotly package in the official repositories:

pacman -Ss python-plotly

This command searches the synchronized package database for the Python Plotly package. If available, you’ll see information about the package including its version and description.

Installation Command:

If the package is available, install it with:

sudo pacman -S python-plotly

The package manager will calculate dependencies and ask for confirmation before proceeding with the installation. This approach installs Plotly system-wide, making it available to all users and Python projects on your system.

Verifying the Installation:

After installation, verify that Plotly installed correctly by importing it in Python:

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

This command should print the installed version of Plotly without any errors, confirming a successful installation.

Advantages of Repository Installation:

  • System-wide availability for all users and projects
  • Automatic dependency resolution through pacman
  • Consistent updates through the system package manager
  • Better integration with other Manjaro packages
  • Less chance of conflicts with other Python packages

Potential Limitations:

The version in the official repositories might not always be the latest release. If you require cutting-edge features or specific version compatibility, you might need to consider alternative installation methods.

Overall, using the official repositories provides stability and convenience, making it ideal for most users who don’t require specialized configurations or the absolute latest version.

Method 2: Installing Plotly via AUR

When Plotly isn’t available in the official repositories or you need a different version, Manjaro’s access to the Arch User Repository (AUR) provides an excellent alternative. The AUR contains user-contributed package builds, often including the latest software versions.

Understanding the AUR:

The Arch User Repository is a community-driven repository containing package build scripts. These scripts automate the process of compiling and installing software from source. Manjaro users can access the AUR using helper tools that simplify the process.

Installing an AUR Helper:

If you don’t already have an AUR helper installed, yay is a popular choice:

sudo pacman -S yay

Alternatively, you can use pamac, which comes pre-installed on many Manjaro editions:

sudo pacman -S pamac-all

Searching for Plotly in AUR:

Search for the Plotly package using your AUR helper:

yay -Ss python-plotly

This will show available packages matching “python-plotly” in both the official repositories and the AUR.

Installing Plotly from AUR:

Install the package using:

yay -S python-plotly

The AUR helper will download the build files, resolve dependencies, compile the package if necessary, and install it on your system. Follow the prompts during installation to proceed.

Handling Build Issues:

If you encounter build errors, you might need to clear the build cache and try again:

yay -Scc
yay -S python-plotly --rebuild

This clears the package cache and forces a rebuild of the package, which can resolve certain issues.

Verification:

After installation, verify that Plotly works correctly:

python -m plotly

If the package installed successfully, this command should run without errors.

The AUR approach offers a good balance between system integration and access to newer versions. Since the packages are built specifically for Arch-based systems like Manjaro, they typically integrate well with the rest of your system while providing more up-to-date software than might be available in the official repositories.

Method 3: Installing Plotly via pip

For Python developers who need more flexibility or the absolute latest version of Plotly, pip installation provides a direct approach. Using Python’s native package manager allows you to install Plotly within virtual environments, keeping projects isolated and avoiding system-wide changes.

Installing pip:

First, ensure pip is installed on your system:

sudo pacman -S python-pip

Creating a Virtual Environment (Recommended):

Virtual environments isolate Python packages, preventing conflicts between projects and system packages. Create a virtual environment:

mkdir -p ~/python_projects
cd ~/python_projects
python -m venv plotly_env

Activate the environment:

source plotly_env/bin/activate

Your terminal prompt should change, indicating the environment is active.

Installing Plotly with pip:

Within the activated environment, install Plotly:

pip install plotly

For additional features like Plotly Express, use:

pip install "plotly[express]"

This installs Plotly with extended capabilities for data visualization.

Handling “Externally Managed Environment” Error:

Recent Python versions on Manjaro might show an “externally-managed-environment” error when using pip. This is a protection mechanism to prevent conflicts between pip and the system package manager. Always use virtual environments as shown above to avoid this issue.

If you absolutely must install packages system-wide with pip (not recommended), you can override the protection with:

pip install plotly --break-system-packages

However, this approach risks system stability and should be avoided.

Verifying the Installation:

Test your installation within the virtual environment:

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

Managing Virtual Environments:

When finished working with Plotly, deactivate the virtual environment:

deactivate

To use it again later, navigate to the project directory and reactivate:

cd ~/python_projects
source plotly_env/bin/activate

Using pip with virtual environments offers maximum flexibility and isolation, making it ideal for developers working on multiple projects or needing specific package versions. This approach also protects your system packages from potential conflicts.

Method 4: Installing Plotly via conda

For scientific computing and data science work, the conda package manager offers another excellent option for installing Plotly on Manjaro. Conda excels at managing complex dependencies common in data science workflows.

Installing Miniconda:

First, download and install Miniconda, a minimal installer for conda:

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh

Follow the installation prompts, and once complete, initialize conda by restarting your terminal or running:

source ~/.bashrc

Creating a Conda Environment:

Create a dedicated environment for Plotly:

conda create -n plotly_env python=3.11

This creates an environment with Python 3.11, which offers good performance and compatibility with Plotly.

Activating the Environment:

Activate your new environment:

conda activate plotly_env

Installing Plotly with conda:

Install Plotly from the conda-forge channel:

conda install -c conda-forge plotly

The conda-forge channel typically offers up-to-date packages maintained by the community.

Verifying the Installation:

Check your installation:

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

Benefits of the conda Approach:

Conda offers several advantages for scientific computing:

  • Better handling of binary dependencies
  • Optimized math libraries for data science
  • Easy switching between environments
  • Consistent package versions across operating systems

This makes conda particularly valuable for researchers and data scientists who need computational consistency and optimized scientific libraries. When working on Manjaro with complex data visualization needs, conda environments can provide the perfect balance of flexibility and performance.

Setting Up Additional Features

To maximize Plotly’s capabilities on your Manjaro system, you’ll want to install several additional components that enable advanced features like static image export and interactive notebooks.

Jupyter Integration:

For interactive notebook support, install Jupyter and anywidget:

# Within your virtual environment or conda environment
pip install jupyter anywidget

Or with conda:

conda install jupyter anywidget

This allows Plotly figures to render interactively in Jupyter notebooks, enhancing your data exploration workflow.

Static Image Export with Kaleido:

To export static images from Plotly visualizations (crucial for reports and publications), install the Kaleido package:

pip install -U kaleido

Or with conda:

conda install -c conda-forge python-kaleido

Kaleido enables high-quality vector image export without external dependencies, making it ideal for publication-ready graphics.

Extended Geographic Support:

For maps and geographic visualizations, add the plotly-geo package:

pip install plotly-geo==1.0.0

Or with conda:

conda install -c plotly plotly-geo=1.0.0

This package includes geographic shape files necessary for choropleth maps and other geo-visualizations.

Common Data Science Dependencies:

Install other frequently used libraries that integrate well with Plotly:

pip install pandas numpy matplotlib

Or with conda:

conda install pandas numpy matplotlib

These additional installations transform Plotly from a simple visualization library into a comprehensive data science toolkit on your Manjaro system. By setting up these components, you ensure that you can leverage Plotly’s full range of capabilities, from interactive explorations to publication-quality outputs.

Creating Your First Visualization

After successfully installing Plotly on your Manjaro system, let’s create a basic visualization to verify everything works correctly. This example will demonstrate Plotly’s core functionality and interactive features.

Basic Example:

Open a Python interpreter or create a new script file and enter the following code:

import plotly.express as px
import numpy as np

# Create some sample data
x = np.linspace(0, 10, 100)
y = np.sin(x)

# Create an interactive line plot
fig = px.line(x=x, y=y, title='Sine Wave Visualization')

# Add some customization
fig.update_layout(
    xaxis_title="X Axis",
    yaxis_title="sin(x)",
    font=dict(family="Arial", size=14)
)

# Display the figure
fig.show()

This code creates a simple sine wave visualization that opens in your default web browser, demonstrating Plotly’s interactive capabilities.

Jupyter Notebook Integration:

If you’ve installed Jupyter support, create a new notebook and run:

import plotly.express as px

# Use a built-in dataset
df = px.data.gapminder().query("continent=='Europe' and year==2007")

# Create a scatter plot
fig = px.scatter(
    df, x="gdpPercap", y="lifeExp", size="pop", color="country",
    hover_name="country", log_x=True, size_max=60,
    title="GDP vs Life Expectancy in Europe (2007)"
)

fig.show()

This creates an interactive scatter plot showing the relationship between GDP per capita and life expectancy across European countries.

Saving Visualizations:

To save your visualization as an interactive HTML file:

fig.write_html("my_plot.html")

For a static image export (requires Kaleido):

fig.write_image("my_plot.png", scale=2)  # Scale for higher resolution

By creating these simple visualizations, you can confirm that Plotly is working correctly on your Manjaro system. These examples also serve as a starting point for more complex data visualization projects, demonstrating the library’s interactive capabilities and output options.

Comparison of Installation Methods

When deciding how to install Plotly on Manjaro, it’s helpful to compare the different approaches to choose the one that best fits your needs.

Official Repositories vs. AUR:

Aspect Official Repositories AUR
Version Stable but potentially older Usually more recent
Integration Perfect system integration Good system integration
Maintenance Official package maintainers Community maintained
Installation Speed Fast, binary packages Slower, may require compilation
Stability Very stable Generally stable, but varies

pip vs. conda:

Aspect pip conda
Focus Python packages only Cross-language, science-focused
Dependency Management Basic More comprehensive
Isolation Requires manual venv setup Built-in environment management
Performance Standard Optimized for scientific computing
Latest Packages Usually first to get updates Slight delay but well-tested

Recommendations by User Type:

  • Beginners: Start with official repositories for simplicity and stability. The sudo pacman -S python-plotly approach provides the easiest installation with good system integration.
  • Regular Python Developers: Use pip with virtual environments for isolation and flexibility. This approach keeps your projects separate and avoids system conflicts.
  • Data Scientists: Prefer conda for its superior handling of scientific packages and dependencies. The optimized math libraries and environment management make complex workflows easier.
  • System Administrators: Stick with official repositories or AUR for better system integration and easier maintenance across multiple users.

The installation method you choose should align with your specific needs, workflow, and experience level. For most users, virtual environments (either with pip or conda) provide the best balance of flexibility and stability, particularly when working on multiple projects with different requirements.

Troubleshooting Common Issues

Even with careful installation, you might encounter issues with Plotly on Manjaro. Here are solutions to the most common problems:

Import Errors:

If you see ModuleNotFoundError: No module named 'plotly' despite installation:

  1. Verify you’re using the correct Python environment (if using venv or conda)
  2. Check if you have multiple Python installations with which python
  3. Reinstall Plotly with pip install --force-reinstall plotly

Multiple Version Conflicts:

If you have multiple versions causing unpredictable behavior:

# Remove all instances first
conda uninstall plotly  # If using conda
pip uninstall plotly    # Run multiple times until it says not installed
sudo pacman -R python-plotly  # If installed via pacman

# Then reinstall using your preferred method

Externally Managed Environment Error:

If pip shows “error: externally-managed-environment”:

  1. Create and use a virtual environment as described in Method 3
  2. Never use --break-system-packages except as a last resort
  3. Consider using the AUR package instead of pip for system-wide installation

Rendering Issues in Jupyter:

If plots don’t display in Jupyter notebooks:

import plotly.io as pio
pio.renderers.default = "notebook"

This explicitly sets the rendering engine for Jupyter.

File Named plotly.py Issue:

Having a file named plotly.py in your working directory can cause mysterious import errors. Make sure none of your scripts are named plotly.py.

Missing Dependencies for Special Features:

If geographic features or static exports don’t work:

# For geo support
pip install plotly-geo==1.0.0

# For static image export
pip install -U kaleido

By addressing these common issues, you can ensure a smooth experience with Plotly on your Manjaro system. Remember that isolation through virtual environments is the most reliable way to avoid package conflicts in Python development.

Maintaining and Updating Plotly

Keeping Plotly updated on your Manjaro system ensures you have access to the latest features, performance improvements, and bug fixes. The update process varies depending on your installation method.

For Official Repository Installations:

Update Plotly alongside your system packages:

sudo pacman -Syu

This updates all packages, including python-plotly if it’s installed from the official repositories.

For AUR Installations:

Update using your AUR helper:

yay -Syu

Or specifically update just Plotly:

yay -S python-plotly

For pip Installations:

Within your virtual environment:

pip install --upgrade plotly

For conda Installations:

Within your conda environment:

conda update -c conda-forge plotly

Checking for New Versions:

To check your current version against the latest available:

import plotly
print(f"Installed version: {plotly.__version__}")

Compare this with the latest version on PyPI or the Plotly GitHub repository.

Regular updates are particularly important for visualization libraries like Plotly, where new chart types and features are frequently added. By maintaining an up-to-date installation, you ensure compatibility with the latest datasets and visualization techniques while benefiting from ongoing performance optimizations.

Congratulations! You have successfully installed Plotly. Thanks for using this tutorial for installing the Plotly on Manjaro Linux system. For additional or useful information, we recommend you check the official Plotly website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button