Iam getting the below error ModuleNotFoundError: No module named 'rasa_nlu', even though i installed rasa_nlu and rasa
My code :
from rasa_nlu.training_data import load_data
from rasa_nlu.config import RasaNLUConfig
from rasa_nlu.model import Trainer
def train_nlu(data, config, model_dir):
training_data = load_data(data)
trainer = Trainer(RasaNLUConfig(config))
trainer.train(training_data)
model_directory = trainer.persist(model_dir, fixed_model_name='weathernlu')
if __name__ == '__main__':
train_nlu('.data/data.json', 'config_spacy.json', './models/nlu')
Error message:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-2-6ab2834ad68f> in <module>()
----> 1 from rasa_nlu.training_data import load_data
2 #from rasa_nlu.converters import load_data
3 from rasa_nlu.config import RasaNLUConfig
4 from rasa_nlu.model import Trainer
5
ModuleNotFoundError: No module named 'rasa_nlu'
Someone please help me
In Rasa >= 1.0, there is no separate installation of NLU. It's just rasa, and then in code you'd access rasa.nlu. Make sure you're looking at the latest version of the docs and have installed the latest version of rasa - https://rasa.com/docs/rasa/user-guide/installation/
Related
I keep getting this error code from my Jupyter Notebook and there is little to no explanation.
After inputting:
from nltk import pos_tag, RegexpParser
from tokenize_words import word_sentence_tokenize
from chunk_counters import np_chunk_counter, vp_chunk_counter
I get:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-14-a5041508c9f2> in <module>
1 from nltk import pos_tag, RegexpParser
----> 2 from tokenize_words import word_sentence_tokenize
3 from chunk_counters import np_chunk_counter, vp_chunk_counter
ModuleNotFoundError: No module named 'tokenize_words'
The full lesson allows the student to follow along with Jupyter. I don't know why but all it ever gives me is module not found error codes.
I am running the code https://github.com/thiagodma/Pytorch_exs/blob/master/MultiTaskLearning/multitask_age_gender_ethnicity_resnet34.ipynb on Colab.
As I write:
from fastai import *
from fastai.vision import *
from fastai.layers import MSELossFlat, CrossEntropyFlat
from torchvision import transforms
import warnings
warnings.filterwarnings("ignore")
files_train = get_image_files("utkface_aligned_cropped/UTKFace")
files_valid = get_image_files("utkface_aligned_cropped/crop_part1")
I get the error:
ImportError Traceback (most recent call last)
<ipython-input-4-07ceae9afcad> in <module>()
1 from fastai import *
2 from fastai.vision import *
----> 3 from fastai.layers import MSELossFlat, CrossEntropyFlat
4 from torchvision import transforms
5 import warnings
ImportError: cannot import name 'MSELossFlat' from 'fastai.layers' (/usr/local/lib/python3.7/dist-packages/fastai/layers.py)
This is probably because you are referring to a code snippet that used the fastai v2 library. In the newest fastai, the MSELossFlat function can be imported at fastai.losses.
But since you are trying out an old code snippet, it's best to reproduce the execution enviroment of that code to get an expected result. I would recommend trying to install fastai v2 on your environment and execute the code again.
I am trying to import a package 'xagg' but it gives me the error described below. I managed to install 'xagg' but the following error popped up when I try to import it
Here is the command line
import xagg as xa
The error I got:
ModuleNotFoundError Traceback (most recent call last)
Input In [15], in <module>
----> 1 import xagg as xa
File ~\AppData\Roaming\Python\Python39\site-packages\xagg\__init__.py:5, in <module>
1 # Eventually restrict to just pixel_overlaps and aggregate; with
2 # everything else happening behind the scenes (and the exporting
3 # happening as methods to the classes that are exported from those
4 # two functions)
----> 5 from .wrappers import pixel_overlaps
6 from .aux import (normalize,fix_ds,get_bnds,subset_find)
7 from .core import aggregate
ModuleNotFoundError: No module named 'xagg.wrappers'
OS: Windows
pip install wrapper
I hope it work
My code
!pip install stldecompose
from stldecompose import decompose
Error Msg
ImportError Traceback (most recent call last)
in
2 # Install the library via PIP
3 get_ipython().system('pip install stldecompose')
----> 4 from stldecompose import decompose, forecast
~/opt/anaconda3/lib/python3.7/site-packages/stldecompose/init.py in
----> 1 from .stl import decompose, forecast
~/opt/anaconda3/lib/python3.7/site-packages/stldecompose/stl.py in
3 from pandas.core.nanops import nanmean as pd_nanmean
4 from statsmodels.tsa.seasonal import DecomposeResult
----> 5 from statsmodels.tsa.filters._utils import _maybe_get_pandas_wrapper_freq
6 import statsmodels.api as sm
7
ImportError: cannot import name '_maybe_get_pandas_wrapper_freq' from 'statsmodels.tsa.filters._utils' (/Users/georgeng/opt/anaconda3/lib/python3.7/site-packages/statsmodels/tsa/filters/_utils.py)
You have two pathway to go about this:
If you are running statsmodels==0.11.0, statsmodels.tsa.filters._utils function was removed from the library.
Alternatively you may use statsmodels.tsa.seasonal.STL, which gives similar functionality. See its documentation:
https://www.statsmodels.org/stable/generated/statsmodels.tsa.seasonal.STL.html#statsmodels.tsa.seasonal.STL
Downgrade to pip install statsmodels==0.10.2
I am trying import a module in Jupyter and it is not working:
import alyn
ImportError Traceback (most recent call last)
<ipython-input-8-8e9535ea4303> in <module>()
----> 1 import alyn
~\Anaconda3\envs\tracx\lib\site-packages\alyn\__init__.py in <module>()
1 """ Import required modules"""
----> 2 from deskew import *
3 from skew_detect import *
ImportError: No module named 'deskew'
I don't quite understand why, since the package in question has a correct init.py file:
whose contents are:
""" Import required modules"""
from deskew import *
from skew_detect import *
What am I missing?
P.S.
This is all taking place on Windows 10.
Well, I've figured it out!
Turns out that the package I was trying to import is written in Python 2 and its init file is using the relative import mechanism. However, I am working in Python 3 and relative import is no longer supported in it. The init file can be made to work in Python 3 by adding a . in both lines, like this:
""" Import required modules"""
from .deskew import *
from .skew_detect import *
I think this should be backward compatible with Python 2.