简体   繁体   中英

Plotly Static Image Export gets OSError: [WinError 193] %1 is not a valid Win32 application

Getting this error every time I run my code. I've tried make it work but it just won't stop giving me this error.

if not os.path.exists('images'):
    os.mkdir('images')
init_notebook_mode(connected=True)
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_scatter(x=x, y=y, mode='markers', marker={'size': sz, 'color': colors, 'opacity': 0.6,
                'colorscale': 'Viridis'})
pio.write_image(fig, r'images\fig1.png')

I just want to be able to export the images.

After posting my comment above I went further down the rabbit hole.

In the end I uninstalled orca from npm. I updated my conda with conda update conda , completely uninstalled plotly and plotly-conda, and then finally did a pip install plotly , and conda install -c plotly plotly-orca .

For some reason this led conda to do to a massive update of all of my packages (including deleting some like pandas). So far this hasn't broken any old code, and plotly-orca works. Insert eyeroll emoji here. I really hope it works for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM