mkdocstrings / mkdocstrings

:blue_book: Automatic documentation from sources, for MkDocs.
https://mkdocstrings.github.io/
ISC License
1.74k stars 108 forks source link

bug: ModuleNotFoundError: No module named 'mkdocstrings_handlers' #648

Closed cldtech closed 10 months ago

cldtech commented 10 months ago

Description of the bug

When i try to build the doc i get "ModuleNotFoundError: No module named 'mkdocstrings_handlers'". This is a fresh installation and a new empty mkdocs project and i still get this error as soon as i had a class or a function.

To Reproduce

 ```
 pip3 install mkdocs
 pip3 install mkdocstring
 mkdocs new docs
 cd docs
 mkdocs build
 ```

Full traceback

Full traceback ```python INFO - Cleaning site directory INFO - Building documentation to directory: /home/sam/Documents/project/project/has/docs/site WARNING - A relative path to 'subfolder/functions.md' is included in the 'nav' configuration, which is not found in the documentation files. WARNING - A relative path to 'functions.md' is included in the 'nav' configuration, which is not found in the documentation files. ERROR - Error reading page 'index.md': No module named 'mkdocstrings_handlers' Traceback (most recent call last): File "/home/sam/.local/bin/mkdocs", line 8, in sys.exit(cli()) File "/home/sam/.local/lib/python3.9/site-packages/click/core.py", line 1157, in __call__ return self.main(*args, **kwargs) File "/home/sam/.local/lib/python3.9/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) File "/home/sam/.local/lib/python3.9/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/sam/.local/lib/python3.9/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) File "/home/sam/.local/lib/python3.9/site-packages/click/core.py", line 783, in invoke return __callback(*args, **kwargs) File "/home/sam/.local/lib/python3.9/site-packages/mkdocs/__main__.py", line 286, in build_command build.build(cfg, dirty=not clean) File "/home/sam/.local/lib/python3.9/site-packages/mkdocs/commands/build.py", line 322, in build _populate_page(file.page, config, files, dirty) File "/home/sam/.local/lib/python3.9/site-packages/mkdocs/commands/build.py", line 175, in _populate_page page.render(config, files) File "/home/sam/.local/lib/python3.9/site-packages/mkdocs/structure/pages.py", line 271, in render self.content = md.convert(self.markdown) File "/home/sam/.local/lib/python3.9/site-packages/markdown/core.py", line 357, in convert root = self.parser.parseDocument(self.lines).getroot() File "/home/sam/.local/lib/python3.9/site-packages/markdown/blockparser.py", line 117, in parseDocument self.parseChunk(self.root, '\n'.join(lines)) File "/home/sam/.local/lib/python3.9/site-packages/markdown/blockparser.py", line 136, in parseChunk self.parseBlocks(parent, text.split('\n\n')) File "/home/sam/.local/lib/python3.9/site-packages/markdown/blockparser.py", line 158, in parseBlocks if processor.run(parent, blocks) is not False: File "/home/sam/.local/lib/python3.9/site-packages/mkdocstrings/extension.py", line 124, in run html, handler, data = self._process_block(identifier, block, heading_level) File "/home/sam/.local/lib/python3.9/site-packages/mkdocstrings/extension.py", line 195, in _process_block handler = self._handlers.get_handler(handler_name, handler_config) File "/home/sam/.local/lib/python3.9/site-packages/mkdocstrings/handlers/base.py", line 459, in get_handler module = importlib.import_module(f"mkdocstrings_handlers.{name}") File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 972, in _find_and_load_unlocked File "", line 228, in _call_with_frames_removed File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 984, in _find_and_load_unlocked ModuleNotFoundError: No module named 'mkdocstrings_handlers' ```

Expected behavior

Since i put a class in index.md, i expect the site to be generated correctly.

Environment information

python3 -m mkdocstrings.debug  # | xclip -selection clipboard

Additional context

pawamoy commented 10 months ago

Duplicate of #623, #647, you're missing the mkdocstrings-python dependency.

cldtech commented 10 months ago

You mean i have to install mkdocstrings-python with pip?

pawamoy commented 10 months ago

Yes :)