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]: Fail to import in read-only file system #2053

Open
3 tasks done
alejoe91 opened this issue Mar 5, 2025 · 1 comment · May be fixed by #2057
Open
3 tasks done

[Bug]: Fail to import in read-only file system #2053

alejoe91 opened this issue Mar 5, 2025 · 1 comment · 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

@alejoe91
Copy link

alejoe91 commented Mar 5, 2025

What happened?

I'm trying to import pynwb within an Apptainer container and I'm getting a Read-only filesystem error:

apptainer shell /allen/aind/scratch/alessio.buccino/singularity_cache_dir/ghcr.io-allenneuraldynamics-aind-ephys-pipeline-nwb-si-0.102.1.img

In the container

Apptainer> python
Python 3.11.5 (main, Sep 11 2023, 13:54:46) [GCC 11.2.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/conda/lib/python3.11/site-packages/pynwb/__init__.py", line 250, in <module>
    __load_core_namespace()
  File "/opt/conda/lib/python3.11/site-packages/pynwb/__init__.py", line 219, in __load_core_namespace
    Path(__resources['cached_typemap_path']).unlink(missing_ok=True)
  File "/opt/conda/lib/python3.11/pathlib.py", line 1147, in unlink
    os.unlink(self)
OSError: [Errno 30] Read-only file system: '/opt/conda/lib/python3.11/site-packages/pynwb/core_typemap.pkl'

I think that the error might be related to running in an environment where I previously used an apptainer image with another pynwb version.

Anyways, I think that the code should have some try-except to avoid errors when unlinking the core_typemap

Steps to Reproduce

import pynwb # in an apptainer container

Traceback

Apptainer> python
Python 3.11.5 (main, Sep 11 2023, 13:54:46) [GCC 11.2.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/conda/lib/python3.11/site-packages/pynwb/__init__.py", line 250, in <module>
    __load_core_namespace()
  File "/opt/conda/lib/python3.11/site-packages/pynwb/__init__.py", line 219, in __load_core_namespace
    Path(__resources['cached_typemap_path']).unlink(missing_ok=True)
  File "/opt/conda/lib/python3.11/pathlib.py", line 1147, in unlink
    os.unlink(self)
OSError: [Errno 30] Read-only file system: '/opt/conda/lib/python3.11/site-packages/pynwb/core_typemap.pkl'

Operating System

Linux

Python Executable

Conda

Python Version

3.11

Package Versions

pynwb == 2.8.3

Code of Conduct

@stephprince
Copy link
Contributor

Thanks for reporting this issue @alejoe91

I think that the error might be related to running in an environment where I previously used an apptainer image with another pynwb version.

I agree, I think the error is coming from an attempt to remove the previously cached type map from a different pynwb version. I will look into addressing this. (There is a related issue in #2048 with a similar write access error)

@stephprince stephprince self-assigned this Mar 6, 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 6, 2025
@stephprince stephprince linked a pull request Mar 12, 2025 that will close this issue
7 tasks
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