Import gevent module in PyScript

How to import gevent module in PyScript ?

I tried the following things :

in py-script
import gevent

ModuleNotFoundError: No module named ‘gevent’

in py-env
– gevent

ValueError: Couldn’t find a pure Python 3 wheel for ‘gevent’. You can use micropip.install(..., keep_going=True) to get a list of all packages with missing wheels.

in py-env
– ‘./gevent-1.4.0-cp35-cp35m-win_amd64.whl’

ValueError: ‘gevent-1.4.0-cp35-cp35m-win_amd64.whl’ is not a pure Python 3 wheel
(tried different wheels, no one seems working)

1 Like

The package gevent-1.4.0-cp35-cp35m-win_amd64.whl is built for Windows. Windows packages are not compatible in the browser virtual machine. The package must be a pure Python wheel or a package ported to run under Pyodide.

A pure Python wheel usually contains none-any.whl in the file name.

This article will help understand Python wheels:

Thanks for the link, I am looking into


Good article, but couldn’t create my own Pure wheel from the gevent files (‘stddef.h’ : No such file or directory)

I still look after a possible way to import gevent in PyScript

I think that’s a C header file.

I strongly suspect you won’t be able to make gevent into a pure Python wheel due to the nature of what it is. It appears to be using various low level (non-Python) things - see the description for all the references to libuv, SSL etc.

Thanks @neil
So If I understand, it is not possible to import gevent in a PyScript project, right ?

Well, strictly speaking i was just addressing the aspect of you producing a pure Python wheel, and in theory there’s still the other option John mentioned:

a package ported to run under Pyodide.

So if you are able to port gevent to Pyodide then you’d be okay…

but that’s probably easier said than done!

I haven’t looked into that side in enough depth to know if there were any serious blockers, but my sense is that it might well be challenging. Check the Pyodide documentation for more details.

Thx neil
It might be challenging, especially for me ! :wink: