ImportError: cannot import name 'online' from ''

Hello everyone

I am trying to create a chatbot with the help of Sumit Raj’s book building chatbots with python. I’m a masterstudent and need to build a chatbot for my masterthesis. Right now I’m facing two problems with the horoscope bot I want to reconstruct. In his file with the following code:

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

from rasa_core import utils
from rasa_core.agent import Agent
from rasa_core.policies.keras_policy import KerasPolicy
from rasa_core.policies.memoization import MemoizationPolicy
from rasa_core.policies.sklearn_policy import SklearnPolicy

if __name__ == '__main__':

   training_data_file = './data/'
   model_path = './models/dialogue'

   agent = Agent("horoscope_domain.yml",
                          policies=[MemoizationPolicy(), KerasPolicy()])
   training_data = agent.load_data(training_data_file)


Here I get the following error code: “Passing policy configuration parameters to agent.train(...) is not supported anymore. Specify parameters directly in the policy configuration instead.” But I don’t how to write a policy configuration with the above input.

But the more severe error that prevents me from moving on is located in the

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

import logging

from rasa_core import utils, train
from import online
from rasa_core.interpreter import NaturalLanguageInterpreter

logger = logging.getLogger(__name__)

def train_agent(interpreter):
    return train.train_dialog_model(domain_file="horoscope_domain.yml",
                                                      kwargs={"batch_size": 50,
                                                                    "epochs": 200,
                                                                    "max_training_samples": 300
if __name__ == '__main__':
   nlu_model_path = "./models/nlu/default/horoscopebot"
   interpreter = NaturalLanguageInterpreter.create(nlu_model_path)
   agent = train_agent(interpreter)

Here the following error code is displayed: " from import online ImportError: cannot import name ‘online’ from ‘’ (C:\Users\tobia\AppData\Local\Programs\Python\Python37\lib\site-packages\rasa_core\"

Can somebody tell me, how to get rid of these errors? Help would be highly appreciated.

I’m using the following versions:

spacy==2.2.3 rasa-core==0.14.5 rasa-core-sdk==0.11.0 rasa-nlu==0.15.1 tensorflow==1.13.2 tensorflow-estimator==1.13.0 and python 3.7.6

Thank you for your help!!:raised_hands:

Hi there @TKueng, this code is very out of date, the versions you are using are from about a year ago. That is why there are deprecations and issues in general. Also that code does not work on python 3.7. What I would suggest to you is that you start fresh with the latest rasa; there is even a Masterclass you can follow along with to get a bot up and running.

Hello @erohmensing

Thank you for you reply. I followed your advise and got my first version of my bot up and running. The problem that I’ve know is that I need to ingrate a pretrained model into a custom action --> please see My Problem. Is there a chance you could look into my problem or that one of you guys gives me a consultary call? It’s for my masterthesis and would also be willing to pay some money for a helping call.

Best regards and warm wishes,