I am trying to import nonsense from Nostril (
from nostril import nonsense)
but I get this error;
ImportError Traceback (most recent call last)
Cell In [12], line 1
----> 1 from nostril import nonsense
ImportError: cannot import name 'nonsense' from 'nostril' (c:\Users\GithuaG\AppData\Local\Programs\Python\Python310\lib\site-packages\nostril\__init__.py)
Here is what the init.py file contains:
from .__version__ import __version__, __title__, __url__, __description__
from .__version__ import __author__, __email__
from .__version__ import __license__, __copyright__
from .ng import NGramData
from .nonsense_detector import (
nonsense, generate_nonsense_detector, test_unlabeled, test_labeled,
ngrams, dataset_from_pickle, sanitize_string
)
Tried researching on the web but no success.
Any help will be appreciated, Thanks
You most probably did pip install nostril before you installed the actual nostril package that you needed (just like I did). This would have caused another package that is used for testing to be installed alongside. You can either uninstall both nostril packages and then re-install just the nostril package you need.
Or you can directly import the nonsense object from nonsense_detector as below if you need both the packages
from nostril.nonsense_detector import nonsense
Related
Import of acme is successfull, but not able to find gym wrapper class
import acme
from acme.wrappers import gym_wrapper
Error Message while running
ModuleNotFoundError Traceback (most recent call last)
\<ipython-input-4-9d5212a1080d\> in \<module\>()
1 # reinforcement learning
2 import acme
\----\> 3 from acme.wrappers import gym_wrapper
4 from acme.environment_loop import EnvironmentLoop
5 from acme.utils.loggers import TerminalLogger, InMemoryLogger
ModuleNotFoundError: No module named 'acme.wrappers'
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
Any alternative api for gym_wrapper in ACME framework?
I think you forget to install dm-acme environment module.
It's clearly stated in the section 3. of installation process
pip install dm-acme[envs]
I'm trying to import autograd with the following line of code:
import autograd.numpy as np
However, I'm getting the following error when trying to run the script:
Traceback (most recent call last):
File "autograd.py", line 1, in <module>
import autograd.numpy as np
File "/home/hakon/Documents/FYS_STK4155/project2/code and plots/test/autograd.py", line 1, in <module>
import autograd.numpy as np
ModuleNotFoundError: No module named 'autograd.numpy'; 'autograd' is not a package
I've tried installing autograd through pip, pip3 and conda, but the error remains the same.
The problem is that your module (the one that you're running) has the same name that you're trying to import: autograd (.py). Try renaming your file and running it again.
aaossa's answer worked for me. If changing the module name that you are running doesn't work, please check if there is any other autograd(.py) that you created existing in your current directory. If so, you also need to change that file's name or delete it so that you can import "autograd".
I am following code from a book and run into this error while trying to run online training.
the full error is:
Traceback (most recent call last):
File "train_online.py", line 9, in
from rasa_core.training import online
ImportError: cannot import name 'online' from 'rasa_core.training' (C:\Users\Max\AppData\Local\Programs\Python\Python37\lib\site-packages\rasa_core\training__init__.py)
My code is:
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 rasa_core.training import online
from rasa_core.interpreter import NatraulLanguageInterpreter
logger = logging.getLogger(__name__)
def train_agent(interpreter):
return train.train_dialog_model(domain_file="horoscope_domain.yml",
stories_file="data/stories.md", output_path="models/dialog",
nlu_model_path=interpreter, endpoints="endpoints.yml", max_history=2, kwargs=
{"batch_size": 50, "epochs": 200, "max_training_samples": 300})
if __name__ == '__main__':
utils.configure_colored_logging(loglevel='DEBUG')
nlu_model_path = "'/models/nlu/default/horoscopebot"
interpreter = NatraulLanguageInterpreter.create(nlu_model_path)
agent = train_agent(interpreter)
online.serve_agent(agent)
The book you are reading might have outdated code samples with an outdated version of the Rasa library.
After installing the rasa-x package using pip install rasa-x --extra-index-url https://pypi.rasa.com/simple and trying to run from rasa_core.training import online in my Python 3.6 interpreter, I got the following warning:
UserWarning: The 'rasa_core' package has been renamed. You should change your imports to use 'rasa.core' instead.
Consider reading the new Getting Started with Rasa document.
hope it help:
remove
from rasa_core.training import online
online.serve_agent(agent)
Replace by this
from rasa_core.training import interactive
interactive.run_interactive_learning(agent)
I am following this tensorflow tutorial https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/install.html#protobuf-installation-compilation and I am facing some problems when testing the installation.
I installed everything except the COCO API in the tutorial and I am running the object detection demo in jupyter right now. For some reason, I get an error inside the notebook which tells me that there is "No module named 'tensorflow'". Can I still click on Run All or does this error has to be fixed?
Thanks! :)
import numpy as np
import os
import six.moves.urllib as urllib
import sys
import tarfile
import tensorflow as tf
import zipfile
from distutils.version import StrictVersion
from collections import defaultdict
from io import StringIO
from matplotlib import pyplot as plt
from PIL import Image
# This is needed since the notebook is stored in the object_detection folder.
sys.path.append("..")
from object_detection.utils import ops as utils_ops
if StrictVersion(tf.__version__) < StrictVersion('1.12.0'):
raise ImportError('Please upgrade your TensorFlow installation to v1.12.*.')
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-34f5cdda911a> in <module>
4 import sys
5 import tarfile
----> 6 import tensorflow as tf
7 import zipfile
8
ModuleNotFoundError: No module named 'tensorflow'
Okay, for some reasons, I get this error now:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-34f5cdda911a> in <module>
10 from collections import defaultdict
11 from io import StringIO
---> 12 from matplotlib import pyplot as plt
13 from PIL import Image
14
ModuleNotFoundError: No module named 'matplotlib'
You might be facing the problem of a double version of Python installed on your computer. Jupyter is trying to compile the Tensorflow tutorial file but with the wrong kernel (which should be Python 3).
The same happened to me when trying to run ipynb files in which Tensorflow was included.
So I would first recommend you to do the following:
Check the output of this command in your command line:
jupyter kernelspec list
Then it should output something similar to this: (in case of Windows OS)
python3 c:\python 3.6.8\share\jupyter\kernels\python3
If you find "python2" or any other type of version, you should remove it manually or try by using the command :
jupyter kernelspec remove python_wrong_version
Finally, if the problem is still there you can also check the link https://github.com/jupyter/notebook/issues/397 for further discussions.
I am trying to import a pypi module (thinkx 1.1.2) into spyder. It is installed on anaconda and showing up on conda list. I my python path folders is my anaconda folder. When I attempt to import thinkx into spyder I get :
import thinkx
Traceback (most recent call last):
File "", line 1, in
import thinkx
ImportError: No module named 'thinkx'
According to module README, thinkx does not expose package named thinkx.
It provides the following modules:
thinkbayes: Code for Think Bayes.
thinkstats2: Code for Think Stats, 2nd edition
thinkbayes2: Code for Think Bayes, 2nd edition, not yet published.
thinkdsp: Code for Think DSP
thinkplot: Plotting code used in all of the books, mostly wrapper functions for matplotlib.pyplot
Try:
import thinkbayes