Home > Mobile >  import import tensorflow_docs error on Colab
import import tensorflow_docs error on Colab

Time:08-03

I've been using colab for deep learning for a over a month and all of a sudden import tensorflow_docs as tfdocs stopped working. Is anyone encountering the same issues???

I'm running tf.version 2.8.2

> !pip install git https://github.com/tensorflow/docs
> 
> import tensorflow_docs as tfdocs   
> import tensorflow_docs.modeling   
> import tensorflow_docs.plots

Error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-10-8469b6568dc0> in <module>()
      2 get_ipython().system('pip install git https://github.com/tensorflow/docs')
      3 
----> 4 import tensorflow_docs as tfdocs
      5 import tensorflow_docs.modeling
      6 import tensorflow_docs.plots

4 frames
/usr/local/lib/python3.7/dist-packages/tensorflow_docs/api_generator/reference_resolver.py in ReferenceResolver()
     86       py_module_names: Union[list[str], dict[str, str]],
     87       link_prefix: Optional[str] = None,
---> 88       physical_path: Optional[dict[str, str]] = None,
     89   ):
     90     """Initializes a Reference Resolver.

TypeError: 'type' object is not subscriptable

CodePudding user response:

I have this problem too, but sadly I don't have a solution. However, this is what I've tried so far:

  • Downgrading to Tensorflow 2.6
  • Installing a previous version of tensorflow_docs with !pip install git https://github.com/tensorflow/docs@my_version choosing as my_version a commit from a few weeks ago.
  • Installing tensorflow_docs in a different way, first downloading it with !git clone https://github.com/tensorflow/docs and then installing it via !pip install docs/

All without success.

Anyway from the error it seems it is a problem of the tensorflow_docs'ReferenceResolver, it looks like it is not able to find the library. However with the following instruction tensorflow-docs is found:

!pip3 freeze | grep tensorflow

CodePudding user response:

Update 1 day later: Everything is working again as before

  • Related