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

[Bug]: Tries to write core_typemap.pkl into the install location #2048

Open
3 tasks done
yarikoptic opened this issue Mar 1, 2025 · 2 comments · May be fixed by #2057
Open
3 tasks done

[Bug]: Tries to write core_typemap.pkl into the install location #2048

yarikoptic opened this issue Mar 1, 2025 · 2 comments · May be fixed by #2057
Assignees
Labels
category: bug errors in the code or code behavior priority: high impacts proper operation or use of feature important to most users

Comments

@yarikoptic
Copy link
Contributor

yarikoptic commented Mar 1, 2025

What happened?

In a work with @manimoh I have tried to run the script within singularity container where I installed pynwb but it crashed since tried to

$> singularity exec ./mvmdmlab-nwbconverters.sing /opt/miniconda-latest/envs/mvdmlab/bin/python3                          
Python 3.10.16 | packaged by conda-forge | (main, Dec  5 2024, 14:16:10) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pynwb
^[..Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/miniconda-latest/envs/mvdmlab/lib/python3.10/site-packages/pynwb/__init__.py", line 250, in <module>
    __load_core_namespace()
  File "/opt/miniconda-latest/envs/mvdmlab/lib/python3.10/site-packages/pynwb/__init__.py", line 229, in __load_core_namespace
    with open(__resources['cached_typemap_path'], 'wb') as f:
PermissionError: [Errno 13] Permission denied: '/opt/miniconda-latest/envs/mvdmlab/lib/python3.10/site-packages/pynwb/core_typemap.pkl'
>>> pkg_resources
<module 'pkg_resources' from '/opt/miniconda-latest/envs/mvdmlab/lib/python3.10/site-packages/pkg_resources/__init__.py'>
*>>> pkg_resources.get_distribution('pynwb')
pynwb 2.8.3 (/opt/miniconda-latest/envs/mvdmlab/lib/python3.10/site-packages)
the same with 3.-
$> singularity exec ./mvmdmlab-nwbconverters.sing /opt/miniconda-latest/envs/mvdmlab/bin/python3                          
Python 3.10.16 | packaged by conda-forge | (main, Dec  5 2024, 14:16:10) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pynwb
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/miniconda-latest/envs/mvdmlab/lib/python3.10/site-packages/pynwb/__init__.py", line 240, in <module>
    __load_core_namespace()
  File "/opt/miniconda-latest/envs/mvdmlab/lib/python3.10/site-packages/pynwb/__init__.py", line 219, in __load_core_namespace
    with open(__resources['cached_typemap_path'], 'wb') as f:
PermissionError: [Errno 13] Permission denied: '/opt/miniconda-latest/envs/mvdmlab/lib/python3.10/site-packages/pynwb/core_typemap.pkl'
>>> pkg_resources
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'pkg_resources' is not defined
>>> import pkg_resources
<stdin>:1: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
>>> pkg_resources.get_distribution('pynwb')
pynwb 3.0.0 (/opt/miniconda-latest/envs/mvdmlab/lib/python3.10/site-packages)

Steps to Reproduce

create a singularity container

Operating System

Linux

Python Executable

Conda

Python Version

3.10

Package Versions

No response

Code of Conduct

@stephprince
Copy link
Contributor

@yarikoptic thanks for reporting, I believe this is an issue related to the TypeMap caching that was recently introduced for performance speedups on import of PyNWB

I can take a look at this (@rly I think this could be an additional motivation for your proposal in #2045)

@stephprince stephprince self-assigned this Mar 4, 2025
@stephprince stephprince added category: bug errors in the code or code behavior priority: high impacts proper operation or use of feature important to most users labels Mar 4, 2025
@yarikoptic
Copy link
Contributor Author

FWIW -- "caching" is great, but should likely to go to appropriate to caches folder. We use https://pypi.org/project/platformdirs/ for that, e.g. here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: bug errors in the code or code behavior priority: high impacts proper operation or use of feature important to most users
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants