Show Sidebar Hide Sidebar

Orca Management in Python

This section covers the low-level details of how uses orca to perform static image generation.

New to Plotly?

Plotly's Python library is free and open source! Get started by downloading the client and reading the primer.
You can set up Plotly to work in online or offline mode, or in jupyter notebooks.
We also have a quick-reference cheatsheet (new!) to help you get started!

Version Check

Note: The static image export API is available in version 3.2.0.+

In [1]:
import plotly
import plotly.graph_objs as go
from plotly.offline import iplot, init_notebook_mode



This section covers the lower-level details of how uses orca to perform static image generation. Please refer to the Static Image Export section for general information on creating static images from figures.

What is Orca?

Orca is an Electron application that inputs plotly figure specifications and converts them into static images. Orca can run as a command-line utility or as a long-running server process. In order to provide the fastest possible image export experience, launches orca in server mode, and communicates with it over a local port. See for more information.

By default, launches the orca server process the first time an image export operation is performed, and then leaves it running until the main Python process exits. Because of this, the first image export operation in an interactive session will typically take a couple of seconds, but then all subsequent export operations will be significantly faster, since the server is already running.

Create a Figure

Now let's create a simple scatter plot with 100 random points of variying color and size.

In [2]:
import plotly.graph_objs as go
import as pio

import os
import numpy as np

We'll configure the notebook for use in offline mode

In [3]:
In [4]:
N = 100
x = np.random.rand(N)
y = np.random.rand(N)
colors = np.random.rand(N)
sz = np.random.rand(N)*30

fig = go.Figure()
                marker={'size': sz,
                        'color': colors,
                        'opacity': 0.6,
                        'colorscale': 'Viridis'


We can use the object to view the current orca configuration settings.

In [5]:
orca configuration
    executable: orca
    port: None
    timeout: None
    default_width: None
    default_height: None
    default_scale: 1
    default_format: png
    topojson: None
    mapbox_access_token: None

    plotlyjs: /Users/jmmease/Plotly/repos/
    config_file: /Users/jmmease/.plotly/.orca


We can use the object to see the current status of the orca server

In [6]:
orca status
    state: unvalidated
    executable: None
    version: None
    port: None
    pid: None
    command: None

Since no image export operations have been performed yet, the orca server is not yet running.

Let's export this figure as an SVG image, and record the runtime.

In [7]:
img_bytes = pio.to_image(fig, format='svg')
from IPython.display import SVG, display
CPU times: user 422 ms, sys: 68.6 ms, total: 490 ms
Wall time: 2.07 s

By checking the status object again, we see that the orca server is now running

In [8]:
orca status
    state: running
    executable: /usr/local/bin/orca
    version: 1.1.0
    port: 54174
    pid: 72696
    command: ['/usr/local/bin/orca', 'serve', '-p', '54174', '--plotly', '/Users/jmmease/Plotly/repos/', '--graph-only', '--mathjax', '']

Let's perform this same export operation again, now that the server is already running.

In [9]:
img_bytes = pio.to_image(fig, format='svg')
CPU times: user 21.8 ms, sys: 3.35 ms, total: 25.2 ms
Wall time: 77.3 ms

The difference in runtime is dramatic. Starting the server and exporting the first image takes a couple seconds, while exporting an image with a running server is much faster.

Shutdown the Server

By default, the orca server will continue to run until the main Python process exits. It can also be manually shut down by calling the function. Additionally, it is possible to configure the server to shut down automatically after a certain period of inactivity. See the timeout configuration parameter below for more information.

Regardless of how the server is shut down, it will start back up automatically the next time an image export operation is performed.

In [10]:
orca status
    state: validated
    executable: /usr/local/bin/orca
    version: 1.1.0
    port: None
    pid: None
    command: None
In [11]:
img_bytes = pio.to_image(fig, format='svg')
In [12]:
orca status
    state: running
    executable: /usr/local/bin/orca
    version: 1.1.0
    port: 54411
    pid: 72700
    command: ['/usr/local/bin/orca', 'serve', '-p', '54411', '--plotly', '/Users/jmmease/Plotly/repos/', '--graph-only', '--mathjax', '']

Configuring the Executable

By default, searches the PATH for an executable named orca and checks that it is a valid plotly orca executable. If is unable to find the executable, you'll get an error message that looks something like this:

The orca executable is required in order to export figures as static images,
but it could not be found on the system path.

Searched for executable 'orca' on the following path:

If you haven't installed orca yet, you can do so using conda as follows:

    $ conda install -c plotly plotly-orca

Alternatively, see other installation methods in the orca project README at

After installation is complete, no further configuration should be needed.

If you have installed orca, then for some reason was unable to
locate it. In this case, set the ``
property to the full path to your orca executable. For example:

    >>> = '/path/to/orca'

After updating this executable property, try the export operation again.
If it is successful then you may want to save this configuration so that it
will be applied automatically in future sessions. You can do this as follows:


If you're still having trouble, feel free to ask for help on the forums at

If this happens, follow the instructions in the error message and specify the full path to you orca executable using the configuration property.

Other Configuration Settings

In addition to the executable property, the object can also be used to configure the following options:

  • port: The specific port to use to communicate with the orca server, or None if the port will be chosen automatically.
  • timeout: The number of seconds of inactivity required before the orca server is shut down. For example, if timeout is set to 20, then the orca server will shutdown once is has not been used for at least 20 seconds. If timeout is set to None (the defualt), then the server will not be automatically shut down due to inactivity.
  • default_width: The default pixel width to use on image export.
  • default_height: The default pixel height to use on image export.
  • default_scale: The default image scale facor applied on image export.
  • default_format: The default image format used on export. One of 'png', 'jpeg', 'webp', 'svg', 'pdf', or 'eps'.
  • mathjax: Location of the MathJax bundle needed to render LaTeX characters. Defaults to a CDN location. If fully offline export is required, set this to a local MathJax bundle.
  • topojson: Location of the topojson files needed to render choropleth traces. Defaults to a CDN location. If fully offline export is required, set this to a local directory containing the Plotly.js topojson files.
  • mapbox_access_token: Mapbox access token required to render scattermapbox traces.

Saving Configuration Settings

Configuration options can optionally be saved to the ~/.plotly/ directory by calling the method. Saved setting will be automatically loaded at the start of future sessions.