question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Runtime error with eventlet and flask/socketio

See original GitHub issue

Hey,

I’m really hyper by your work, this project is awesome ! Here is my setup:

0.6.5
Python: 3.6.8 (default, Oct  7 2019, 12:59:55)
Executable: /usr/bin/python3
OS: Linux
Arch: x86_64


I’m just having a bit of trouble when compiling it. Here is my code below and the log:

import eventlet
eventlet.monkey_patch()

from flask import Flask
from flask_socketio import SocketIO, send, emit

app = Flask(__name__)
socketio = SocketIO(app)

if __name__ == "__main__":
    socketio.run(app, host='127.0.0.1', port=8000)
$> python3 -m nuitka --standalone app.py
Nuitka:WARNING:Unresolved '__import__' call at '/usr/local/lib/python3.6/dist-packages/eventlet/patcher.py:100' may require use of '--include-plugin-directory' or '--include-plugin-files'.
Nuitka:WARNING:Unresolved '__import__' call at '/usr/local/lib/python3.6/dist-packages/eventlet/patcher.py:201' may require use of '--include-plugin-directory' or '--include-plugin-files'.
Nuitka:WARNING:Unresolved '__import__' call at '/usr/local/lib/python3.6/dist-packages/eventlet/patcher.py:306' may require use of '--include-plugin-directory' or '--include-plugin-files'.
Nuitka:WARNING:Unresolved '__import__' call at '/usr/local/lib/python3.6/dist-packages/flask/cli.py:236' may require use of '--include-plugin-directory' or '--include-plugin-files'.
Nuitka:WARNING:Unresolved '__import__' call at '/usr/local/lib/python3.6/dist-packages/flask/helpers.py:749' may require use of '--include-plugin-directory' or '--include-plugin-files'.
Nuitka:WARNING:Unresolved '__import__' call at '/usr/local/lib/python3.6/dist-packages/flask/helpers.py:818' may require use of '--include-plugin-directory' or '--include-plugin-files'.
Nuitka:WARNING:Unresolved '__import__' call at '/usr/local/lib/python3.6/dist-packages/jinja2/loaders.py:472' may require use of '--include-plugin-directory' or '--include-plugin-files'.
Nuitka:WARNING:Unresolved '__import__' call at '/usr/local/lib/python3.6/dist-packages/jinja2/utils.py:142' may require use of '--include-plugin-directory' or '--include-plugin-files'.
Nuitka:WARNING:Unresolved '__import__' call at '/usr/local/lib/python3.6/dist-packages/jinja2/utils.py:143' may require use of '--include-plugin-directory' or '--include-plugin-files'.
Nuitka:WARNING:Unresolved '__import__' call at '/usr/lib/python3/dist-packages/requests/packages.py:7' may require use of '--include-plugin-directory' or '--include-plugin-files'.
Nuitka:WARNING:Unresolved '__import__' call at '/usr/local/lib/python3.6/dist-packages/werkzeug/__init__.py:186' may require use of '--include-plugin-directory' or '--include-plugin-files'.
Nuitka:WARNING:Unresolved '__import__' call at '/usr/local/lib/python3.6/dist-packages/werkzeug/__init__.py:191' may require use of '--include-plugin-directory' or '--include-plugin-files'.
Nuitka:WARNING:Unresolved '__import__' call at '/usr/local/lib/python3.6/dist-packages/werkzeug/utils.py:547' may require use of '--include-plugin-directory' or '--include-plugin-files'.
Nuitka:WARNING:Unresolved '__import__' call at '/usr/local/lib/python3.6/dist-packages/werkzeug/utils.py:555' may require use of '--include-plugin-directory' or '--include-plugin-files'.

As you can see, the compilation is successful but when I try to run it, I get the error:

Traceback (most recent call last):
  File "/tmp/nuitka-test/app.dist/app.py", line 4, in <module>
  File "/tmp/nuitka-test/app.dist/eventlet/__init__.py", line 10, in <module eventlet>
  File "/tmp/nuitka-test/app.dist/eventlet/convenience.py", line 4, in <module eventlet.convenience>
  File "/tmp/nuitka-test/app.dist/eventlet/greenpool.py", line 4, in <module eventlet.greenpool>
  File "/tmp/nuitka-test/app.dist/eventlet/queue.py", line 49, in <module eventlet.queue>
  File "/tmp/nuitka-test/app.dist/eventlet/event.py", line 3, in <module eventlet.event>
  File "/tmp/nuitka-test/app.dist/eventlet/hubs/__init__.py", line 19, in <module eventlet.hubs>
  File "/tmp/nuitka-test/app.dist/eventlet/hubs/__init__.py", line 19, in <genexpr>
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)

ModuleNotFoundError: No module named 'eventlet.hubs.epolls'

I also get the error Segmentation fault (core dumped) on another computer with eventlet==0.24.1. Eventlet version 0.25.0 changelog indicates that they fixed the eventlet hub where it could use epolls as default hub even when platform does not support it.

When running my app using python3 -B app, everything works fine. I would think it has something do nuikta faulting the eventlet hub when compiling ? My computer does support epoll.

If I remove the eventlet library, it builds and the error I get when running it is:

Traceback (most recent call last):
  File "/tmp/nuitka-test/app.dist/app.py", line 11, in <module>
  File "/tmp/nuitka-test/app.dist/flask_socketio/__init__.py", line 185, in __init__
  File "/tmp/nuitka-test/app.dist/flask_socketio/__init__.py", line 245, in init_app
  File "/tmp/nuitka-test/app.dist/socketio/server.py", line 108, in __init__
  File "/tmp/nuitka-test/app.dist/engineio/server.py", line 139, in __init__

ValueError: Invalid async_mode specified

Which seems very close to a problem that appeared when using pyinstaller as you can see here as seems to be related to the socketio library (something about hidden imports).

Any suggesions to make this work ? Preferably with eventlet as it has better perf 😃

Thanks for your time and truly great project !

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
JorjMcKiecommented, Nov 26, 2019

I am making progress BTW: my exception has changed 😉 Once I find no more errors I will be submitting new versions of changed Nuitka plugins to you via ZIP file. With some look it will just be the ImplicitImports.py plugin, which is located in /nuitka/plugins/standard. Please replace this module there with the version which I will be sending to you and repeat your compile. After a few back and fro’s we should be there …

0reactions
JorjMcKiecommented, Dec 14, 2019

@tristanidoux - just sent you some more modifications. Hope there will be some progress on your side with them.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using eventlet to manage socketio in Flask - Stack Overflow
It appears you have eventlet installed in your virtual environment, so that is why you receive the error that you have to use...
Read more >
Deployment — Flask-SocketIO documentation - Read the Docs
If eventlet or gevent are available, socketio.run(app) starts a production-ready server using one of these frameworks. If neither of these are installed, then ......
Read more >
python-flask-socketio(1) - Arch manual pages
The long-polling transport is fully supported with the gevent package, but unlike eventlet, gevent does not have native WebSocket support. To add support...
Read more >
Flask-SocketIO Documentation - manpages.ubuntu!
The long-polling transport is fully supported with the gevent package, but unlike eventlet, gevent does not have native WebSocket support. To add support...
Read more >
Deploying Flask Socket.io application with eventlet on Google ...
I am using flask socket.io configured with eventlet on a flexible google ... my issue, whether it is my app engine configuration or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found