Chatterbot: raspberry installation

Created on 24 Aug 2019  路  19Comments  路  Source: gunthercox/ChatterBot

has anyone managed to install chatterbot on raspberry pi 3b +? are days I try

Most helpful comment

has anyone managed to install chatterbot on raspberry pi 3b +? are days I try

I did. Turns out you cannot install the latest version of chatterbot (which is 1.0.5) on Raspberry pi according to piwheels.com. You'll have to install ChatterBot 1.0.2 or lower and to do that, use the following code.

sudo pip install chatterbot==1.0.2

After this install pytz

sudo pip install pytz

I hope this works for you guys.

All 19 comments

Yes, you could, the only problem I see you need more SD card storage if you training with the huge corpus.

I tried but It does not install. when I tried to install normal pc it's work, Ialso tried on an orange pi but didn't install too..

Main problem is Blis, Blis' Pip version unfortunaltelly doesn't work on ARM base CPUs so setup script doesn't work on raspberry pi. If someone could find any solution for raspberry pi or and armbian setup, please create a howto doc.

Could you try download source for github and install from there?

python setup.py install

I already tried ;
git clone https://github.com/gunthercox/ChatterBot.git
pip install ./ChatterBot
commands, but result was same.
let's see what will happen with setup.py

python setup.py install

I just tried
it gave lo of warning but no error,
when I gave
python -m chatterbot --version
command .
Traceback (most recent call last):
File "/usr/lib/python3.7/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.7/runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/lib/python3.7/runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "/home/pi/ChatterBot/chatterbot/__init__.py", line 4, in
from .chatterbot import ChatBot
File "/home/pi/ChatterBot/chatterbot/chatterbot.py", line 3, in
from chatterbot.logic import LogicAdapter
File "/home/pi/ChatterBot/chatterbot/logic/__init__.py", line 1, in
from chatterbot.logic.logic_adapter import LogicAdapter
File "/home/pi/ChatterBot/chatterbot/logic/logic_adapter.py", line 4, in
from chatterbot.conversation import Statement
File "/home/pi/ChatterBot/chatterbot/conversation.py", line 1, in
from pytz import UTC
ModuleNotFoundError: No module named 'pytz'

Yes I guess it work now.
I installed
dateutil, mathparse, nltk, pint, pyyaml manually and it gives version information atm. but I couldn't install spacy due to Blis. i don't know how will affect to this module. I'll report it

I also have the problem with spacy

see this issue explosion/spaCy#3451

nah :( acording to link I installed to 2.0.18 but chatterbot doesnt support 2.0.18 :(

Did you got any error while executing

Did you got any error while executing

yep..
Traceback (most recent call last):
File "chat.py", line 2, in
chatbot = ChatBot("Robix")
File "/usr/local/lib/python3.7/dist-packages/ChatterBot-1.1.0-py3.7.egg/chatterbot/chatterbot.py", line 28, in __init__
File "/usr/local/lib/python3.7/dist-packages/ChatterBot-1.1.0-py3.7.egg/chatterbot/utils.py", line 33, in initialize_class
File "/usr/local/lib/python3.7/dist-packages/ChatterBot-1.1.0-py3.7.egg/chatterbot/storage/sql_storage.py", line 20, in __init__
File "/usr/local/lib/python3.7/dist-packages/ChatterBot-1.1.0-py3.7.egg/chatterbot/storage/storage_adapter.py", line 23, in __init__
File "/usr/local/lib/python3.7/dist-packages/ChatterBot-1.1.0-py3.7.egg/chatterbot/tagging.py", line 20, in __init__
ModuleNotFoundError: No module named 'spacy'

spacy 2.0.18 already installed

chatterbot 1.1.0 has requirement spacy<2.2,>=2.1, but you'll have spacy 2.0.18 which is incompatible.

Ciuld you please virtual environment

Did you manage to find a workaround for it? I'm stuck on the same problem.

no solution

has anyone managed to install chatterbot on raspberry pi 3b +? are days I try

I did. Turns out you cannot install the latest version of chatterbot (which is 1.0.5) on Raspberry pi according to piwheels.com. You'll have to install ChatterBot 1.0.2 or lower and to do that, use the following code.

sudo pip install chatterbot==1.0.2

After this install pytz

sudo pip install pytz

I hope this works for you guys.

I was able to get this working on both my Raspi 4 on Ubuntu 18.04, and my Raspi 3 on Raspbian Stretch, but your mileage may vary (I tried both the development version 1.1.0, and release 1.0.5).

So the easiest way might be to use my fork: https://github.com/gitCommitWiL/ChatterBot; I made a couple of improvements and one of them includes an install script (for the raspi). Just clone the repo with git clone https://github.com/gitCommitWiL/ChatterBot or download the zip and extract.

Then run the install script inside the folder with ./install.sh; it'll install Chatterbot and the small English spaCy model, and link it so that you can start using it right away.


Otherwise, if you want to use one of the older versions, there's a couple more steps, but the idea is generally the same as the changes I made in my fork:

The issue is that during the spaCy install, blis runs into an issue with the ARM architecture.
To get around this, we need to deals with spaCy first and install it separately.

  1. Set the environment variable: export BLIS_ARCH="generic"
  2. Install the latest spaCy: pip3 install -U spacy
  3. Clone the latest Chatterbot: https://github.com/gunthercox/ChatterBot.git

    • you can also use an older version if you don't want to use the development version

  4. Navigate to Chatterbot folder: cd Chatterbot
  5. Change the requirements for spaCy in requirements.txt to: spacy>=2.2.0,<2.3.0
  6. Install Chatterbot: python3 setup.py install

You may need to install the spaCy language packages too. For example, the basic English package can be installed with python3 -m spacy download en; you might also need to use symlink for the package you download.

Alternatively, you can use an older version of spaCy such as 2.1.9, which would fit Chatterbot's requirement of spacy<2.2.0, so that you should be able to just do pip3 install chatterbot, but there are a couple of different steps for this:

  1. Clone spaCy: git clone https://github.com/explosion/spaCy
  2. Navigate to spaCy folder: cd spaCy
  3. Downgrade spaCy version (the following is for version 2.1.9): git reset --hard 844f840826e07555795e896141c57c644a18417e
  4. Change spaCy requirements for thinc and blis in setup.py to: blis>=0.4.0,<0.5.0 and thinc>=7.1.0,<7.2.0
  5. Set the environment variable: export BLIS_ARCH="generic"
  6. Install: python3 setup.py install

Then install Chatterbot normally, and any spaCy language packages.

What鈥檚 the speed like compared to pcs? Is it usable. Eg on the English cgatterbot corpus?

I believe I may have corrected this issue as of the latest release (1.0.8) see #2027 for details. Essentially the solution I have decided to go with is that spacy is no longer going to be installed as a part of ChatterBot's default installation.

Fee free to let me know if this doesn't resolve your issue, or open a new ticket if you encounter any other problems.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

engrphil picture engrphil  路  3Comments

AmusingThrone picture AmusingThrone  路  3Comments

yuvalBor picture yuvalBor  路  3Comments

filipceglik picture filipceglik  路  3Comments

proguy627 picture proguy627  路  3Comments