Ningensei848 / docstring2pdf

Automatically generate PDF documents from docstrings using GitHub Actions and upload to Google Drive.
https://ningensei848.github.io/docstring2pdf/
MIT License
0 stars 0 forks source link

Windows環境ではpython + poetryだけでは動かない #3

Open tanabata-kitajima opened 1 year ago

tanabata-kitajima commented 1 year ago

Windows環境で動作させたときに、以下のエラー発生を報告します。おそらくインストール手順のアップデートが必要。(prerequisites)

PS K:\ソースツリー\docstring2pdf> C:\Users\tetsuro\AppData\Roaming\Python\Scripts\poetry.exe run mkdocs serve   
Traceback (most recent call last):
  File "C:\Users\tetsuro\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\tetsuro\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "K:\ソースツリー\docstring2pdf\.venv\Scripts\mkdocs.exe\__main__.py", line 7, in <module>
  File "K:\ソースツリー\docstring2pdf\.venv\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "K:\ソースツリー\docstring2pdf\.venv\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "K:\ソースツリー\docstring2pdf\.venv\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "K:\ソースツリー\docstring2pdf\.venv\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "K:\ソースツリー\docstring2pdf\.venv\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "K:\ソースツリー\docstring2pdf\.venv\lib\site-packages\mkdocs\__main__.py", line 234, in serve_command
    serve.serve(dev_addr=dev_addr, livereload=livereload, watch=watch, **kwargs)
  File "K:\ソースツリー\docstring2pdf\.venv\lib\site-packages\mkdocs\commands\serve.py", line 78, in serve
    config = get_config()
  File "K:\ソースツリー\docstring2pdf\.venv\lib\site-packages\mkdocs\config\base.py", line 363, in load_config
    errors, warnings = cfg.validate()
  File "K:\ソースツリー\docstring2pdf\.venv\lib\site-packages\mkdocs\config\base.py", line 228, in validate
    run_failed, run_warnings = self._validate()
  File "K:\ソースツリー\docstring2pdf\.venv\lib\site-packages\mkdocs\config\base.py", line 186, in _validate
    self[key] = config_option.validate(value)
  File "K:\ソースツリー\docstring2pdf\.venv\lib\site-packages\mkdocs\config\config_options.py", line 147, in validate
    return self.run_validation(value)
  File "K:\ソースツリー\docstring2pdf\.venv\lib\site-packages\mkdocs\config\config_options.py", line 939, in run_validation
    self.load_plugin_with_namespace(name, cfg)
  File "K:\ソースツリー\docstring2pdf\.venv\lib\site-packages\mkdocs\config\config_options.py", line 975, in load_plugin_with_namespace
    return (name, self.load_plugin(name, config))
  File "K:\ソースツリー\docstring2pdf\.venv\lib\site-packages\mkdocs\config\config_options.py", line 993, in load_plugin
    plugin_cls = self.installed_plugins[name].load()
  File "C:\Users\tetsuro\AppData\Local\Programs\Python\Python310\lib\importlib\metadata\__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "C:\Users\tetsuro\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "K:\ソースツリー\docstring2pdf\.venv\lib\site-packages\material\plugins\social\plugin.py", line 42, in <module>
    from cairosvg import svg2png
  File "K:\ソースツリー\docstring2pdf\.venv\lib\site-packages\cairosvg\__init__.py", line 26, in <module>
    from . import surface  # noqa isort:skip
  File "K:\ソースツリー\docstring2pdf\.venv\lib\site-packages\cairosvg\surface.py", line 9, in <module>
    import cairocffi as cairo
  File "K:\ソースツリー\docstring2pdf\.venv\lib\site-packages\cairocffi\__init__.py", line 47, in <module>
    cairo = dlopen(
  File "K:\ソースツリー\docstring2pdf\.venv\lib\site-packages\cairocffi\__init__.py", line 44, in dlopen
    raise OSError(error_message)  # pragma: no cover
OSError: no library called "cairo-2" was found
no library called "cairo" was found
no library called "libcairo-2" was found
cannot load library 'libcairo.so.2': error 0x7e
cannot load library 'libcairo.2.dylib': error 0x7e
cannot load library 'libcairo-2.dll': error 0x7e

環境は以下の通り。

PS K:\ソースツリー\docstring2pdf> C:\Users\tetsuro\AppData\Roaming\Python\Scripts\poetry.exe env info                                

Virtualenv
Python:         3.10.11
Implementation: CPython
Path:           K:\ソースツリー\docstring2pdf\.venv
Executable:     K:\ソースツリー\docstring2pdf\.venv\Scripts\python.exe
Valid:          True

System
Platform:   win32
OS:         nt
Python:     3.10.11
Path:       C:\Users\tetsuro\AppData\Local\Programs\Python\Python310
Executable: C:\Users\tetsuro\AppData\Local\Programs\Python\Python310\python.exe
tanabata-kitajima commented 1 year ago

https://github.com/Kozea/WeasyPrint/issues/1240 によればpip install pycairo で解決可能と示唆されていますが、これだけでは通らなかったです。