Skip to content

Conversation

@waketzheng
Copy link
Contributor

Description

Fixes #615 (comment)

@brdacost
Copy link

brdacost commented Nov 5, 2025

I am still facing this same issue when trying to run any of the tests files. I have already tried a couple different approaches and all of them lead to different errors:

  1. using python -m venv: trying to create a virtual environment from venv package and installing all requirements using requirements.txt was unsuccessful (Error: docxtpl module not found). I then deactivated and deleted the venv dir;
  2. using pipenv install -d (as described in the readthedocs): trying to use pipenv to install dependencies in the Pipfile also led to errors (ModuleNotFoundError: No module named 'typing_extensions'), I then tried, using the same created virtual env created by pipenv, to install requirements.txt dependencies and run the runtests.py file only to get more errors (NameError: name 'Subdoc' is not defined);
  3. using poetry install: since there is also a pyproject.toml file in the root folder, I tried installing the dependencies and creating a virtualenv using poetry, but that also led to me errors (NameError: name 'Subdoc' is not defined);

I have tried running different python versions (3.12 and 3.10) and tried executing from different paths (from within the tests folder, and from the project's root folder), but all led to errors.

How to approach this error and keep on using the lib? Is it still being maintained and actively supported or should I just use the root engine lib (python-docx)?

@waketzheng
Copy link
Contributor Author

@brdacost I'm sorry for introduce the name 'Subdoc' is not defined error. Before this PR merged, you can use this library by:

pip install "docxtpl[subdoc]"

Or if you don't want the "docxcompose" to be installed, use the head of this pull:

pip install git+https://github.com/elapouya/python-docx-template.git@refs/pull/623/head

For local development, I recommend to use uv which is so fast so good:

uv sync --all-extras --all-groups

@waketzheng
Copy link
Contributor Author

@elapouya Cloud you review this PR. It only changes two lines.

@elapouya elapouya merged commit cf5437b into elapouya:master Nov 13, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants