'rasa_nlu: Failed to find component class, unknown component name at runtime

I'm working on building a dynamic rasa model trainer, but am having an issue where the pipeline components are not being accessible at runtime. NOTE: I can run

rasa train

from the commandline with the same config.yml and nlu.md file and it builds just fine, but if I try to train it at runtime in the same project, I get missing components. I don't have any custom components - I'm only using the standard pipeline.

Exception: Failed to find component class for 'WhitespaceTokenizer'. Unknown component name.

Loading code:

from rasa_nlu.training_data import load_data
from rasa_nlu.config import RasaNLUModelConfig
from rasa_nlu.model import Trainer
from rasa_nlu import config
import yaml

def main():
    train_data = load_data("data/nlu.md")
    with open("./config.yml","r") as file:
        nlu_config = yaml.safe_load(file)
    trainer = Trainer(RasaNLUModelConfig(nlu_config))
    interpreter = trainer.train(train_data)

My requirements.txt file:

wheel
rasa
rasa_nlu
tokens
spacy
nltk
numpy

My config.yml

recipe: default.v1
language: en

pipeline:
   - name: WhitespaceTokenizer
   - name: RegexFeaturizer
   - name: LexicalSyntacticFeaturizer
   - name: CountVectorsFeaturizer
   - name: CountVectorsFeaturizer
     analyzer: char_wb
     min_ngram: 1
     max_ngram: 4
   - name: DIETClassifier
     epochs: 100
   - name: EntitySynonymMapper
   - name: ResponseSelector
     epochs: 100
   - name: FallbackClassifier
     threshold: 0.3
     ambiguity_threshold: 0.1
policies:
   - name: MemoizationPolicy
   - name: TEDPolicy
     max_history: 5
     epochs: 100
   - name: RulePolicy


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source