No module named 'bot_server_channel

abrarahmed@abrarahmed-HP-Notebook:~/sql_troubleshooting$ python3 dialogue_management_model.py Traceback (most recent call last): File “dialogue_management_model.py”, line 19, in from bot_server_channel import BotServerInputChannel ModuleNotFoundError: No module named ‘bot_server_channel’

I have updated to the latest version of rasa_core. help me out, please

I am referring to this code, GitHub - scalableminds/chatroom: React-based Chatroom Component for Rasa Stack

Thanks in advance

Can you show your run command or file and version of rasa and chatroom you are using?

Thank you @abhishakskilrock for the reply.

problem is resolved. I had kept my server file in project location and I was running from another location.

but, I got another error

abrarahmed@abrarahmed-HP-Notebook:~/sql_troubleshooting$ python3 dialogue_management_model.py /usr/local/lib/python3.6/dist-packages/rasa_nlu/extractors/entity_synonyms.py:85: UserWarning: Failed to load synonyms file from ‘./models/nlu/default/troubleshootnlu/entity_synonyms.json’ “”.format(entity_synonyms_file)) /usr/local/lib/python3.6/dist-packages/pykwalify/core.py:99: UnsafeLoaderWarning: The default ‘Loader’ for ‘load(stream)’ without further arguments can be unsafe. Use ‘load(stream, Loader=ruamel.yaml.Loader)’ explicitly if that is OK. Alternatively include the following in your code:

import warnings warnings.simplefilter(‘ignore’, ruamel.yaml.error.UnsafeLoaderWarning)

In most other cases you should consider using ‘safe_load(stream)’ data = yaml.load(stream) 2018-12-18 12:22:57.275408: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA Traceback (most recent call last): File “dialogue_management_model.py”, line 69, in main_server() File “dialogue_management_model.py”, line 51, in main_server agent.handle_channels(self, [channel], port=5002, serve_forever=True) AttributeError: ‘NoneType’ object has no attribute ‘handle_channels’

This is my code:

Creating the Interpreter and Agent

def load_agent():

nlu_interpreter = RasaNLUInterpreter('./models/nlu/default/troubleshootnlu')
agent = Agent.load('./models/dialogue', interpreter = nlu_interpreter)

Creating the server

def main_server():

agent = load_agent()

channel = BotServerInputChannel(agent, port=5002)
agent.handle_channels([channel], port=5002, serve_forever=True)

Thanks in Advance.

which rasa_core version are you using?

import rasa_core
rasa_core.version
‘0.12.3’

It should be:

def main_server():

agent = load_agent()

channel = BotServerInputChannel(agent, port=5002)
agent.handle_channels([channel], http_port=5002, serve_forever=True)

I updated my code with your solution @abhishakskilrock , But still, it throws me the error

abrarahmed@abrarahmed-HP-Notebook:~/sql_troubleshooting$ python3 dialogue_management_model.py

Epoch 300/300

50/1551 […] - ETA: 0s - loss: 0.0031 - acc: 1.000
450/1551 [=======>…] - ETA: 0s - loss: 0.0145 - acc:

0.997 750/1551 [=============>…] - ETA: 0s - loss: 0.0106 - acc: 0.997

1150/1551 [=====================>…] - ETA: 0s - loss: 0.0114 - acc: 0.997

1550/1551 [============================>.] - ETA: 0s - loss: 0.0198 - acc:

0.9951551/1551 [==============================] - 0s 160us/step - loss: 0.0198 - acc: 0.9955 -

val_loss: 0.0083 - val_acc: 1.0000 /usr/local/lib/python3.6/dist-packages/rasa_nlu/extractors/entity_synonyms.py:85

: UserWarning: Failed to load synonyms file from ‘./models/nlu/default/troubleshootnlu/entity_synonyms.json’ “”.format(entity_synonyms_file))

Traceback (most recent call last):

File “dialogue_management_model.py”, line 66, in

main_server()

File “dialogue_management_model.py”, line 51, in main_server

agent.handle_channels([channel], http_port=5002, serve_forever=True)

AttributeError: ‘NoneType’ object has no attribute ‘handle_channels’

Can you show me your whole code?

from future import absolute_import
from future import division
from future import print_function
from future import unicode_literals

import os
import logging
import rasa_core
#from rasa_core import utils, server
#from rasa_core import constants, agent
from rasa_core.agent import Agent
from rasa_core.policies.keras_policy import KerasPolicy
from rasa_core.policies.memoization import MemoizationPolicy
from rasa_core.interpreter import RasaNLUInterpreter
from rasa_core.utils import EndpointConfig
from rasa_core.run import serve_application
#from rasa_core.channels import HttpInputChannel
#from rasa_core.agent import Agent
#from rasa_core.interpreter import RasaNLUInterpreter
#from rasa_slack_connector import SlackInput
from bot_server_channel import BotServerInputChannel

logger = logging.getLogger(name)

def train_dialogue(domain_file = ‘troubleshoot_domain.yml’, model_path = ‘./models/dialogue’, training_data_file = ‘./data/stories.md’):

agent = Agent(domain_file, policies = [MemoizationPolicy(), KerasPolicy()])  
data = agent.load_data(training_data_file)	
agent.train(
			data,
			epochs = 300,
			batch_size = 50,
			validation_split = 0.2)
			
agent.persist(model_path)
return agent

Creating the Interpreter and Agent

def load_agent():
nlu_interpreter = RasaNLUInterpreter(’./models/nlu/default/troubleshootnlu’)
agent = Agent.load(’./models/dialogue’, interpreter = nlu_interpreter)

Creating the server

def main_server():
agent = load_agent()

channel = BotServerInputChannel(agent, port=5002)
agent.handle_channels([channel], http_port=5002, serve_forever=True)

‘’’

def run_bot(serve_forever=True):
interpreter = RasaNLUInterpreter(’./models/nlu/default/troubleshootnlu’)
agent = Agent.load(’./models/dialogue’, interpreter=interpreter)
rasa_core.run.serve_application(agent ,channel=‘cmdline’) return agent ‘’’

if name == ‘main’:
train_dialogue()
#run_bot()
main_server()

Hmm Code seems correct, which version of chatroom are you using?

Basically i am trying to integrate rasa bot with android. i am using chatroom project REST API Server to integrate with my Android app.

Bro, You can create your own channel for this which will be better for others too: Ref: Chat & Voice platforms

Thank you