I am having trouble in saving a plotly figure (graph) to disk in python. I am following this example which is on the website https://plot.ly/python/static-image-export/ but every time when i run the code, i am getting this error
ValueError: Image generation requires the psutil package.
Install using pip: $ pip install psutil
I have psutil installed on my machine, its show when i run pip freeze
(dev) workstation:~$ pip freeze | grep psu
psutil==5.7.0
Here is a simple graph i am trying to save
import plotly.graph_objects as go
import numpy as np
np.random.seed(1)
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()
fig.add_trace(go.Scatter(
x=x,
y=y,
mode="markers",
marker=go.scatter.Marker(
size=sz,
color=colors,
opacity=0.6,
colorscale="Viridis"
)
))
fig.write_image("fig1.jpeg")
Would appreciate help. Thank you!
Platform
Ubuntu 16.04
python3.7