Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

write_image hangs in WSL #87

Open
chrispijo opened this issue May 1, 2021 · 9 comments
Open

write_image hangs in WSL #87

chrispijo opened this issue May 1, 2021 · 9 comments
Labels
bug something broken P3 not needed for current cycle

Comments

@chrispijo
Copy link

On my WSL setup I get an issue when I run the code below. It hangs indefinitely on response = self._proc.stdout.readline(). This also happens for the simpler example given in another issue. I opened on request of jonmmease a new issue.

Note that I installed plotly from jonmmease's branch 'kaleido_v5_updates'. Besides that, kaleido 0.2.1 is installed. My OS setup is WSL: Ubuntu 20.04 on top of Windows 10. The code below is ran with files on ~, the same issue occurs when running with files on /mnt/c/.

(uenv) chris@Notebook:~/test_write_image$ python
Python 3.8.5 (default, Jan 27 2021, 15:41:15)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import json
>>> import plotly.graph_objects as go
>>> import plotly.io as pio
>>>
>>>
>>> json_file_path = "data_set_figures.json"
>>> export_path = "figure2.png"
>>>
>>>
>>> with open(json_file_path) as json_file:
...     json_data = json.load(json_file)
...     graph_dict = json_data["data"][0]  # First figure in data set
...     figure_json = graph_dict['figure_json']
...     data_dict = json.loads(figure_json)
...     fig = go.Figure()
...     fig._data = data_dict['data']
...     fig._layout = data_dict['layout']
...     fig.write_image(file=export_path, width=1280, height=720, scale=1.0, engine="kaleido", format="png")
...
^CTraceback (most recent call last):
  File "<stdin>", line 9, in <module>
  File "/home/chris/test_write_image/uenv/lib/python3.8/site-packages/plotly/basedatatypes.py", line 3806, in write_image
    return pio.write_image(self, *args, **kwargs)
  File "/home/chris/test_write_image/uenv/lib/python3.8/site-packages/plotly/io/_kaleido.py", line 258, in write_image
    img_data = to_image(
  File "/home/chris/test_write_image/uenv/lib/python3.8/site-packages/plotly/io/_kaleido.py", line 144, in to_image
    img_bytes = scope.transform(
  File "/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/scopes/plotly.py", line 153, in transform
    response = self._perform_transform(
  File "/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/scopes/base.py", line 308, in _perform_transform
    response = self._proc.stdout.readline()
KeyboardInterrupt
>>> scope = pio.kaleido.scope
>>> print(scope._std_error.getvalue().decode())
[0501/152702.452246:ERROR:platform_shared_memory_region_posix.cc(47)] Descriptor access mode (0) differs from expected (2)
[0501/152702.452366:FATAL:platform_shared_memory_region_posix.cc(100)] Check failed: CheckPlatformHandlePermissionsCorrespondToMode(handle.get(), mode, size).
#0 0x7fbb0e43dd79 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d510639932ce)#1 0x7fbb0e3bb633 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51063910b88)#2 0x7fbb0e3cb15f (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d510639206b4)#3 0x7fbb0e3cbcde (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51063921233)#4 0x7fbb0e460628 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d510639b5b7d)#5 0x7fbb0d3ae972 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51062903ec7)#6 0x7fbb0d3b0609 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51062905b5e)#7 0x7fbb0d3c1b2b (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51062917080)#8 0x7fbb0d3a9007 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d510628fe55c)#9 0x7fbb0d3b082a (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51062905d7f)#10 0x7fbb0ea656e9 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51063fbac3e)
#11 0x7fbb0ea54e97 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51063faa3ec)
#12 0x7fbb0ea559f0 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51063faaf45)
#13 0x7fbb0ea6ce71 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51063fc23c6)
#14 0x7fbb0d484fb0 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d510629da505)
#15 0x7fbb0e401306 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d5106395685b)
#16 0x7fbb0e412cf6 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d5106396824b)
#17 0x7fbb0e4129ea (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51063967f3f)
#18 0x7fbb0e3d0bba (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d5106392610f)
#19 0x7fbb0e41359b (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51063968af0)
#20 0x7fbb0e3ec9bd (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51063941f12)
#21 0x7fbb11663596 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51066bb8aeb)
#22 0x7fbb0e123bd9 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d5106367912e)
#23 0x7fbb0e124b64 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d5106367a0b9)
#24 0x7fbb0e122374 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d510636778c9)
#25 0x7fbb0e122cfc (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51063678251)
#26 0x7fbb0e174182 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d510636c96d7)
#27 0x7fbb0e173fbb (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d510636c9510)
#28 0x7fbb0c192f09 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d510616e845e)
#29 0x7fbb088570b3 (/usr/lib/x86_64-linux-gnu/libc-2.31.so+0x5555d5105ddac608)
#30 0x7fbb0c18c3ea (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d510616e193f)
Task trace:
#0 0x7fbb0ea6d26f (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51063fc27c4)
Received signal 6
#0 0x7fbb0e43dd79 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d510639932ce)#1 0x7fbb0e3bb633 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51063910b88)#2 0x7fbb0e43d95b (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51063992eb0)#3 0x7fbb095b23c0 (/usr/lib/x86_64-linux-gnu/libpthread-2.31.so+0x5555d5105eb07915)
#4 0x7fbb0887618b (/usr/lib/x86_64-linux-gnu/libc-2.31.so+0x5555d5105ddcb6e0)
#5 0x7fbb08855859 (/usr/lib/x86_64-linux-gnu/libc-2.31.so+0x5555d5105ddaadae)
#6 0x7fbb0e43c8f5 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51063991e4a)#7 0x7fbb0e3cb5b2 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51063920b07)#8 0x7fbb0e3cbcde (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51063921233)#9 0x7fbb0e460628 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d510639b5b7d)#10 0x7fbb0d3ae972 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51062903ec7)
#11 0x7fbb0d3b0609 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51062905b5e)
#12 0x7fbb0d3c1b2b (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51062917080)
#13 0x7fbb0d3a9007 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d510628fe55c)
#14 0x7fbb0d3b082a (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51062905d7f)
#15 0x7fbb0ea656e9 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51063fbac3e)
#16 0x7fbb0ea54e97 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51063faa3ec)
#17 0x7fbb0ea559f0 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51063faaf45)
#18 0x7fbb0ea6ce71 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51063fc23c6)
#19 0x7fbb0d484fb0 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d510629da505)
#20 0x7fbb0e401306 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d5106395685b)
#21 0x7fbb0e412cf6 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d5106396824b)
#22 0x7fbb0e4129ea (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51063967f3f)
#23 0x7fbb0e3d0bba (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d5106392610f)
#24 0x7fbb0e41359b (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51063968af0)
#25 0x7fbb0e3ec9bd (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51063941f12)
#26 0x7fbb11663596 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51066bb8aeb)
#27 0x7fbb0e123bd9 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d5106367912e)
#28 0x7fbb0e124b64 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d5106367a0b9)
#29 0x7fbb0e122374 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d510636778c9)
#30 0x7fbb0e122cfc (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d51063678251)
#31 0x7fbb0e174182 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d510636c96d7)
#32 0x7fbb0e173fbb (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d510636c9510)
#33 0x7fbb0c192f09 (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d510616e845e)
#34 0x7fbb088570b3 (/usr/lib/x86_64-linux-gnu/libc-2.31.so+0x5555d5105ddac608)
#35 0x7fbb0c18c3ea (/home/chris/test_write_image/uenv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido+0x5555d510616e193f)
  r8: 0000000000000000  r9: 00007fffd9e23e40 r10: 0000000000000008 r11: 0000000000000008
 r12: 00007fffd9e248e0 r13: 0000297bdc1f1280 r14: 0000297bdc1f1290 r15: 0000297bdc1f1298
  di: 0000000000000002  si: 00007fffd9e23e40  bp: 00007fffd9e24090  bx: 00007fbb083f0c80
  dx: 0000000000000000  ax: 0000000000000000  cx: 0000000000000008  sp: 00007fffd9e23e40
  ip: 00007fbb0887618b efl: 0000000000000246 cgf: 00000053002b0033 erf: 0000000000000000
 trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]
Calling _exit(1). Core file will not be generated.

>>>
@chrispijo
Copy link
Author

Any verdict of what it might be? This one might be longer to fix right? With it being on WSL?

@jonmmease
Copy link
Collaborator

Hi @chrispijo, thanks for the info and sorry for the delayed response.

Are you using WSL 1 or WSL 2? See https://docs.microsoft.com/en-us/windows/wsl/compare-versions. I haven't used either myself, but it looks like Chromium (which kaleido is based on) is known to not work on WSL 1 (microsoft/WSL#3282). But it looks like people have gotten it working on WSL 2 (https://scottspence.com/2021/01/05/use-chrome-in-ubuntu-wsl/).

@chrispijo
Copy link
Author

Thanks for the response. This sounds like a logical cause and solution. I am indeed working on WSL1. I am unfortunately not in the possibility to test it on WSL2 for now. When we transfer to WSL2 I will get back to this and provide feedback.

As a work around (but a solid workaround to this issue) I now run the task on Windows.

@jonmmease
Copy link
Collaborator

Ok, Thanks for the update @chrispijo

@6A61736F6E206E61646572
Copy link

I was experiencing the same issue and upgrading to WSL2 was the solution.

@chrispijo
Copy link
Author

I can now also confirm that upgrading to WSL2 solves the issue.

@spences10
Copy link

Hey @jonmmease thanks for linking my post!

@chrispijo you could take a look at this post for when I was using WSL1 to get GUIs working, there's a load of linked content in there too.

@KCollins
Copy link

KCollins commented Jul 3, 2022

Experiencing the same issue on WSL1. Is there really no alternative for image export from px? I'm reluctant to change up my system very much right now just to export an image file from a plotting program.

@gvwilson
Copy link
Collaborator

Thanks for your interest in Kaleido. We are currently working on an overhaul that might address your issue - we hope to have news in a few weeks and will post an update then. Thanks - @gvwilson

@gvwilson gvwilson self-assigned this Jul 26, 2024
@gvwilson gvwilson removed their assignment Aug 3, 2024
@gvwilson gvwilson added bug something broken P3 not needed for current cycle labels Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P3 not needed for current cycle
Projects
None yet
Development

No branches or pull requests

6 participants