Module object has no attribute SQLStorageAdapter - django

While running django chatterbot app, i encounter an error
module' object has no attribute 'SQLStorageAdapter'
I define chatbot the following way in my view.
chatbot = ChatBot(
"SQLMemoryTerminal",
storage_adapter='chatterbot.storage.SQLStorageAdapter',
logic_adapters=[
"chatterbot.logic.MathematicalEvaluation",
"chatterbot.logic.TimeLogicAdapter",
"chatterbot.logic.BestMatch"
],
input_adapter="chatterbot.input.TerminalAdapter",
output_adapter="chatterbot.output.TerminalAdapter",
)
Can anybody tell me why I am getting this error? Should I need any extra library or something like that? Thanks.

I think you were using very old version of chatterbot, you could try to upgrade to latest version by using.
pip install --upgrade chatterbot
Instead SQLStorageAdapter I recommended to use Mongo-DB as your storage adapter.
For more information fallow this link http://chatterbot.readthedocs.io/en/stable/storage/index.html#mongodb-storage-adapter

Related

Why do I get 'google.cloud.aiplatform.constants' has no attribute 'SUPPORTED_REGIONS error for Vertex AI init?

I am trying to set up mlops for Vertex AI, following this notebook. It works until, near the end, I try:
vertex_ai.init(
project=PROJECT,
location=REGION)
which gives:
module 'google.cloud.aiplatform.constants' has no attribute 'SUPPORTED_REGIONS
I am using us-central1 which is supported. I wondered if maybe from google.cloud import aiplatform as vertex_ai has been changed but don't know how to find out. Any help is much appreciated.
I followed the same Notebook as you, even though I didn't have any issue. What could be happening to you is that you are using an older version of the library.
You can use the command to upgrade the library that is the following one: pip3 install google-cloud-aiplatform --upgrade.
Sometimes this happens with the basic installation of the library; the problems could be in the dependencies, versions and indirectly permissions.

Language Translation using Python

I used to use GoogleTrans but this has stopped working with this error
AttributeError: 'NoneType' object has no attribute 'group'
I then found this article googletrans stopped working with error 'NoneType' object has no attribute 'group'
I then tried to use the version by running pip install googletrans==3.1.0a0
However, as I am using Python 2.7 it does not seem to work. I am writing an Agent for Plex and therefore, I am tied in with Python 2.7..
Does anyone know of any translation libraries that still work with Python 2.7??
Have you tried installing google-cloud-translate==2.0.1?
See here under "Deprecated Python Versions"
https://pypi.org/project/google-cloud-translate/
I ended up using this library - free to use and no need to register for a licence or key....
https://pypi.org/project/doodle-translate/
to install
pip install doodle-translate

heroku python buildpack pip install not adding the entry-points.txt file when installing

My runtime is python-3.7.5
I have an Django reusable app with an entry point in setup.py defined as:
setup = (
...
entry_points={'my.group': 'foo = bar'},
)
That allows me to use pkg_resources.iter_entry_points(group="my.group", name=None) to get a list of plugins.
I didn't know that until I had this bug, but it seems to rely on a entry_points.txt file that gets installed in the egg-info.
This entry_points.txt file seems to be missing when I push to heroku. I did a heroku run bash and:
~/.heroku/python/lib/python3.7/site-packages/m_package.egg-info $ ls
dependency_links.txt installed-files.txt PKG-INFO SOURCES.txt top_level.txt
but when I uninstall it and install it manually, and I recheck:
~/.heroku/python/lib/python3.7/site-packages/my_package.egg-info $ ls
dependency_links.txt entry_points.txt installed-files.txt PKG-INFO requires.txt SOURCES.txt top_level.txt
Am I missing something that the buildpack does?
The only extra thing to add is that I'm using https://github.com/timshadel/heroku-buildpack-github-netrc.git to get Https authentication in git, (my requirements.txt has some packages from private github repos) but I don't think that this should matter at all.
After messing with the official django buildpack, I realized it's just caching the packages, and since I updated my_package's code but not its version, it was not picking up the new library, hence no entry points. When I was doing pip install by hand on the heroku instance, it was picking the right library.
Good to know anyway, so keeping the question and the answer if anyone has the same problem one day.

python: weird "AttributeError: 'NoneType' object has no attribute 'FrontEndTestingStart'"

utils/frontend/urls.py
from utils.frontend import views
#more stuff
views.FrontEndTestingStart.as_view()
utils/frontend/views.py
class FrontEndTestingStart(APIView):
python reports
AttributeError: 'NoneType' object has no attribute 'FrontEndTestingStart'
As if views.py would return None when importing.
Why is that?
I have a __init__.py in the directory
The object instance in FrontEndTestingStart is returning None. Hence the issue. For further clarification see these answers - https://stackoverflow.com/a/8949265/5911972 and https://stackoverflow.com/a/8949272/5911972
Here's what got my problem fixed - but I don't know why.
Thanks to #2ps and #rohittk239, of cournse they are both right, but I couldn't find out WHAT exactly was causing that behaviour. Thanks both for trying to help.
I am trying to help a client run a software they bought. It's built on django 1.6.2 (yes I know it's dinosaur).
It had been configured on a long list of dependencies in requirements.txt. Most of them were fixed at a specific version with ==, but some were not, and were on >=. When I then ran pip install -r requirements, this of course would install newer versions than the ones specified everywhere where there was a >= dependency.
Fixing the requirements.txt for all dependencies to == fixed the problem. Looks like some dependency in a later version would create a conflict.

Django Gramps no module named web.settings

I'm using Gramps 3.3.1 under Ubuntu 12.04 and trying to in Django Export/Import. The install is okay, but when I look at the installed addons, it says that it failed, with reason: "No module named web.settings".
I cann't for the life of me figure out how to fix this. I'm assuming that it's this line in the python script:
import web.settings as default_settings
Anyone have any ideas? I'm trying to get this data out and into a MySQL database, but I can't seem to.
Thanks!
When you run into an error where Python tells you "No module named blah" it really means it can't find "blah".
I would check your pythonpath and the filesystem permissions on the stuff in your path.
Edit
Your issue seems to be a known issue: http://www.gramps-project.org/bugs/view.php?id=5464
It's caused by not running Gramps from source, near as I can tell. It doesn't look like a Python Path issue, so much as the Gramps Django devs making assumptions where your Django settings would be (but I could be wrong).
As for Python Path, there's plenty of resources describing how to. The simplest way to check your Python path is to run echo $PYTHONPATH in a terminal. If you don't see it there, Python might not find it.