Python could not find module named chatterbot - python

I changed my laptop lately, so I've been installing the packages I use. After I've installed chatterbot
C:\Users\aser>pip show chatterbot
Name: ChatterBot
Version: 1.0.4
Summary:
Home-page: None
Author: None
Author-email: None
License: None
Location: c:\users\aser\appdata\roaming\python\python38\site-packages
Requires: chatterbot-corpus, sqlalchemy, python-dateutil, mathparse, nltk, pint, pymongo
Required-by:
And I tried to use it:
from chatterbot import ChatBot
# Code goes here
I got a ModuleNotFound error:
Traceback (most recent call last):
File "c:/Users/aser/Desktop/pyapp01/app.py", line 22, in <module>
from chatterbot import ChatBot
ModuleNotFoundError: No module named 'chatterbot'
Any help?? Or is it installed in a location where it shouldn't be?? But all the other packages are installed in this same location too

There is a dedicated Github repo for Chatterbot, and I found the issue Not able to import chatterbot after successful installation #826.
Several other users had the same problems after installing Chatterbot via pip, so you might want to read the responses the developers gave them.
It seems there are issues with package dependencies and in some cases, de-installation and re-installation in a particular order seemed to have helped.
In general, however, I agree with the comments above that working in the Anaconda environment is much more convenient. I also used "pip" a lot when I started coding but gave up on it after I ran into too many installation issues.
The danger always is that you are creating potentially conflicting environments, and Anaconda saves you from such pitfalls.

Maybe you have the module but you don’t download it.
Juste type :
“pip install chatterbot”
on cmd.
Or if that dont work, try :
“import chatterbot”

Related

python import error when attempting to run / launch Flask application

My Flask Application was working alright and all of a sudden I am seeing this error when I run the command to launch the App locally.
File "/Flask_Trial_App2/index.py", line 6, in <module>
import pandas as pd
File "/Flask_Trial_App/virt/lib/python3.8/site-packages/pandas/__init__.py", line 16, in <module>
raise ImportError(
ImportError: Unable to import required dependencies:
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.8 from "/Flask_Trial_App/virt/bin/python"
* The NumPy version is: "1.21.1"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: No module named 'numpy.core._multiarray_umath'
I tried upgrading pandas and numpy, but it didn't fix the issue.
pip install --upgrade numpy
pip install --upgrade pandas
I've had similar issues to this when deploying flask apps on servers with different environments, here is something I've done that worked in the past in case this helps:
Uninstall the package then reinstall specific version using the absolute path to the python executable.
/Flask_Trial_App/virt/bin/python3 -m pip uninstall numpy; /Flask_Trial_App/virt/bin/python3 -m pip install numpy==1.21.1
Hope that may help.

How do I get python requests package to work?

I can't seem to get the requests package to install correctly. Regardless of what I use to actually run my program, I get the same error:
Traceback (most recent call last): File "/Users/garce/Desktop/songlyrics/getlyrics.py", line 2, in <module> import requests ModuleNotFoundError: No module named 'requests'
However, I've used pip to install requests. When I run pip show requests in a terminal window, it comes up with this:
Name: requests Version: 2.24.0 Summary: Python HTTP for Humans. Home-page: https://requests.readthedocs.io Author: Kenneth Reitz Author-email: me#kennethreitz.org License: Apache 2.0 Location: /Users/garce/opt/anaconda3/lib/python3.8/site-packages Requires: urllib3, idna, certifi, chardet Required-by: Sphinx, jupyterlab-server, conda, conda-build, anaconda-project, anaconda-client
I assume this is a path issue of some sort, but I can't figure out what's going wrong here. Any idea?
Are you installing the package globally, or within a pipenv environment? If globally, have you tried pipenv? Not only is it considered best practices, but I find that using pipenv or Anaconda environments often resolves path issues I experience.

No module named 'tensorflow.python.tools'; 'tensorflow.python' is not a package

Everything was working smoothly until I started getting the following error:
Traceback (most recent call last):
File "", line 1, in
File "/home/user/Workspace/Practices/Tensorflow/tensorflow2/venv/lib/python3.7/site-packages/tensorflow/init.py", line 98, in
from tensorflow_core import *
File "/home/user/Workspace/Practices/Tensorflow/tensorflow2/venv/lib/python3.7/site-packages/tensorflow_core/init.py", line 40, in
from tensorflow.python.tools import module_util as _modle_util
ModuleNotFoundError: No module named 'tensorflow.python.tools'; 'tensorflow.python' is not a package
My environment setup:
python-3.7
Using venv module to create virtual environment
tensorflow 2.0.0
pip 19.0.3
Manjaro Linux
Now, I even can't import tensorflow module as well. It gives same above error. Tried reinstalling with cache and without cache as well, but no luck. Recreated virtual environment as well, no luck. This is really weird and have no clue where to start troubleshooting as well. Looking at virtual environment site packages, everything seems fine.
I just faced this problem right now. I ran the source code on another computer and it showed the same error. I went ahead and compared the version of TensorFlow and turns out that the other computer was running tensorflow==2.1.0 and mine was running tensorflow==1.14.0.
In short, downgrade your tensorflow installation (pip install tensorflow==1.14.0)
Found a noob problem. I was using my file name as csv.py which already exist in python library, which I think was messing up the paths. But don't know how yet.
Try uninstalling and reinstalling. First run:
pip uninstall tensorflow
then reinstall:
pip install tensorflow==2.0
After you uninstall, in the python shell, run:
help('modules')
TensorFlow should not be there in that list. Only then proceed to install it.
You don't need to uninstall tensorflow what version you have because it will take time to reinstall. You can fix this issue just by installing tensorflow==2.0.
pip install tensorflow==2.0

ModuleNotFoundError: No module named 'tensorflow' after pip install -- following TF official install docs

I have recently installed TensorFlow using the pip install instructions on the TensorFlow official website. Due to technical issues, I downgraded to Python version 3.6.2. However, when I entered IDLE, opened an additional file and entered:
import tensorflow as tf
Python responded with the message:
Traceback (most recent call last):
File "/Users/gg-mac/Documents/firsttensorflow.py", line 1, in <module>
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'
>>>
Is there any way to resolve this issue? I am simply trying to know where to run Tensorflow, as it is not specified anywhere on the website. I am developing an audio recognition program, if that is relevant. Thank you for any assistance you can provide.
Sincerely,
Suren Grigorian
This is hard to diagnose without more information, since we cannot test the absence of it. Perhaps try this:
pip3 install tensorflow
and try again, or perhaps run
python3 /Users/gg-mac/Documents/firsttensorflow.py
from the Terminal (looks like you're running Mac OS).

Python error message "Incompatible library version" libxml and etree.so

Update 2:
the main problem turned out to be a different one from what I had thought it was, and asked for help here. I moved the new question to a new post:
Install custom python package in virtualenv
Update:
ok, so I screwed up my non-virtualenv by accident.
The non-virtualenv (normal bash) I could easily fix by removing the manually installed (via pip) lxml and running
conda install lxml --force
But for some reason, that doesn't work in the virtualenv.
There, running
conda install lxml --force
works without error message, but when I run python and simply say
>>> import lxml
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named lxml
Any suggestions??
old message:
I'm trying to use virtualenv for my python flask application.
The python code runs perfectly fine without the virtualenv.
I've installed the packages I need in the virtualenv, but I after installing lxml via
pip install lxml
Installing collected packages: lxml
Successfully installed lxml-3.6.0
I get the following error message when running my code:
File "/Users/XXX/xxx/flask-aws/lib/python2.7/site-packages/docx-0.2.4-py2.7.egg/docx.py", line 17, in <module>
from lxml import etree
ImportError: dlopen(/Users/XXX/xxx/flask-aws/lib/python2.7/site-packages/lxml/etree.so, 2): Library not loaded: libxml2.2.dylib
Referenced from: /Users/XXX/xxx/flask-aws/lib/python2.7/site-packages/lxml/etree.so
Reason: Incompatible library version: etree.so requires version 12.0.0 or later, but libxml2.2.dylib provides version 10.0.0
I have seen other people report similar problems at stackoverflow, and one guy remarked that the problem might related to the virtualenv, but there was no solution.
Once again: The python code runs perfectly fine without virtualenv! But inside virtualenv, I can't get it to work.
I'm using Anaconda Python 2.7 on a Mac.
I'd appreciate any help guys!
I had the same error and stumbled upon this link, after searching for the incompatible library error "libxml2.2.dylib provides version 10.0.0"
Installing libxml2 that worked for me:
brew install libxml2
brew link --force libxml2
Solution that works for me in virtual environment is to force pip to recompile lxml:
pip install lxml --force-reinstall --ignore-installed --no-binary :all:

Categories

Resources