Rasa nlu not installing!

Hi

I have installed rasa by following video:link is here

and then when I want to create my custom compnent I faced that rasa-nlu is not installed! and when I try to install it it shows this error:

ERROR: Command errored out with exit status 1:
     command: /Users/zahraaal-nemer/Desktop/rasa-init-demo/venv2/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/sm/bjkmpsf90ng76c26v82cg1j80000gn/T/pip-install-0ihvpl37/matplotlib_1de8f9c6a2d84b51a16a98ceeaf2c2d1/setup.py'"'"'; __file__='"'"'/private/var/folders/sm/bjkmpsf90ng76c26v82cg1j80000gn/T/pip-install-0ihvpl37/matplotlib_1de8f9c6a2d84b51a16a98ceeaf2c2d1/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/sm/bjkmpsf90ng76c26v82cg1j80000gn/T/pip-pip-egg-info-p1vu7ilr
         cwd: /private/var/folders/sm/bjkmpsf90ng76c26v82cg1j80000gn/T/pip-install-0ihvpl37/matplotlib_1de8f9c6a2d84b51a16a98ceeaf2c2d1/
    Complete output (106 lines):
    IMPORTANT WARNING:
        pkg-config is not installed.
        matplotlib may not be able to find some of its dependencies
    ============================================================================
    Edit setup.cfg to change the build options
    
    BUILDING MATPLOTLIB
                matplotlib: yes [2.2.5]
                    python: yes [3.8.1 (v3.8.1:1b293b6006, Dec 18 2019,
                            14:08:53)  [Clang 6.0 (clang-600.0.57)]]
                  platform: yes [darwin]
    
    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [version 1.18.5]
          install_requires: yes [handled by setuptools]
                    libagg: yes [pkg-config information for 'libagg' could not
                            be found. Using local copy.]
                  freetype: no  [The C/C++ header for freetype2 (ft2build.h)
                            could not be found.  You may need to install the
                            development package.]
                       png: no  [pkg-config information for 'libpng' could not
                            be found.]
                     qhull: yes [pkg-config information for 'libqhull' could not
                            be found. Using local copy.]
    
    OPTIONAL SUBPACKAGES
               sample_data: yes [installing]
                  toolkits: yes [installing]
                     tests: no  [skipping due to configuration]
            toolkits_tests: no  [skipping due to configuration]
    
    OPTIONAL BACKEND EXTENSIONS
                    macosx: yes [installing, darwin]
    IMPORTANT WARNING:
        pkg-config is not installed.
        matplotlib may not be able to find some of its dependencies
    IMPORTANT WARNING:
        pkg-config is not installed.
        matplotlib may not be able to find some of its dependencies
    IMPORTANT WARNING:
        pkg-config is not installed.
        matplotlib may not be able to find some of its dependencies
    IMPORTANT WARNING:
        pkg-config is not installed.
        matplotlib may not be able to find some of its dependencies
                    qt5agg: no  [PySide2 not found; PyQt5 not found]
    IMPORTANT WARNING:
        pkg-config is not installed.
        matplotlib may not be able to find some of its dependencies
    IMPORTANT WARNING:
        pkg-config is not installed.
        matplotlib may not be able to find some of its dependencies
    IMPORTANT WARNING:
        pkg-config is not installed.
        matplotlib may not be able to find some of its dependencies
    IMPORTANT WARNING:
        pkg-config is not installed.
        matplotlib may not be able to find some of its dependencies
                    qt4agg: no  [PySide not found; PyQt4 not found]
    IMPORTANT WARNING:
        pkg-config is not installed.
        matplotlib may not be able to find some of its dependencies
    IMPORTANT WARNING:
        pkg-config is not installed.
        matplotlib may not be able to find some of its dependencies
    IMPORTANT WARNING:
        pkg-config is not installed.
        matplotlib may not be able to find some of its dependencies
    IMPORTANT WARNING:
        pkg-config is not installed.
        matplotlib may not be able to find some of its dependencies
                   gtk3agg: no  [Requires pygobject to be installed.]
    IMPORTANT WARNING:
        pkg-config is not installed.
        matplotlib may not be able to find some of its dependencies
    IMPORTANT WARNING:
        pkg-config is not installed.
        matplotlib may not be able to find some of its dependencies
    IMPORTANT WARNING:
        pkg-config is not installed.
        matplotlib may not be able to find some of its dependencies
    IMPORTANT WARNING:
        pkg-config is not installed.
        matplotlib may not be able to find some of its dependencies
                 gtk3cairo: no  [Requires cairocffi or pycairo to be installed.]
                    gtkagg: no  [Requires pygtk]
                     tkagg: yes [installing; run-time loading from Python Tcl /
                            Tk]
                     wxagg: no  [requires wxPython]
                       gtk: no  [Requires pygtk]
                       agg: yes [installing]
                     cairo: no  [cairocffi or pycairo not found]
                 windowing: no  [Microsoft Windows only]
    
    OPTIONAL LATEX DEPENDENCIES
                    dvipng: no
               ghostscript: no
                     latex: no
                   pdftops: no
    
    OPTIONAL PACKAGE DATA
                      dlls: no  [skipping due to configuration]
    
    ============================================================================
                            * The following required packages can not be built:
                            * freetype, png
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 20.3.1; however, version 20.3.3 is available.
You should consider upgrading via the '/Users/zahraaal-nemer/Desktop/rasa-init-demo/venv2/bin/python -m pip install --upgrade pip' command.

I need your help please, for a 3 days I am trying but I couldn’t specify the problem

I am using MacOS

Just so I understand the steps you’ve already taken.

Are you able to run the following command?

rasa --version

Could you share the output here?

You also mentioned a custom nlu component, could you share it here?

I acceced the venv2 where I have installed the rasa, then I typed on the terminal the command rasa --version it give me this output: command not found: rasa

and this is the custom compnent class:

from rasa_nlu.components import Component
from rasa.nlu import utils
from rasa.nlu.model import Metadata
import nltk
import os
from profanity_filter import ProfanityFilter

class ProfanityAnalyzer(Component):

    name="profanity_analyzer"
    provides = []
    requries = ["entities"]
    deafults = {}
    language_list = ["en"]

    def __init__(self, component_config=None):
        super(ProfanityAnalyzer, self).__init__(component_config)

    def train(self, training_data, cfg, **kwargs):
        """Not needed, because the the model is pretrained"""
        pass

    def convert_to_rasa(self, value, confidence):
         entity = {"value":value,
                 "confidence":confidence,
                 "entity":"profane_word",
                 "extractor":"profanity_extractor"}
         return entity

    def process(self, message, **kwargs):
        pf=ProfanityFilter()
        text=message.text

        if pf.is_profane(text):
            tokens=text.split(" ")
            for token in tokens:
                if pf.is_profane(token):
                    value=token
                    confidence=100

        entity = self.convert_to_rasa(value,confidence)

        message.set("entities",[entity],add_to_output=True)

    def persist(self, file_name, model_dir):
        """Pass because a pre-trained model is already persisted"""
        pass

this is the photo from the PyCharm that shows the rasa_nlu refrense not resolved:

I fear something went wrong during installation. If you’re in your current virtualenv then you should be able to run;

pip freeze | grep rasa

To confirm that Rasa is indeed installed. If this is not the case, then you should run;

pip install rasa

Also, I fear that you might have a typo. It’s rasa.nlu not rasa_nlu. There’s a difference in the dot and underscore in your final screenshot.

Also, if you’re less familiar with virtual environments and appreciate a tutorial then you might enjoy this resource here.

for the installation it is resolved because when I tried the rasa --version command again in my virtual environment this is desplayed: Rasa Version : 2.2.2 Rasa SDK Version : 2.2.0 Rasa X Version : None Python Version : 3.8.5 Operating System : macOS-10.15.7-x86_64-i386-64bit Python Path : /Users/zahraaal-nemer/.conda/envs/Tickie/bin/python

and for imports, do you mean that I should write from rasa.nlu.components import Component instade of rasa_nlu.components import Component??

On the typo -> yes!

Here’s a custom example component with all the modern imports used; rasa-nlu-examples/bpemb_featurizer.py at master · RasaHQ/rasa-nlu-examples · GitHub