Google Colab: pip install fastbook produces dependency error with tornado v6.1

Trying to work through the fastai course with Google Colab, but I am getting a dependency error in the first section of the Intro notebook, where I am installing the fastbook library with pip as follows:

!pip install -Uqq fastbook
import fastbook
fastbook.setup_book()

Running the above pip is producing the following errors:


ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
google-colab 1.0.0 requires tornado~=5.1.0; python_version >= "3.0", but you have tornado 6.1 which is incompatible.
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-2b820b2b946f> in <module>()
      1 #hide
      2 get_ipython().system('pip install -Uqq fastbook')
----> 3 import fastbook
      4 fastbook.setup_book()

10 frames
/usr/local/lib/python3.7/dist-packages/tornado/iostream.py in BaseIOStream()
    284         self._closed = False
    285 
--> 286     def fileno(self) -> Union[int, ioloop._Selectable]:
    287         """Returns the file descriptor for this stream."""
    288         raise NotImplementedError()

AttributeError: module 'tornado.ioloop' has no attribute '_Selectable'

I am unable to proceed with any of the subsequent code in the notebook because of this initial installation error.

Any idea how to resolve this?

3 Likes

Never mind, was able to resolve this by restarting the runtime, and then executing the pip install again.

To be clear, these are the steps I took to fix:

  1. Run !pip install -Uqq fastbook
  2. Colab reports the “tornado 6.1 incompatible” error
  3. Then restart the runtime (without using factory reset)
  4. Run !pip install -Uqq fastbook again
  5. Problem is fixed and can continue working through the chapter
7 Likes

This seems to be hitting everyone. I’ve seen it from four different people already, and it happens every time we use a notebook. I’m not sure why it is occurring or why restarting the run time is now necessary every day when we log on.

Hoping for a real fix in the near future.

1 Like

I have the same issue. Worked after restarting runtime though. (as you have mentioned)

I installed an earlier version of fastbook and it works
pip install fastbook==0.0.17

1 Like

From command line you could restart the runtime with the following snippet:

import os
os.kill(os.getpid(), 9)
1 Like

With the help the above answers and SO, this worked for me:

!pip install fastbook==0.0.17

!pip uninstall tornado -y

!yes | pip install tornado==5.1.0

import fastbook

fastbook.setup_book()
1 Like

Thanks! It worked. Was this chunk of code just setting up the textbook?