installed app is not a registered tag library.

I am having trouble with django does anyone have a moudle not found error.
I have checked stack overflow and come up empty.

I did find this django forums article: 'messages' is not a registered tag library - #2 by KenWhitesell

https://dpaste.org/11ATm

Traceback

Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/ingredients/

Django Version: 4.0.10
Python Version: 3.11.5
Installed Applications:
['inventory.apps.InventoryConfig',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']


Template error:
In template /Users/andrewstribling/djangodelights/inventory/templates/ingredients.html, error at line 6
   'mathfilters' is not a registered tag library. Must be one of:
admin_list
admin_modify
admin_urls
cache
i18n
l10n
log
static
tz
   1 : {% extends 'base.html' %} {% load static %} {% block title %}The restaurant{% endblock %} 
   2 : {% block content %}
   3 : {% comment %}
   4 : mathfilters added to make operations in the template
   5 : {% endcomment %}
   6 :  {% load mathfilters %} 
   7 : 
   8 : <div>
   9 :     <h2>Ingredients in stock</h2>
   10 :     <table>
   11 :       <thead>
   12 :         <tr>
   13 :           <th>Name</th>
   14 :           <th>Quantity</th>
   15 :           <th>Unit</th>
   16 :           <th>Unit Price</th>


Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/template/defaulttags.py", line 1026, in find_library
    return parser.libraries[name]

During handling of the above exception ('mathfilters'), another exception occurred:
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/core/handlers/exception.py", line 56, in inner
    response = get_response(request)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/core/handlers/base.py", line 220, in _get_response
    response = response.render()
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/template/response.py", line 114, in render
    self.content = self.rendered_content
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/template/response.py", line 90, in rendered_content
    template = self.resolve_template(self.template_name)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/template/response.py", line 72, in resolve_template
    return select_template(template, using=self.using)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/template/loader.py", line 42, in select_template
    return engine.get_template(template_name)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/template/backends/django.py", line 33, in get_template
    return Template(self.engine.get_template(template_name), self)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/template/engine.py", line 176, in get_template
    template, origin = self.find_template(template_name)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/template/engine.py", line 158, in find_template
    template = loader.get_template(name, skip=skip)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/template/loaders/base.py", line 28, in get_template
    return Template(
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/template/base.py", line 154, in __init__
    self.nodelist = self.compile_nodelist()
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/template/base.py", line 200, in compile_nodelist
    return parser.parse()
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/template/base.py", line 513, in parse
    raise self.error(token, e)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/template/base.py", line 511, in parse
    compiled_result = compile_func(self, token)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/template/loader_tags.py", line 293, in do_extends
    nodelist = parser.parse()
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/template/base.py", line 513, in parse
    raise self.error(token, e)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/template/base.py", line 511, in parse
    compiled_result = compile_func(self, token)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/template/loader_tags.py", line 232, in do_block
    nodelist = parser.parse(("endblock",))
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/template/base.py", line 513, in parse
    raise self.error(token, e)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/template/base.py", line 511, in parse
    compiled_result = compile_func(self, token)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/template/defaulttags.py", line 1088, in load
    lib = find_library(parser, name)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/template/defaulttags.py", line 1028, in find_library
    raise TemplateSyntaxError(

Exception Type: TemplateSyntaxError at /ingredients/
Exception Value: 'mathfilters' is not a registered tag library. Must be one of:
admin_list
admin_modify
admin_urls
cache
i18n
l10n
log
static
tz

You’re sure that django-mathfilters is installed in your venv? Try loading it in shell.

The mathfilters module also mentions you need to load it at the top of your template. I’m not sure how strict that is, but in your traceback it is not at the top.

I get this

(venv) andrewstribling@Andrews-MBP djangodelights % pip install mathfilters
ERROR: Could not find a version that satisfies the requirement mathfilters (from versions: none)
ERROR: No matching distribution found for mathfilters
WARNING: You are using pip version 21.1.2; however, version 23.3.1 is available.
You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.11/bin/python3 -m pip install --upgrade pip' command.
(venv) andrewstribling@Andrews-MBP djangodelights % 

Found this gem: django-mathfilters · PyPI

attempting to install now.

I think it’s django-mathfilters not mathfilters

Edit: Oops, missed that you found django-mathfilters on your own – sorry!

IT LIVES!!! Thank you @ggothreau

1 Like