AttributeError: module 'importlib_resources' has no attribute 'files'

See original GitHub issue

conda env commands are failing with:

$ conda env list
Traceback (most recent call last):
  File "/home/moorepants/miniconda/bin/conda-env", line 6, in <module>
    from conda_env.cli.main import main
  File "/home/moorepants/miniconda/lib/python3.7/site-packages/conda_env/cli/main.py", line 44, in <module>
    from . import main_create
  File "/home/moorepants/miniconda/lib/python3.7/site-packages/conda_env/cli/main_create.py", line 19, in <module>
    from .. import exceptions, specs
  File "/home/moorepants/miniconda/lib/python3.7/site-packages/conda_env/specs/__init__.py", line 9, in <module>
    from .notebook import NotebookSpec
  File "/home/moorepants/miniconda/lib/python3.7/site-packages/conda_env/specs/notebook.py", line 5, in <module>
    import nbformat
  File "/home/moorepants/miniconda/lib/python3.7/site-packages/nbformat/__init__.py", line 32, in <module>
    from .validator import validate, ValidationError
  File "/home/moorepants/miniconda/lib/python3.7/site-packages/nbformat/validator.py", line 12, in <module>
    from .json_compat import get_current_validator, ValidationError
  File "/home/moorepants/miniconda/lib/python3.7/site-packages/nbformat/json_compat.py", line 10, in <module>
    import jsonschema
  File "/home/moorepants/miniconda/lib/python3.7/site-packages/jsonschema/__init__.py", line 29, in <module>
    from jsonschema.protocols import Validator
  File "/home/moorepants/miniconda/lib/python3.7/site-packages/jsonschema/protocols.py", line 33, in <module>
    from jsonschema.validators import RefResolver
  File "/home/moorepants/miniconda/lib/python3.7/site-packages/jsonschema/validators.py", line 356, in <module>
    meta_schema=_utils.load_schema("draft3"),
  File "/home/moorepants/miniconda/lib/python3.7/site-packages/jsonschema/_utils.py", line 60, in load_schema
    path = resources.files(__package__).joinpath(f"schemas/{name}.json")

See: https://github.com/conda/conda/issues/11270

I have jsonschema 4.4.0 installed from conda-forge.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Juliancommented, Feb 28, 2022

My guess without any info would actually be more like that conda is installing or depending on a very old version of importlib_resources, but it’s a bit impossible to guess. What I am asking is to provide me some way of getting the same environment that you have without assuming I know how to do so 😃

I would be quite surprised if this was an issue with jsonschema, but anything’s possible, which is why the above would be helpful.

0reactions
moorepantscommented, Mar 1, 2022

A conda dev stated that jsonschema >= 4 breaks conda and that I have to downgrade. I’ve opened a fix here https://github.com/conda-forge/conda-feedstock/pull/160, so I’ll close this as it isn’t a bug with this package. Sorry for the noise.

Read more comments on GitHub >

github_iconTop Results From Across the Web

module 'importlib.resources' has no attribute 'files' · Issue #1 ...
Error on 3.7 and 3.8 - not on 3.9 or higher. ... AttributeError: module 'importlib.resources' has no attribute 'files' #1.
Read more >
AttributeError: module 'importlib' has no attribute 'util' II
Importing a package doesn't automatically load its submodules. · sounds legit - but that doesn't answer my question - pyqtdeploy will work on...
Read more >
importlib — The implementation of import — Python 3.11.1 ...
The argument must be a module object, so it must have been successfully imported before. This is useful if you have edited the...
Read more >
importlib-resources - PyPI
importlib_resources is a backport of Python standard library importlib.resources module for older Pythons. The key goal of this module is to replace parts ......
Read more >
importlib-resources 5.10.2.dev4+gf8c6b66.d20221216 ...
importlib_resources is a library which provides for access to resources in Python packages. It provides functionality similar to pkg_resources Basic Resource ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found