memray: Failed to write output header
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
I have a file hello.py that just contains print("hello world"). I get the following error
(test) jhaertel@orca code % memray run hello.py
Writing profile results into memray-hello.py.75618.bin
Traceback (most recent call last):
File "/u/jhaertel/.conda/envs/test/bin/memray", line 8, in <module>
sys.exit(main())
~~~~^^
File "/u/jhaertel/.conda/envs/test/lib/python3.13/site-packages/memray/commands/__init__.py", line 138, in main
arg_values.entrypoint(arg_values, parser)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
File "/u/jhaertel/.conda/envs/test/lib/python3.13/site-packages/memray/commands/run.py", line 339, in run
_run_with_file_output(args)
~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/u/jhaertel/.conda/envs/test/lib/python3.13/site-packages/memray/commands/run.py", line 188, in _run_with_file_output
_run_tracker(
~~~~~~~~~~~~^
destination=destination,
^^^^^^^^^^^^^^^^^^^^^^^^
args=args,
^^^^^^^^^^
post_run_message=example_report_generation_message,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/u/jhaertel/.conda/envs/test/lib/python3.13/site-packages/memray/commands/run.py", line 57, in _run_tracker
with tracker:
^^^^^^^
File "src/memray/_memray.pyx", line 697, in memray._memray.Tracker.__enter__
File "src/memray/_memray.pyx", line 720, in memray._memray.Tracker.__enter__
RuntimeError: Failed to write output header
This occurs with any python file I attempt.
Expected Behavior
I expected it to run and create a binary file.
Steps To Reproduce
- In this virtual environment, I just have python and memray.
- Run memray on
hello.pythat just containsprint("hello world").
Memray Version
1.16.0
Python Version
3.12, 3.13
Operating System
macOS
Anything else?
This is on MacOS 12.6.2 on a Intel i7-6700K CPU.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (8 by maintainers)
I’ve opened #748 to have Memray support falling back to a slower but more portable path that should work on non-POSIX filesystems like the ones you’re each working on. In the meantime, it seems like writing your capture files to
/tmpshould be a good workaround for both of you.Don’t worry check the previous discussion about what the problem is