ModuleNotFoundError: No module named 'gevent.wsgi'
Asked Answered
H

2

17

I'm getting the following error while running a flask app:

from gevent.wsgi import WSGIServer
ModuleNotFoundError: No module named 'gevent.wsgi'

gevent is already installed and the requirement is satisfied.

Pip version is 10.11 and Python 3.6.
OS: Windows 10 x64
Using Anaconda VM

This same code worked in another machine, so somewhere I am missing configuration, but I can't track/find it.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import logging
import json
from pprint import pprint
from rasa_core.channels import HttpInputChannel
from rasa_core import utils
from rasa_core.agent import Agent
from rasa_core.interpreter import RasaNLUInterpreter
from rasa_core.channels.channel import UserMessage
from rasa_core.channels.direct import CollectingOutputChannel
from rasa_core.channels.rest import HttpInputComponent
from flask import Blueprint, request, jsonify, abort    
def run(serve_forever=True):
#path to your NLU model
interpreter = RasaNLUInterpreter("models/nlu/default/current")
# path to your dialogues models
agent = Agent.load("models/dialogue", interpreter=interpreter)
#http api endpoint for responses
input_channel = SimpleWebBot()
if serve_forever:
    agent.handle_channel(HttpInputChannel(5004, "/chat", input_channel))
return agent
if __name__ == '__main__':
   utils.configure_colored_logging(loglevel="INFO")
   run()
Hue answered 22/5, 2018 at 7:3 Comment(0)
C
25

Try using:

from gevent.pywsgi import WSGIServer

Instead of:

from gevent.wsgi import WSGIServer
Collateral answered 22/5, 2018 at 10:18 Comment(1)
Above point is correct, but its rasa-core library issue. After upgraded to 0.9 version. Issue was cleared.Hue
P
6

The import statement you quoted needs to be updated to:

from gevent.pywsgi import WSGIServer

The gevent.wsgi module has been deprecated and was removed when gevent 1.3 was released. Its replacement is the gevent.pywsgi module, which has been around for some time.

It looks like in your case, the rasa-core library you're using is the one with the bad import line. This was fixed starting in the 0.9.0 release, so you should update that dependency to a newer version.

Partial answered 27/8, 2018 at 21:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.