Skip to content

FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmph2ym29_s' when running from plotly fig.write_image #292

@OliverKleinBST

Description

@OliverKleinBST

I have the problem that when I run fig.write_image('/home/jovyan/hpg2.png')

I get an error which happens to me when I run the code in docker image as a non root user.
With root user I dont get the error, though I checked the /tmp path and access wise everything is open like 777 on /tmp

[2026-01-22 19:52:35,318][kaleido.kaleido][DEBUG] - Successfully registered PlotlyJSONEncoder.
[2026-01-22 19:52:35,323][kaleido.kaleido][DEBUG] - Timeout: 90
[2026-01-22 19:52:35,323][choreographer.browser_async][DEBUG] - Attempting to open new browser.
[2026-01-22 19:52:35,324][choreographer.browsers.chromium][INFO] - Chromium init'ed with kwargs {}
[2026-01-22 19:52:35,324][choreographer.browsers.chromium][DEBUG] - Looking for a chrome browser.
[2026-01-22 19:52:35,325][choreographer.browsers.chromium][INFO] - Found chromium path: /opt/venv/lib/python3.12/site-packages/choreographer/cli/browser_exe/chrome-linux64/chrome
[2026-01-22 19:52:35,325][choreographer.utils._tmpfile][INFO] - Temp directory created: /tmp/tmp_ub7w2kf.
[2026-01-22 19:52:35,325][kaleido._page_generator][DEBUG] - Plotly script: ('file:///opt/venv/lib/python3.12/site-packages/plotly/package_data/plotly.min.js', 'utf-8')
[2026-01-22 19:52:35,326][choreographer.browser_async][INFO] - Opening browser.
[2026-01-22 19:52:35,326][choreographer.browser_async][DEBUG] - Trying to open browser.
[2026-01-22 19:52:35,327][choreographer.utils._tmpfile][INFO] - Temp directory created: /tmp/tmph2ym29_s.
[2026-01-22 19:52:35,327][choreographer.browsers.chromium][DEBUG] - Checking for libs needed.
[2026-01-22 19:52:35,327][choreographer.browsers.chromium][DEBUG] - Trying ldd /opt/venv/lib/python3.12/site-packages/choreographer/cli/browser_exe/chrome-linux64/chrome
[2026-01-22 19:52:35,338][choreographer.browsers.chromium][DEBUG] - No problems found with dependencies
[2026-01-22 19:52:35,338][choreographer.browsers.chromium][INFO] - Temporary directory at: /tmp/tmph2ym29_s
[2026-01-22 19:52:35,338][choreographer.browsers.chromium][DEBUG] - Returning cli: ['/opt/venv/bin/python3', '/opt/venv/lib/python3.12/site-packages/choreographer/browsers/_unix_pipe_chromium_wrapper.py', '/opt/venv/lib/python3.12/site-packages/choreographer/cli/browser_exe/chrome-linux64/chrome', '--disable-gpu', '--headless', '--no-sandbox', '--disable-breakpad', '--allow-file-access-from-files', '--enable-logging=stderr', '--user-data-dir=/tmp/tmph2ym29_s', '--no-first-run', '--enable-unsafe-swiftshader', '--disable-dev-shm-usage', '--disable-background-media-suspend', '--disable-lazy-loading', '--disable-background-timer-throttling', '--disable-backgrounding-occluded-windows', '--disable-renderer-backgrounding', '--disable-component-update', '--disable-hang-monitor', '--disable-popup-blocking', '--disable-prompt-on-repost', '--disable-ipc-flooding-protection', '--disable-sync', '--metrics-recording-only', '--password-store=basic', '--use-mock-keychain', '--no-default-browser-check', '--no-process-per-site', '--disable-web-security', '--remote-debugging-pipe']
[2026-01-22 19:52:35,338][choreographer.browsers.chromium][DEBUG] - Returning args: {'close_fds': True, 'stdin': 16, 'stdout': 15}
[2026-01-22 19:52:35,339][choreographer.protocol.devtools_async][DEBUG] - Created new target 0.
[2026-01-22 19:52:35,339][choreographer.protocol.devtools_async][DEBUG] - New session:
[2026-01-22 19:52:35,339][choreographer.browser_async][DEBUG] - Starting watchdog
[2026-01-22 19:52:35,339][choreographer.browser_async][DEBUG] - Opening channel.
[2026-01-22 19:52:35,339][choreographer.browser_async][DEBUG] - Running read loop
[2026-01-22 19:52:35,339][choreographer.browser_async][DEBUG] - Populating Targets
[2026-01-22 19:52:35,341][choreographer.browser_async][DEBUG] - In watchdog
[2026-01-22 19:52:35,341][choreographer.protocol.devtools_async][DEBUG] - Cmd 'Target.getTargets', param keys '', sessionId ''
[2026-01-22 19:52:35,341][choreographer._brokers._async][DEBUG] - Broker writing Target.getTargets with key ('', 0)
[2026-01-22 19:52:35,341][choreographer._brokers._async][DEBUG] - Created future: ('', 0)
[2026-01-22 19:52:35,341][choreographer.channels._wire][DEBUG] - Serialized: {"id": 0, "meth...et.getTargets"}, size: 40
[2026-01-22 19:52:35,342][choreographer.channels.pipe][DEBUG] - Writing message b'{"id": 0, "meth'...b't.getTargets"}\x00', size: 41.
[2026-01-22 19:52:35,342][choreographer.channels.pipe][DEBUG] - Wrote 41/41
[2026-01-22 19:52:35,524][choreographer.channels.pipe][DEBUG] - First read in loop: b'{bye}\n'...b'{bye}\n'. size: 6.
[2026-01-22 19:52:35,525][choreographer.channels.pipe][DEBUG] - Received b'{bye}\n'. is bye?
[2026-01-22 19:52:35,525][choreographer.channels.pipe][DEBUG] - OSError
[2026-01-22 19:52:35,525][choreographer.channels.pipe][DEBUG] - Total loops: 1, Final size: 6.
[2026-01-22 19:52:35,526][choreographer._brokers._async][DEBUG] - Error in readloop. Will post a close() task.
[2026-01-22 19:52:35,526][choreographer._brokers._async][DEBUG] - PipeClosedError caught
[2026-01-22 19:52:35,527][choreographer.browser_async][INFO] - Closing browser.
[2026-01-22 19:52:35,527][choreographer.browser_async][DEBUG] - Cancelling watchdog.
[2026-01-22 19:52:35,527][choreographer.browser_async][DEBUG] - Starting browser close methods.
[2026-01-22 19:52:35,528][choreographer.browser_async][DEBUG] - Trying Browser.close
[2026-01-22 19:52:35,528][choreographer.protocol.devtools_async][DEBUG] - Cmd 'Browser.close', param keys '', sessionId ''
[2026-01-22 19:52:35,528][choreographer._brokers._async][DEBUG] - Broker writing Browser.close with key ('', 1)
[2026-01-22 19:52:35,529][choreographer._brokers._async][DEBUG] - Created future: ('', 1)
[2026-01-22 19:52:35,529][choreographer.browser_async][DEBUG] - Watchdog full shutdown (in finally:)
[2026-01-22 19:52:35,530][choreographer._brokers._async][DEBUG] - Future for ('', 1) deleted.
[2026-01-22 19:52:35,530][choreographer.browser_async][DEBUG] - Can't send Browser.close on close channel
[2026-01-22 19:52:35,538][choreographer.browser_async][DEBUG] - Browser close methods finished.
[2026-01-22 19:52:35,538][choreographer._brokers._async][DEBUG] - Cancelling message futures
[2026-01-22 19:52:35,538][choreographer._brokers._async][DEBUG] - Cancelling read task
[2026-01-22 19:52:35,538][choreographer._brokers._async][DEBUG] - Cancelling subscription-futures
[2026-01-22 19:52:35,538][choreographer._brokers._async][DEBUG] - Cancelling background tasks
[2026-01-22 19:52:35,539][choreographer.browser_async][DEBUG] - Broker cleaned up.
[2026-01-22 19:52:35,539][choreographer.browser_async][DEBUG] - Logging pipe closed.
[2026-01-22 19:52:35,539][choreographer.browser_async][DEBUG] - Browser channel closed.
[2026-01-22 19:52:35,539][choreographer.utils._tmpfile][INFO] - TemporaryDirectory.cleanup() worked.
[2026-01-22 19:52:35,540][choreographer.utils._tmpfile][INFO] - shutil.rmtree worked.
[2026-01-22 19:52:35,540][choreographer.browser_async][DEBUG] - Browser implementation cleaned up.
[2026-01-22 19:52:35,540][choreographer.utils._tmpfile][INFO] - TemporaryDirectory.cleanup() worked.
[2026-01-22 19:52:35,540][choreographer.utils._tmpfile][INFO] - shutil.rmtree worked.
[2026-01-22 19:52:35,541][kaleido.kaleido][INFO] - Cancelling tasks.
[2026-01-22 19:52:35,541][kaleido.kaleido][INFO] - Exiting Kaleido/Choreo
[2026-01-22 19:52:35,786][choreographer.utils._tmpfile][INFO] - TemporaryDirectory.cleanup() worked.
[2026-01-22 19:52:35,786][choreographer.utils._tmpfile][DEBUG] - Error during tmp file removal.
Traceback (most recent call last):
File "/usr/lib/python3.12/shutil.py", line 773, in rmtree
orig_st = os.lstat(path, dir_fd=dir_fd)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmph2ym29_s'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/venv/lib/python3.12/site-packages/choreographer/utils/_tmpfile.py", line 174, in clean
shutil.rmtree(self.path, onexc=remove_readonly) # type: ignore [call-arg, unused-ignore]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/shutil.py", line 775, in rmtree
onexc(os.lstat, path, err)
File "/opt/venv/lib/python3.12/site-packages/choreographer/utils/_tmpfile.py", line 167, in remove_readonly
Path(path).chmod(stat.S_IWUSR)
^^^^^^^^^^
File "/usr/lib/python3.12/pathlib.py", line 1164, in init
super().init(*args)
File "/usr/lib/python3.12/pathlib.py", line 358, in init
import ntpath
ImportError: sys.meta_path is None, Python is likely shutting down

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions