plotly / orca

Command line application for generating static images of interactive plotly charts
MIT License
293 stars 40 forks source link

PermissionError: [WinError 5] Access is denied #322

Open clustor opened 4 years ago

clustor commented 4 years ago

The following program gives an error "PermissionError: [WinError 5] Access is denied" on Windows 10 running Python 3.7.2 & 3.7.7. It looks like the orca executable cannot be accessed. Interestingly, the same program runs without issues on latest Python 3.8 but unfortunately one of the modules I need pythonnet is not yet supported on 3.8. I wanted to check if there is any workaround for this issue in orca.

C:\Users\DeletedName\Downloads>python orca-test.py Traceback (most recent call last): File "orca-test.py", line 24, in fig.write_image("fig1.png") File "C:\Users\DeletedName\AppData\Local\Programs\Python\Python37\lib\site-packages\plotly\basedatatypes.py", line 2813, in write_image return pio.write_image(self, *args, **kwargs) File "C:\Users\DeletedName\AppData\Local\Programs\Python\Python37\lib\site-packages\plotly\io_orca.py", line 1769, in write_image fig, format=format, scale=scale, width=width, height=height, validate=validate File "C:\Users\DeletedName\AppData\Local\Programs\Python\Python37\lib\site-packages\plotly\io_orca.py", line 1534, in to_image ensure_server() File "C:\Users\DeletedName\AppData\Local\Programs\Python\Python37\lib\site-packages\plotly\io_orca.py", line 1390, in ensure_server validate_executable() File "C:\Users\DeletedName\AppData\Local\Programs\Python\Python37\lib\site-packages\plotly\io_orca.py", line 1146, in validate_executable executable_list + ["--help"], stdout=subprocess.PIPE, stderr=subprocess.PIPE File "C:\Users\DeletedName\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 800, in init restore_signals, start_new_session) File "C:\Users\DeletedName\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 1207, in _execute_child startupinfo)

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.png")

antoinerg commented 4 years ago

I wonder what difference between Python 3.8 and 3.7 could explain that failure... :thinking:

cc @nicolaskruchten @jonmmease

andyp05 commented 4 years ago

try adding stdin=subprocess.DEVNULL to the POpen() call that generated the exception.

File "C:\Users\DeletedName\AppData\Local\Programs\Python\Python37\lib\site-packages\plotly\io_orca.py", line 1146, in validate_executable executable_list + ["--help"], stdout=subprocess.PIPE, stderr=subprocess.PIPE

this may be related to the issue I created the other day. #321

clustor commented 4 years ago

I'm afraid the problem still exists even after setting stdin to subprocess.DEVNULL while calling POpen()

Traceback (most recent call last): File "orca-test.py", line 26, in pio.write_image(fig, 'fig1.png') File "C:\Users\DeletedName\AppData\Local\Programs\Python\Python37\lib\site-packages\plotly\io_orca.py", line 1769, in write_image fig, format=format, scale=scale, width=width, height=height, validate=validate File "C:\Users\DeletedName\AppData\Local\Programs\Python\Python37\lib\site-packages\plotly\io_orca.py", line 1534, in to_image ensure_server() File "C:\Users\DeletedName\AppData\Local\Programs\Python\Python37\lib\site-packages\plotly\io_orca.py", line 1390, in ensure_server validate_executable() File "C:\Users\DeletedName\AppData\Local\Programs\Python\Python37\lib\site-packages\plotly\io_orca.py", line 1146, in validate_executable executable_list + ["--help"], stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.PIPE File "C:\Users\DeletedName\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 800, in init restore_signals, start_new_session) File "C:\Users\DeletedName\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 1207, in _execute_child startupinfo) PermissionError: [WinError 5] Access is denied