I am trying to play with Flask and chatterbot on glitch hosting website
For some unknown reason it raises
I suspect that pip3 and python3 in Glich here is not sharing the same Python environment. Therefore it raise and not found error. But how come Flask is not!
Traceback (most recent call last):
File "server.py", line 2, in <module>
from chatterbot.trainers import ListTrainer
ImportError: No module named 'chatterbot'
I have put chatterbot to requirements.txt, but it seems like Glitch does not recognize python3
Hi @Elcolie, I also sent you a response to your email, but with respect to this particular project there are three things you’ll need to pay attention to:
to use Python your project must not have a package.json file. Having one of those tells Glitch that your project is a Node project, not a Python one.
your project must have a requirements.txt file. This tells Glitch that the project is a Python project, as opposed to a static web server project or a custom project.
your project must have a start.sh file that tells Glitch what bash commands to run to start your Python project successfully. Glitch will automatically execute the contents of start.sh when it starts your project as a Python project.
In this case if you add a start.sh file telling Glitch to run your project’s server file and a reqiurements.txt file to let Glitch know your project is a Python project you’ll be a little closer to your goals. In your project’s case you’re also running afoul of the project disk space limit of ~200Mb, so you’d need to clean that up a little too - it looks like you have a .cache directory that could be cleaned up to start with, which you can do from your project’s console.
@Elcolie I tried installing chatterbot on a fresh Glitch project with pip3 install chatterbot --user. After installing some of its dependencies, the installation failed with “not enough space on disk”. This basically means you’re out of luck - Glitch is not the right service for you.
I also checked that pip3 and python3 do share the same python environment.
@cori I tried the configuration you mentioned (no package.json, single start.sh) but Glitch doesn’t seem to recognize it. The project only worked when I added back package.json with "start": bash start.sh. Is this expected behavior? Edit: I opened a separate thread on this.
Thank you very much everyone for your time and sharing. I had tried pythonanywhere and got difficulties. Once my code break I cannot edit the code again even I refresh my browser, but problem still persist!
Now time is very against me I need to pick EC2 for safety reason
@Bubbler thanks for the catch - my post was missing a key piece of information that I provided @Elcolie in my email but missed when I wrote the public post. My apologies for the confusion; I’ve updated the answer above to clarify.