Plotly.io doesn't see the psutil package even though it's installed

☆樱花仙子☆ 提交于 2020-03-22 23:13:10

问题


I'm trying to execute the following code:

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
%matplotlib inline
import seaborn as sns

import plotly.graph_objects as go

from plotly.offline import init_notebook_mode, iplot
init_notebook_mode(connected=True)

from sklearn.preprocessing import QuantileTransformer

import os

if not os.path.exists("images"):
    os.mkdir("images")

# import orca


import plotly.io as pio
pio.orca.config.executable = '/path/to/orca'
pio.orca.ensure_server()

import psutil

To which I get:

ValueError                                Traceback (most recent call last)
<ipython-input-89-6e2b31e44303> in <module>
     25 import plotly.io as pio
     26 pio.orca.config.executable = '/path/to/orca'
---> 27 pio.orca.ensure_server()
     28 
     29 import psutil

~/Library/Python/3.7/lib/python/site-packages/plotly/io/_orca.py in ensure_server()
   1368 Install using conda:
   1369     $ conda install psutil
-> 1370 """
   1371         )
   1372 

ValueError: Image generation requires the psutil package.

Install using pip:
    $ pip install psutil

Install using conda:
    $ conda install psutil

The package is installed, I reinstalled it just in case as well but keep getting the error.

The end goal is to be able to safe plotly generated images automatically with fig.write_image("images/fig1.png")

来源:https://stackoverflow.com/questions/58957131/plotly-io-doesnt-see-the-psutil-package-even-though-its-installed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!