Chatterbot: ImportError: No module named storage

Created on 16 Oct 2018  Â·  16Comments  Â·  Source: gunthercox/ChatterBot

Hello Team,
I am getting below issue.
Traceback (most recent call last):
File "test1.py", line 1, in
from chatterbot import ChatBot
File "/opt/PythonLibs/ChatterBot/chatterbot/__init__.py", line 4, in
from .chatterbot import ChatBot
File "/opt/PythonLibs/ChatterBot/chatterbot/chatterbot.py", line 2, in
from chatterbot.storage import StorageAdapter
ImportError: No module named storage

answered

All 16 comments

Hello Team,
I am getting below issue.
Traceback (most recent call last): File "test1.py", line 1, in from chatterbot import ChatBot File "/opt/PythonLibs/ChatterBot/chatterbot/init.py", line 4, in from .chatterbot import ChatBot File "/opt/PythonLibs/ChatterBot/chatterbot/chatterbot.py", line 2, in from chatterbot.storage import StorageAdapter ImportError: No module named storage

@dilip90 I guess you have written the name of the Storage Adapter wrong. It should be either chatterbot.storage.SQLStorageAdapter( for databases such as SQLite, MySQL or PostgreSQL ) or chatterbot.storage.MongoDatabaseAdapter for mongodb.

So you can change your line into: from chatterbot.storage import SQLStorageAdapter

Let me check guys, then only can I update thanks for reply.

On Sat 27 Oct, 2018, 6:54 PM Gunther Cox, notifications@github.com wrote:

Closed #1458 https://github.com/gunthercox/ChatterBot/issues/1458.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/gunthercox/ChatterBot/issues/1458#event-1930311965,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQfVMWwCegKbYniNE5YNwOcY1UxTVxovks5upF6BgaJpZM4Xdz-m
.

@dilip90 Any news, or can I close this off?

Another way to encounter this error is if Python 2 is being used. ChatterBot requires Python 3.

In python 3.7:

AttributeError: 'ChatBot' object has no attribute 'train'

Hi @rjunior8, if you are seeing that error you will need to modify your code slightly. Here is an example:

from chatterbot.trainers import ListTrainer

conversation = [
    "Hello",
    "Hi there!",
    "How are you doing?",
    "I'm doing great.",
    "That is good to hear",
    "Thank you.",
    "You're welcome."
]

trainer = ListTrainer(chatbot)

trainer.train(conversation)

Traceback (most recent call last):
File "example.py", line 1, in
from chatterbot import ChatBot
File "/usr/local/lib/python2.7/dist-packages/chatterbot/__init__.py", line 4, in
from .chatterbot import ChatBot
File "/usr/local/lib/python2.7/dist-packages/chatterbot/chatterbot.py", line 2, in
from chatterbot.storage import StorageAdapter
ImportError: No module named storage

im having this error.
can you help me with that.

@productOfInternet I can see in the error message that you posted that you are using Python 2.7. ChatterBot only works on Python 3. I recommend using Python 3.6 to avoid this error.

@gunthercox thank you very much! Worked.

Hello Team,
I am getting below issue.
Traceback (most recent call last): File "test1.py", line 1, in from chatterbot import ChatBot File "/opt/PythonLibs/ChatterBot/chatterbot/init.py", line 4, in from .chatterbot import ChatBot File "/opt/PythonLibs/ChatterBot/chatterbot/chatterbot.py", line 2, in from chatterbot.storage import StorageAdapter ImportError: No module named storage

@dilip90 I guess you have written the name of the Storage Adapter wrong. It should be either chatterbot.storage.SQLStorageAdapter( for databases such as SQLite, MySQL or PostgreSQL ) or chatterbot.storage.MongoDatabaseAdapter for mongodb.

So you can change your line into: from chatterbot.storage import SQLStorageAdapter

It can't help in Python 2.7.15/ Windows,still show
"Traceback (most recent call last):
File "", line 1, in
import chatterbot
File "D:\python27\lib\site-packages\chatterbot__init__.py", line 4, in
from .chatterbot import ChatBot
File "D:\python27\lib\site-packages\chatterbot\chatterbot.py", line 2, in
from chatterbot.storage import StorageAdapter
ImportError: No module named storage"

Thanks.

On Sat 9 Mar, 2019, 8:16 AM YoTro, notifications@github.com wrote:

Hello Team,
I am getting below issue.
Traceback (most recent call last): File "test1.py", line 1, in from
chatterbot import ChatBot File
"/opt/PythonLibs/ChatterBot/chatterbot/init.py", line 4, in from
.chatterbot import ChatBot File
"/opt/PythonLibs/ChatterBot/chatterbot/chatterbot.py", line 2, in from
chatterbot.storage import StorageAdapter ImportError: No module named
storage

@dilip90 https://github.com/dilip90 I guess you have written the name
of the Storage Adapter wrong. It should be either
chatterbot.storage.SQLStorageAdapter( for databases such as SQLite,
MySQL or PostgreSQL ) or chatterbot.storage.MongoDatabaseAdapter for
mongodb.

So you can change your line into: from chatterbot.storage import
SQLStorageAdapter

It can't help in Python 2.7.15/ Windows,still show
"Traceback (most recent call last):
File "", line 1, in
import chatterbot
File "D:\python27\lib\site-packages\chatterbot_init_.py", line 4, in
from .chatterbot import ChatBot
File "D:\python27\lib\site-packages\chatterbot\chatterbot.py", line 2, in
from chatterbot.storage import StorageAdapter
ImportError: No module named storage"

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/gunthercox/ChatterBot/issues/1458#issuecomment-471138966,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQfVMd7U_qRQy28ujmwoEfZDGmR4JSyiks5vUyB8gaJpZM4Xdz-m
.

Hi Team,
I am getting below issue.
from chatterbot.storage import SQLStorageAdapter,
ModuleNotFoundError: No module named 'chatterbot.storage'; 'chatterbot' is not a package

Hi @theanmolgoyal Have you installed chatterbot or downloaded the source code? One of these two things must be done before you can import it into your project.

I installed chatterbot through command prompt and download source code.

Okay, that's good to hear. I'm going to run down a list of a few of the most common reasons that people encounter the error 'chatterbot' is not a package. Please take a look at these and let me know if any of them sound like they might be the cause in your situation.

  1. You've created a new file called chatterbot.py and put your code in it. This is a common issue. The reason this will cause an error is because Python thinks that any imports from chatterbot should be pulled from the current file, instead of the chatterbot library that you want it to use. If this is the case, then you just need to rename the file you have created to something else.
  2. You have multiple version of Python installed. This is another common issue that people run into. Try running your commands like this to make sure that you are using Python 3 when installing and running your code:
python3 -m pip install chatterbot
python3 my_example.py

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AmusingThrone picture AmusingThrone  Â·  3Comments

vkosuri picture vkosuri  Â·  4Comments

ArunSingh1 picture ArunSingh1  Â·  3Comments

juanpialbano picture juanpialbano  Â·  4Comments

coolrb picture coolrb  Â·  3Comments