plotly / Kaleido

Fast static image export for web-based visualization libraries with zero dependencies
Other
363 stars 36 forks source link

ValueError: Failed to start Kaleido subprocess #90

Closed brunotjuliani closed 3 years ago

brunotjuliani commented 3 years ago

I'm having and issue with the fig.write_image() function. The code was functioning well, but now the following message appears:

File "/opt/anaconda3/lib/python3.8/site-packages/plotly/basedatatypes.py", line 3806, in write_image return pio.write_image(self, *args, **kwargs) File "/opt/anaconda3/lib/python3.8/site-packages/plotly/io/_kaleido.py", line 245, in write_image img_data = to_image( File "/opt/anaconda3/lib/python3.8/site-packages/plotly/io/_kaleido.py", line 131, in to_image img_bytes = scope.transform( File "/opt/anaconda3/lib/python3.8/site-packages/kaleido/scopes/plotly.py", line 153, in transform response = self._perform_transform( File "/opt/anaconda3/lib/python3.8/site-packages/kaleido/scopes/base.py", line 293, in _perform_transform self._ensure_kaleido() File "/opt/anaconda3/lib/python3.8/site-packages/kaleido/scopes/base.py", line 198, in _ensure_kaleido raise ValueError(message) ValueError: Failed to start Kaleido subprocess. Error stream: [0510/172927.792489:WARNING:resource_bundle.cc(431)] locale_file_path.empty() for locale [0510/172927.817222:WARNING:resource_bundle.cc(431)] locale_file_path.empty() for locale [0510/172927.817786:WARNING:resource_bundle.cc(431)] locale_file_path.empty() for locale [0510/172927.836500:ERROR:platform_shared_memory_region_posix.cc(250)] Creating shared memory in /tmp/.org.chromium.Chromium.LGsKTo failed: Read-only file system (30) [0510/172927.836500:ERROR:platform_shared_memory_region_posix.cc(253)] Unable to access(W_OK|X_OK) /tmp: Read-only file system (30) Received signal 6

0 0x55ecb0e84d79 base::debug::CollectStackTrace()

1 0x55ecb0e02633 base::debug::StackTrace::StackTrace()

2 0x55ecb0e8495b base::debug::(anonymous namespace)::StackDumpSignalHandler()

3 0x7f0ede7f4730 (/lib/x86_64-linux-gnu/libpthread-2.28.so+0x1272f)

4 0x7f0eddad37bb gsignal

5 0x7f0eddabe535 abort

6 0x55ecb0e3030a base::internal::OnNoMemoryInternal()

7 0x55ecb0e30329 base::(anonymous namespace)::OnNoMemory()

8 0x55ecb0e30319 base::TerminateBecauseOutOfMemory()

9 0x55ecb0e1a0ab base::FieldTrialList::InstantiateFieldTrialAllocatorIfNeeded()

10 0x55ecb0e1a239 base::FieldTrialList::CopyFieldTrialStateToFlags()

11 0x55ecaf975f82 content::GpuProcessHost::LaunchGpuProcess()

12 0x55ecaf974910 content::GpuProcessHost::Init()

13 0x55ecaf9746c2 content::GpuProcessHost::Get()

14 0x55ecafd91b6e base::internal::Invoker<>::RunOnce()

15 0x55ecb0e48306 base::TaskAnnotator::RunTask()

16 0x55ecb0e59cf6 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl()

17 0x55ecb0e599ea base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork()

18 0x55ecb0ea6899 base::MessagePumpLibevent::Run()

19 0x55ecb0e5a59b base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run()

20 0x55ecb0e339bd base::RunLoop::Run()

21 0x55ecaf81bf18 content::BrowserProcessSubThread::IOThreadRun()

22 0x55ecb0e72874 base::Thread::ThreadMain()

23 0x55ecb0e94caa base::(anonymous namespace)::ThreadFunc()

24 0x7f0ede7e9fa3 start_thread

25 0x7f0eddb954cf clone

r8: 0000000000000000 r9: 00007f0edbb71f50 r10: 0000000000000008 r11: 0000000000000246 r12: 000055ecad866780 r13: 000055ecad7a8eb0 r14: 000013573d013d80 r15: 000013573d136d40 di: 0000000000000002 si: 00007f0edbb71f50 bp: 00007f0edbb721b0 bx: 0000000000000006 dx: 0000000000000000 ax: 0000000000000000 cx: 00007f0eddad37bb sp: 00007f0edbb71f50 ip: 00007f0eddad37bb efl: 0000000000000246 cgf: 002b000000000033 erf: 0000000000000000 trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000 [end of stack trace] Calling _exit(1). Core file will not be generated.

Already tried to reinstall the package.

jonmmease commented 3 years ago

Hi @brunotjuliani,

thanks for the report. This part of the error messages [0510/172927.836500:ERROR:platform_shared_memory_region_posix.cc(253)] Unable to access(W_OK|X_OK) /tmp: Read-only file system (30).

Does it make sense that your process wouldn't have write access to the /tmp directory? If that's the case (and you can't change it), you could try removing the --disable-dev-shm-usage chromium flag and see if that makes a difference. Here's the general docs on customizing chromium flags (https://github.com/plotly/Kaleido/wiki/Customizing-Chromium-Flags). In particular, try doing this before the write_image call.

import plotly.io as pio
pio.kaleido.scope.chromium_args = tuple([arg for arg in pio.kaleido.scope.chromium_args if arg != "--disable-dev-shm-usage"])
brunotjuliani commented 3 years ago

Hi @brunotjuliani,

thanks for the report. This part of the error messages [0510/172927.836500:ERROR:platform_shared_memory_region_posix.cc(253)] Unable to access(W_OK|X_OK) /tmp: Read-only file system (30).

Does it make sense that your process wouldn't have write access to the /tmp directory? If that's the case (and you can't change it), you could try removing the --disable-dev-shm-usage chromium flag and see if that makes a difference. Here's the general docs on customizing chromium flags (https://github.com/plotly/Kaleido/wiki/Customizing-Chromium-Flags). In particular, try doing this before the write_image call.

import plotly.io as pio
pio.kaleido.scope.chromium_args = tuple([arg for arg in pio.kaleido.scope.chromium_args if arg != "--disable-dev-shm-usage"])

This worked just fine. Thanks for the response.