0

This is my first time trying to run flask on Linux, I've made projects 0 and 1 in Windows 7. I've been able to run Project 2 on Windows, right before I switched to Linux. As I enter "flask run" on the terminal, I get the following traceback.

Traceback (most recent call last):
  File "/usr/bin/flask", line 11, in <module>
    load_entry_point('Flask==0.12.2', 'console_scripts', 'flask')()
  File "/usr/lib/python3/dist-packages/flask/cli.py", line 513, in main
    cli.main(args=args, prog_name=name)
  File "/usr/lib/python3/dist-packages/flask/cli.py", line 380, in main
    return AppGroup.main(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/flask/cli.py", line 423, in run_command
    app = DispatchingApp(info.load_app, use_eager_loading=eager_loading)
  File "/usr/lib/python3/dist-packages/flask/cli.py", line 152, in __init__
    self._load_unlocked()
  File "/usr/lib/python3/dist-packages/flask/cli.py", line 176, in _load_unlocked
    self._app = rv = self.loader()
  File "/usr/lib/python3/dist-packages/flask/cli.py", line 237, in load_app
    rv = locate_app(self.app_import_path)
  File "/usr/lib/python3/dist-packages/flask/cli.py", line 90, in locate_app
    __import__(module)
  File "/home/yuri/yuriafgomes/application.py", line 4, in <module>
    from flask_socketio import SocketIO, emit
  File "/usr/lib/python3/dist-packages/flask_socketio/__init__.py", line 7, in <module>
    from socketio import socketio_manage
  File "/home/yuri/.local/lib/python3.6/site-packages/socketio/__init__.py", line 11, in <module>
    from .middleware import WSGIApp, Middleware
  File "/home/yuri/.local/lib/python3.6/site-packages/socketio/middleware.py", line 4, in <module>
    class WSGIApp(engineio.WSGIApp):
AttributeError: module 'engineio' has no attribute 'WSGIApp'

Searching for the error, I have found two related discussions:

https://github.com/ElasticHQ/elasticsearch-HQ/issues/438

https://github.com/miguelgrinberg/python-socketio/issues/220

Both date from 2018, and the solution to them was to upgrade python-engineio to version 3.0.0. So I get that this might have to do with the version of some packages. I have tried to force pip to install the same versions as the ones described in the first link, but to no avail. pip ends up installing the latest version of the packages. I have managed to install python-engineio 3.0.0, by running pip3 uninstall python-engineio and then pip3 install --no-cache-dir python-engineio==3.0.0 --global-option="--no-user-cfg". The same attribute error persists, though.

Using pip freeze, these are the versions of the relevant packages:

Flask==1.1.1

Flask-SocketIO==4.1.0

python-engineio==3.8.2.post1

python-socketio==4.2.0

I'm using python 3.6.8 and Linux Mint 19.1 Cinnamon.

Does anyone know how to solve this? How can I make flask run again?

1 Answer 1

0

I've opened an issue on the github page for python-engineio and the owner helped me solve the issue. The application was loading and old version of engineio, and that's where the error was coming from (the old package in fact didn't have the WSGIApp module). I've uninstalled this package using pip3 uninstall python-engineio, then rebooted the system, then installed python-engineio again. Now flask is running as expected, with the latest versions of all dependencies.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .