Skip to content

Missing index.html view when installing pip package like documented #1

@DMW007

Description

@DMW007

Hello,

I installed the Python pip package in an virtual environment exactly as described in the installation documentation and started the application server:

python3 -m venv .venv
source .venv/bin/activate
pip install youtube-transcript-tools
uvicorn youtube_transcript.api.app:create_app --reload --host localhost --port 8888

The start itself works and it's listening on the provided port 8888:

INFO: Will watch for changes in these directories: ['/home/user/tests/youtube-transcript']
INFO: Uvicorn running on http://localhost:8888 (Press CTRL+C to quit)
INFO: Started reloader process [92832] using WatchFiles
WARNING: ASGI app factory detected. Using it, but please consider setting the --factory flag explicitly.
INFO: Started server process [92834]
INFO: Waiting for application startup.
INFO: Application startup complete.

But when accessing http://localhost:8888/ in the browser, I only get Internal Server Error as response. The app server shows an exception:

INFO:     127.0.0.1:57118 - "GET / HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/uvicorn/protocols/http/httptools_impl.py", line 416, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        self.scope, self.receive, self.send
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/fastapi/applications.py", line 1135, in __call__
    await super().__call__(scope, receive, send)
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/starlette/applications.py", line 107, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/starlette/middleware/errors.py", line 186, in __call__
    raise exc
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/starlette/middleware/cors.py", line 85, in __call__
    await self.app(scope, receive, send)
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    raise exc
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/starlette/routing.py", line 716, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/starlette/routing.py", line 736, in app
    await route.handle(scope, receive, send)
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/starlette/routing.py", line 290, in handle
    await self.app(scope, receive, send)
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/fastapi/routing.py", line 115, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    raise exc
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/fastapi/routing.py", line 101, in app
    response = await f(request)
               ^^^^^^^^^^^^^^^^
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/fastapi/routing.py", line 355, in app
    raw_response = await run_endpoint_function(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
    )
    ^
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/fastapi/routing.py", line 243, in run_endpoint_function
    return await dependant.call(**values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/youtube_transcript/api/web_routes.py", line 37, in index
    return templates.TemplateResponse("index.html", {"request": request})
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/starlette/templating.py", line 209, in TemplateResponse
    template = self.get_template(name)
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/starlette/templating.py", line 132, in get_template
    return self.env.get_template(name)
           ~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/jinja2/environment.py", line 1016, in get_template
    return self._load_template(name, globals)
           ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/jinja2/environment.py", line 975, in _load_template
    template = self.loader.load(self, name, self.make_globals(globals))
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/jinja2/loaders.py", line 126, in load
    source, filename, uptodate = self.get_source(environment, name)
                                 ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/home/user/tests/youtube-transcript/.venv/lib/python3.13/site-packages/jinja2/loaders.py", line 209, in get_source
    raise TemplateNotFound(
    ...<2 lines>...
    )
jinja2.exceptions.TemplateNotFound: 'index.html' not found in search path: 'src/youtube_transcript/templates'

It looks like that the index.html view is missing in the pip package. It works when I clone the Git-Project and open the folder before starting uvicorn:

git clone https://github.com/nilukush/youtube-transcript.git
cd youtube-transcript
uvicorn youtube_transcript.api.app:create_app --reload --host localhost --port 8888

Now the Web UI works without error and the logs also confirms that the request to / could be delivered successfully:

INFO: Will watch for changes in these directories: ['/home/user/tests/youtube-transcript/youtube-transcript']
INFO: Uvicorn running on http://localhost:8888 (Press CTRL+C to quit)
INFO: Started reloader process [95979] using WatchFiles
WARNING: ASGI app factory detected. Using it, but please consider setting the --factory flag explicitly.
INFO: Started server process [95981]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: 127.0.0.1:59170 - "GET / HTTP/1.1" 200 OK
INFO: 127.0.0.1:59170 - "GET /static/css/main.css HTTP/1.1" 200 OK

This seems to fix the missing view, because src/youtube_transcript/templates/index.html now exists, since it's fetched from the Git-Repo.

I guess that this is a bug in the pip package. As I understand the documentation, installing the youtube-transcript-tools package should be enough to use the software and cloning the repo is only required for development reasons. Or did I get the README wrong?

My tests were made on a Manjaro 26.0.1 GNU/Linux System with Python 3.13.11.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions