You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the current behavior
The import hooks in https://github.com/googlecolab/colabtools/tree/main/google/colab/_import_hooks are written for pre-Python 3.4. The find_module method was replaced by find_spec in Python 3.4, at which point find_module was also deprecated. importlib.util.find_spec works around the possibility of old finders by simply ignoring those that lack this method, but this means that the modules that colab is patching will not benefit from newer functionality in importlib or related modules that relies on this function. Moreover, new finder implementations may not be written around this and may expect find_spec to be defined on all loaders in sys.meta_path, resulting in runtime errors. A concrete example of this is in numba-cuda, which uses a custom finder to provide backwards compatibility with the legacy cuda target in numba (see this post for more information).
Describe the expected behavior
Finders should be able to rely on all elements of sys.meta_path implementing find_spec
Describe the current behavior
The import hooks in https://github.com/googlecolab/colabtools/tree/main/google/colab/_import_hooks are written for pre-Python 3.4. The
find_module
method was replaced byfind_spec
in Python 3.4, at which pointfind_module
was also deprecated.importlib.util.find_spec
works around the possibility of old finders by simply ignoring those that lack this method, but this means that the modules that colab is patching will not benefit from newer functionality inimportlib
or related modules that relies on this function. Moreover, new finder implementations may not be written around this and may expectfind_spec
to be defined on all loaders insys.meta_path
, resulting in runtime errors. A concrete example of this is innumba-cuda
, which uses a custom finder to provide backwards compatibility with the legacy cuda target in numba (see this post for more information).Describe the expected behavior
Finders should be able to rely on all elements of
sys.meta_path
implementingfind_spec
What web browser you are using
Firefox
Additional context
The issue is reproducible with this gist: https://colab.research.google.com/gist/vyasr/9ef26e1073037a15d08fc847798f39b2/colab_meta_path.ipynb
The text was updated successfully, but these errors were encountered: