Memmap cannot use existing file handles
See original GitHub issueI obtained Phy from the latest dev (2.0a0), and after clustering with spyking-circus, I get the error below.
I would so much appreciate some help!
(python3) segundo.martinez@pcl-imba-3:spyking-circus$ phy template-gui phy/params.py
Traceback (most recent call last):
File "/home/segundo.martinez/miniconda3/envs/python3/bin/phy", line 11, in <module>
load_entry_point('phy', 'console_scripts', 'phy')()
File "/home/segundo.martinez/miniconda3/envs/python3/lib/python3.5/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/home/segundo.martinez/miniconda3/envs/python3/lib/python3.5/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/home/segundo.martinez/miniconda3/envs/python3/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/segundo.martinez/miniconda3/envs/python3/lib/python3.5/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/segundo.martinez/miniconda3/envs/python3/lib/python3.5/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/home/segundo.martinez/miniconda3/envs/python3/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/segundo.martinez/git/phy/phy/apps/__init__.py", line 112, in cli_template_gui
template_gui(params_path)
File "/home/segundo.martinez/git/phy/phy/apps/template/gui.py", line 829, in template_gui
controller = TemplateController(**params)
File "/home/segundo.martinez/git/phy/phy/apps/template/gui.py", line 87, in __init__
self.model = TemplateModel(dat_path, **kwargs)
File "/home/segundo.martinez/miniconda3/envs/python3/lib/python3.5/site-packages/phylib/io/model.py", line 193, in __init__
self._load_data()
File "/home/segundo.martinez/miniconda3/envs/python3/lib/python3.5/site-packages/phylib/io/model.py", line 217, in _load_data
self.spike_samples = self._load_spike_samples()
File "/home/segundo.martinez/miniconda3/envs/python3/lib/python3.5/site-packages/phylib/io/model.py", line 431, in _load_spike_samples
return self._read_array(path)
File "/home/segundo.martinez/miniconda3/envs/python3/lib/python3.5/site-packages/phylib/io/model.py", line 316, in _read_array
return read_array(path).squeeze()
File "/home/segundo.martinez/miniconda3/envs/python3/lib/python3.5/site-packages/phylib/io/model.py", line 43, in read_array
return np.load(path, mmap_mode='r')
File "/home/segundo.martinez/miniconda3/envs/python3/lib/python3.5/site-packages/numpy/lib/npyio.py", line 430, in load
return format.open_memmap(file, mode=mmap_mode)
File "/home/segundo.martinez/miniconda3/envs/python3/lib/python3.5/site-packages/numpy/lib/format.py", line 754, in open_memmap
raise ValueError("Filename must be a string. Memmap cannot use"
ValueError: Filename must be a string. Memmap cannot use existing file handles.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Memmap cannot use existing file handles. #3143 - GitHub
ValueError: Filename must be a string. Memmap cannot use existing file handles. However, numpy.memmap is more than happy to work with files.
Read more >Filename must be a string or a path-like object. Memmap ...
Filename must be a string or a path-like object. Memmap cannot use existing file handles. Package: numpy logo numpy. github stars 18118. Exception...
Read more >python - Why isn't mmap closing associated file (getting ...
This will not close the open file. The memory mapping is independent of the file handle. You can use the file handle as...
Read more >numpy.memmap — NumPy v1.24 Manual
Create or overwrite existing file for reading and writing. 'c'. Copy-on-write: assignments affect data in memory, but changes are not saved to disk....
Read more >mmap — Memory-mapped file support — Python 3.11.1 ...
If you wish to map an existing Python file object, use its fileno() method ... from the file specified by the file handle...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
are you able to do some quick and dirty debugging for me? Open
/home/segundo.martinez/miniconda3/envs/python3/lib/python3.5/site-packages/phylib/io/model.py
in a text editor, go to line 43, and replace the line by:try again and send me the output. Thanks!
Hi @rossant ,
Thank you very much for your help!. It took me the whole weekend to play around this
I’ve just installed phylib and my conda environment moves from python3.5 to python3.7. The memory map issue is gone after updating to phylib. To run phy required only few updates (pyOpenGL, colorcet).
Thank you very much for your great assistance!