ImportError: cannot import name 'read_yaml'

This error is obtained when running this command. Please help. Thanks in advance. Version: rasa = 1.2.3, ruamel.yaml = 0.15.89, hyperopt = 0.1.1 @Tobias_Wochinger

(venv) chunjie97@Dino:~/nlu-hyperopt-master$ python -m
INFO:__main__:Starting up
Running experiment : default
Max evaluations: 100
Search space: {'epochs': <hyperopt.pyll.base.Apply object at 0x7f50b157fa90>, 'max_df': <hyperopt.pyll.base.Apply object at 0x7f50b150b2b0>, 'max_ngrams': <hyperopt.pyll.base.Apply object at 0x7f50b150b438>}
INFO:hyperopt.tpe:tpe_transform took 0.000781 seconds
INFO:hyperopt.tpe:TPE using 0 trials
INFO:hyperopt.fmin:job exception: cannot import name 'read_yaml'
Traceback (most recent call last):
  File "/usr/lib/python3.6/", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/", line 85, in _run_code
    exec(code, run_globals)
  File "/home/chunjie97/nlu-hyperopt-master/nlu_hyperopt/", line 49, in <module>
  File "/home/chunjie97/venv/lib/python3.6/site-packages/hyperopt/", line 385, in fmin
  File "/home/chunjie97/venv/lib/python3.6/site-packages/hyperopt/", line 244, in exhaust - n_done, block_until_done=self.asynchronous)
  File "/home/chunjie97/venv/lib/python3.6/site-packages/hyperopt/", line 218, in run
  File "/home/chunjie97/venv/lib/python3.6/site-packages/hyperopt/", line 137, in serial_evaluate
    result = self.domain.evaluate(spec, ctrl)
  File "/home/chunjie97/venv/lib/python3.6/site-packages/hyperopt/", line 840, in evaluate
    rval = self.fn(pyll_rval)
  File "/home/chunjie97/nlu-hyperopt-master/nlu_hyperopt/", line 18, in worker_function
    from nlu_hyperopt.optimization import run_trial
  File "/home/chunjie97/nlu-hyperopt-master/nlu_hyperopt/", line 4, in <module>
    from rasa.nlu.utils import read_yaml
ImportError: cannot import name 'read_yaml'

Hey @chunjie97, unfortunately, the nlu-hyperopt is a bit outdated. You’ll have to make a few small changes to make it work with your version of Rasa, but don’t worry, it’s nothing scary. As for the particular error you’re getting, I think you need to change the import statement in to this: from import read_yaml. Let me know how it goes.