Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

required dependency on importlib_resources missing

Aperta Adatta ai principianti
#11,212 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
python, tensorflow

Direzione di ricerca

Inizia ispezionando i metadati delle dipendenze di tensorflow-datasets e il percorso di caricamento del dataset che arriva a importlib_resources. Riproduci il problema in un ambiente Python 3.12 prima e dopo l’installazione del pacchetto mancante. Il lavoro è completato quando un ambiente nuovo può scaricare un dataset non memorizzato nella cache senza un ModuleNotFoundError.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

/!\ PLEASE INCLUDE THE FULL STACKTRACE AND CODE SNIPPET

Short description
Description of the bug.

Our downstream project depends on tfds and while we're in the process of patching in our repo, the better answer would be for you to fix it directly in yours.

Simply adding a dependency for higher python versions than 3.9 for importlib_resources should be sufficient.

Our repo is https://github.com/trueagi-io/FabricPC and here's the stacktrace.

Downloading and preparing dataset Unknown size (download: Unknown size, generated: Unknown size, total: Unknown size) to /home/ni/tensorflow_datasets/mnist/3.0.1...
Traceback (most recent call last):
File "/home/ni/repos/test/test2/FabricPC/examples/mnist_demo.py", line 90, in
train_loader = MnistLoader(
^^^^^^^^^^^^
File "/home/ni/repos/test/test2/FabricPC/fabricpc/utils/data/dataloader.py", line 57, in init
ds, info = tfds.load(
^^^^^^^^^^
File "/home/ni/repos/test/test2/oopy3/lib/python3.12/site-packages/tensorflow_datasets/core/logging/init.py", line 176, in call
return function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ni/repos/test/test2/oopy3/lib/python3.12/site-packages/tensorflow_datasets/core/load.py", line 669, in load
_download_and_prepare_builder(dbuilder, download, download_and_prepare_kwargs)
File "/home/ni/repos/test/test2/oopy3/lib/python3.12/site-packages/tensorflow_datasets/core/load.py", line 519, in _download_and_prepare_builder
dbuilder.download_and_prepare(**download_and_prepare_kwargs)
File "/home/ni/repos/test/test2/oopy3/lib/python3.12/site-packages/tensorflow_datasets/core/logging/init.py", line 176, in call
return function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ni/repos/test/test2/oopy3/lib/python3.12/site-packages/tensorflow_datasets/core/dataset_builder.py", line 726, in download_and_prepare
dl_manager = self._make_download_manager(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ni/repos/test/test2/oopy3/lib/python3.12/site-packages/tensorflow_datasets/core/dataset_builder.py", line 1333, in _make_download_manager
url_infos=self.url_infos,
^^^^^^^^^^^^^^
File "/home/ni/repos/test/test2/oopy3/lib/python3.12/site-packages/tensorflow_datasets/core/utils/py_utils.py", line 155, in get
return self.fget.get(None, objtype)() # pytype: disable=attribute-error
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ni/repos/test/test2/oopy3/lib/python3.12/site-packages/tensorflow_datasets/core/dataset_builder.py", line 492, in url_infos
checksums_path = cls._checksums_path
^^^^^^^^^^^^^^^^^^^
File "/home/ni/repos/test/test2/oopy3/lib/python3.12/site-packages/tensorflow_datasets/core/utils/py_utils.py", line 155, in get
return self.fget.get(None, objtype)() # pytype: disable=attribute-error
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ni/repos/test/test2/oopy3/lib/python3.12/site-packages/tensorflow_datasets/core/dataset_builder.py", line 467, in _checksums_path
if not cls.code_path:
^^^^^^^^^^^^^
File "/home/ni/repos/test/test2/oopy3/lib/python3.12/site-packages/tensorflow_datasets/core/utils/py_utils.py", line 155, in get
return self.fget.get(None, objtype)() # pytype: disable=attribute-error
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ni/repos/test/test2/oopy3/lib/python3.12/site-packages/tensorflow_datasets/core/dataset_builder.py", line 345, in code_path
or isinstance(path, importlib_resources.abc.Traversable)
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ni/repos/test/test2/oopy3/lib/python3.12/site-packages/etils/epy/lazy_imports_utils.py", line 123, in getattr
return getattr(self._module, name)
^^^^^^^^^^^^
File "/usr/lib/python3.12/functools.py", line 995, in get
val = self.func(instance)
^^^^^^^^^^^^^^^^^^^
File "/home/ni/repos/test/test2/oopy3/lib/python3.12/site-packages/etils/epy/lazy_imports_utils.py", line 84, in _module
module = importlib.import_module(self.module_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/importlib/init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'importlib_resources'
(oopy3) ni@singbuntu24:~/repos/test/test2/FabricPC$

Environment information

  • Operating System: ubuntu 24

  • Python version: 3.12.3

  • tensorflow-datasets/tfds-nightly version: tfds_nightly-4.9.9.dev202510250044-py3-none-any.whl

  • tensorflow/tf-nightly version:

  • Does the issue still exists with the last tfds-nightly package (pip install --upgrade tfds-nightly) ?
    yes it does

Reproduction instructions

In a python3.12 (and possibly other >3.9) virtual environment on a machine where a dataset has not yet been downloaded, try to use tfds to fetch the dataset and you'll get an error.

<put a code snippet, a link to a gist or a colab here>

If you share a colab, make sure to update the permissions to share it.

Link to logs
If applicable, <link to gist with logs, stack trace>

Expected behavior
What you expected to happen.

I expected the dataset to download and instead got the above stacktrace.

After pip install importlib_resources the problem disappears.

Additional context
Add any other context about the problem here.

Lingua principale
Python
Stelle
4.6k
Fork
1.6k
Merge medio
5h 47m
PR unite (30g)
2

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di tensorflow/datasets

Tutte le issue di tensorflow/datasets

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.