jinja2.exceptions.TemplateNotFound

I just finished setting up my jupyterhub image. I use the latest image from dockerhub, (docker pull jupyterhub/jupyterhub:latest)

When I attempt to access the site I receive the following error, mentioning a missing jinja template. I found a closed issue related to this on the GitHub site (Jupyterhub Docker not able to find any jinja templates · Issue #2852 · jupyterhub/jupyterhub · GitHub), but that stated the fix was added to the main branch back in 2020. I assume the latest tag (updated 2 months ago) has this fix. Any help is appreciated.

[I 2021-09-16 00:57:05.817 JupyterHub app:2849] JupyterHub is now running at http://0.0.0.0:8200
[I 2021-09-16 00:57:19.409 JupyterHub log:189] 302 GET / -> /hub/ (@192.168.1.4) 3.38ms
[I 2021-09-16 00:57:19.463 JupyterHub log:189] 302 GET /hub/ -> /hub/login?next=%2Fhub%2F (@192.168.1.4) 2.77ms
[E 2021-09-16 00:57:19.508 JupyterHub web:1789] Uncaught exception GET /hub/login?next=%2Fhub%2F (192.168.1.4)
    HTTPServerRequest(protocol='http', host='192.168.1.7:8200', method='GET', uri='/hub/login?next=%2Fhub%2F', version='HTTP/1.1', remote_ip='192.168.1.4')
    Traceback (most recent call last):
      File "/usr/local/lib/python3.8/dist-packages/tornado/web.py", line 1704, in _execute
        result = await result
      File "/usr/local/lib/python3.8/dist-packages/jupyterhub/handlers/login.py", line 142, in get
        self.finish(await self._render(username=username))
      File "/usr/local/lib/python3.8/dist-packages/jupyterhub/handlers/login.py", line 107, in _render
        return self.render_template(
      File "/usr/local/lib/python3.8/dist-packages/jupyterhub/handlers/base.py", line 1200, in render_template
        template = self.get_template(name, sync)
      File "/usr/local/lib/python3.8/dist-packages/jupyterhub/handlers/base.py", line 1188, in get_template
        return self.settings[key].get_template(name)
      File "/usr/local/lib/python3.8/dist-packages/jinja2/environment.py", line 997, in get_template
        return self._load_template(name, globals)
      File "/usr/local/lib/python3.8/dist-packages/jinja2/environment.py", line 958, in _load_template
        template = self.loader.load(self, name, self.make_globals(globals))
      File "/usr/local/lib/python3.8/dist-packages/jinja2/loaders.py", line 556, in load
        raise TemplateNotFound(name)
    jinja2.exceptions.TemplateNotFound: login.html

Hi! Please could you show us your configuration with secrets redacted, and show us the command(s) you used to run the JupyterHub container and any otherr images? Thanks!

Here is my config file. I removed all the comments, so everything not on here is the default value. My starting command is just jupyterhub

c.JupyterHub.bind_url = 'http://0.0.0.0:8200'
c.JupyterHub.data_files_path = '/jupyterhub-data'
c.JupyterHub.db_url = 'sqlite:////jupyterhub-db/jupyterhub.sqlite'
c.JupyterHub.hub_port = 8281
c.ConfigurableHTTPProxy.api_url = 'http://0.0.0.0:8201'
c.Spawner.default_url = '/lab'

import pwd, subprocess

def pre_spawn_hook(spawner):
    username = spawner.user.name
    try:
        pwd.getpwnam(username)
    except KeyError:
        subprocess.check_call(['useradd', '-ms', '/bin/bash', username])

c.Spawner.pre_spawn_hook = pre_spawn_hook

c.Authenticator.admin_users = set('root')

FYI. I ended up putting the following path

/usr/local/share/jupyterhub/templates/

Into the config file (c.JupyterHub.template_paths = ['/usr/local/share/jupyterhub/templates/']. That seemed to work. I am having some other issues with it not finding some of the css info, so the page looks weird, but it is at least loading now.

So I mistakenly thought this line would give me permanent storage outside of my docker container, since I bound this to a folder on my server. Apparently I am wrong and this was the cause to all my issues. I removed it and will continue to work through setting it up. Thank you for pointing me to my config file as the issue!

c.JupyterHub.data_files_path = '/jupyterhub-data'