Forum Archive

[SOLVED] How to install greenlet (for gevent-websocket) ?

Brun0oO

Hello,

I saw this post http://omz-software.com/pythonista/docs/ios/bottle/async.html and I would like to try websocket communications between my iOS device and my desktop.
Using Stash and pip, I managed to install gevent. The gevent-websocket installation complained about greenlet installation. I tried to install it using pip install greenlet but I got a message "Error: Cannot locate packages. Manual installation required.".
How this can be done ?

Thanks for your help...
Brun0oO

ywangd

It cannot be done. greenlet does not work in Pythonista.

greenlet is a pure C extension. It does not have any Python modules to be installed. That is what caused the error. C extension installation generally requires compiling C code which is impossible in Pythonista.

ccc

Asyncio is built into Python 3.5 so, in theory, you could add https://github.com/Lupino/aiobottle to Pythonista 3. It is pure Python and requires https://github.com/KeepSafe/aiohttp which is also pure Python. aiohttp alone would be enough to give you Web Sockets but aiobottle would be required to get async bottle. Please let us know if you make progress on this.

Brun0oO

Thanks a lot! I´ll give it a try...

Brun0oO

Brun0oO

I managed to install aiobottle which requires aiohttp, multidict and chardet (I used pip install under stash to install all these packages).

And this simple server (running on my ios device) seems to work from my desktop web browser:

from aiobottle import AsyncBottle
import aiohttp

app = AsyncBottle()

@app.get('/')
def root():
    return 'hello word!'

def main(host='0.0.0.0', port=8080):
    from bottle import run

    run(app, host = host, port = port, server = 'aiobottle:AsyncServer')

if __name__ == '__main__':
    main()

Now, I'm trying to understand how websockets should work with aiobottle.

Thanks again for your help!
Brun0oO

ccc

@Brun0oO Were you able to get websockets working?

Brun0oO

@ccc not really ;o)

I prefer to open a new topic :
https://forum.omz-software.com/topic/3404/is-it-possible-to-manage-websockets-with-aiosync-and-aiohttp

Brun0oO