Enabling gevent debugging in Google Colab

894 Views Asked by At

I want to used the grequests library in a Google Colab notebook, however upon importing it (and patching it using gevent.monkey), the program spits out a random amount of the following warning:

It seems that the gevent monkey-patching is being used. Please set an environment variable with:
GEVENT_SUPPORT=True
to enable gevent support in the debugger.

Looking around, the only solution I have found recommended was

import os; os.environ["GEVENT_SUPPORT"] = "True"

However, this solution does not work. Has anyone found a workaround for this issue?

My code:

from gevent import monkey
monkey.patch_all(thread=False, select=False)

import grequests
1

There are 1 best solutions below

1
POJOLO On

I solved this problem by deleting and importing the module.

Import:

pip install grequests

import grequests

Deleting:

import sys
del sys.modules["grequests"] 
del grequests
del sys.modules["gevent.monkey"] 

Re-import:

import grequests

I don't know if this can break anything, since removing libraries is a bad option, but it helped with messages and grequests works fine for me.