83360


readthedocsでのドキュメント生成時のエラーについての質問です。  
まだ公開を果たした実績がなく、慣れている人にはFAQレベルかもしれません。  
よろしくおねがいします。

### 質問

次のエラーの解決方法をご存知でしょうか。

funcparserlib0.3.5でエラーになるのですが、最新版にしようとするとエラーになって最新にできません。

どちらのエラーも、エラー発生時のコマンドをローカルで実行した場合はエラーになりませんでした。

### funcparserがエラーになるパターン

docs/requirements.txt

[code]

    funcparserlib
    sphinxcontrib-seqdiag
    sphindexer
    
[/code]

エラー発生時のコマンド

[code]

    /home/docs/checkouts/readthedocs.org/user_builds/sphindexer/envs/latest/bin/python -m sphinx -T -E -b html -d _build/doctrees -D language=en . _build/html
    
[/code]

エラー内容

[code]

    Running Sphinx v4.2.0
    loading translations [en]... done
    
    Traceback (most recent call last):
      File "/home/docs/checkouts/readthedocs.org/user_builds/sphindexer/envs/latest/lib/python3.8/site-packages/sphinx/cmd/build.py", line 276, in build_main
        app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
      File "/home/docs/checkouts/readthedocs.org/user_builds/sphindexer/envs/latest/lib/python3.8/site-packages/sphinx/application.py", line 237, in __init__
        self.setup_extension(extension)
      File "/home/docs/checkouts/readthedocs.org/user_builds/sphindexer/envs/latest/lib/python3.8/site-packages/sphinx/application.py", line 393, in setup_extension
        self.registry.load_extension(self, extname)
      File "/home/docs/checkouts/readthedocs.org/user_builds/sphindexer/envs/latest/lib/python3.8/site-packages/sphinx/registry.py", line 429, in load_extension
        mod = import_module(extname)
      File "/home/docs/checkouts/readthedocs.org/user_builds/sphindexer/envs/latest/lib/python3.8/importlib/__init__.py", line 127, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
      File "<frozen importlib._bootstrap>", line 991, in _find_and_load
      File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 783, in exec_module
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
      File "/home/docs/checkouts/readthedocs.org/user_builds/sphindexer/envs/latest/lib/python3.8/site-packages/sphinxcontrib/seqdiag.py", line 26, in <module>
        import seqdiag.utils.rst.nodes
      File "/home/docs/checkouts/readthedocs.org/user_builds/sphindexer/envs/latest/lib/python3.8/site-packages/seqdiag/utils/rst/nodes.py", line 16, in <module>
        from blockdiag.utils.rst import nodes
      File "/home/docs/checkouts/readthedocs.org/user_builds/sphindexer/envs/latest/lib/python3.8/site-packages/blockdiag/utils/rst/nodes.py", line 21, in <module>
        import blockdiag.builder
      File "/home/docs/checkouts/readthedocs.org/user_builds/sphindexer/envs/latest/lib/python3.8/site-packages/blockdiag/builder.py", line 16, in <module>
        from blockdiag import parser
      File "/home/docs/checkouts/readthedocs.org/user_builds/sphindexer/envs/latest/lib/python3.8/site-packages/blockdiag/parser.py", line 42, in <module>
        from funcparserlib.lexer import LexerError, Token, make_tokenizer
      File "/home/docs/checkouts/readthedocs.org/user_builds/sphindexer/envs/latest/lib/python3.8/site-packages/funcparserlib/lexer.py", line 80
        def match_specs(specs, str, i, (line, pos)):
                                       ^
    SyntaxError: invalid syntax
    
    Exception occurred:
      File "/home/docs/checkouts/readthedocs.org/user_builds/sphindexer/envs/latest/lib/python3.8/site-packages/blockdiag/parser.py", line 42, in <module>
        from funcparserlib.lexer import LexerError, Token, make_tokenizer
      File "/home/docs/checkouts/readthedocs.org/user_builds/sphindexer/envs/latest/lib/python3.8/site-packages/funcparserlib/lexer.py", line 80
        def match_specs(specs, str, i, (line, pos)):
                                       ^
    SyntaxError: invalid syntax
    The full traceback has been saved in /tmp/sphinx-err-48idl7xv.log, if you want to report the issue to the developers.
    Please also report this if it was a user error, so that a better error message can be provided next time.
    A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
    
[/code]

### funcparser 0.3.6 にしようとしてエラーになるパターン

docs/requirements.txt

[code]

    funcparserlib==0.3.6
    sphinxcontrib-seqdiag
    sphindexer
    
[/code]

エラー発生時のコマンド

[code]

    /home/docs/checkouts/readthedocs.org/user_builds/sphindexer/envs/latest/bin/python -m pip install --exists-action=w --no-cache-dir -r docs/requirements.txt
    
[/code]

エラー内容

[code]

    Collecting funcparserlib==0.3.6
      Downloading funcparserlib-0.3.6.tar.gz (30 kB)
      Preparing metadata (setup.py): started
      Preparing metadata (setup.py): finished with status 'error'
      ERROR: Command errored out with exit status 1:
       command: /home/docs/checkouts/readthedocs.org/user_builds/sphindexer/envs/latest/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-bhqpa4x3/funcparserlib_f25d7c3ca2944b4fa2fe2a73f18e2891/setup.py'"'"'; __file__='"'"'/tmp/pip-install-bhqpa4x3/funcparserlib_f25d7c3ca2944b4fa2fe2a73f18e2891/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-sbd_vxbh
           cwd: /tmp/pip-install-bhqpa4x3/funcparserlib_f25d7c3ca2944b4fa2fe2a73f18e2891/
      Complete output (1 lines):
      error in funcparserlib setup command: use_2to3 is invalid.
      ----------------------------------------
    WARNING: Discarding https://files.pythonhosted.org/packages/cb/f7/b4a59c3ccf67c0082546eaeb454da1a6610e924d2e7a2a21f337ecae7b40/funcparserlib-0.3.6.tar.gz#sha256=b7992eac1a3eb97b3d91faa342bfda0729e990bd8a43774c1592c091e563c91d (from https://pypi.org/simple/funcparserlib/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
    ERROR: Could not find a version that satisfies the requirement funcparserlib==0.3.6 (from versions: 0.3, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.3.6, 1.0.0a0)
    ERROR: No matching distribution found for funcparserlib==0.3.6
    
[/code]

### 以上


CC BY-SA 4.0
2021-10-31T19:54:28.173
83359
2021-11-01T00:48:39.133
2021-10-31T22:50:09.917
48452
48452
question
python3 sphinx setuptools read-the-docs
readthedocsサイトでビルドエラー（use_2to3、funcparserlib）


解決しました。

### 経緯

エラーメッセージから「use_2to3」に注目して調べたところ、funcparserlib最新版（α版）で解決している情報が見つかりました。

  * <https://githubmemory.com/repo/vlasovskikh/funcparserlib/issues/70>

> I've found that force-using the funcparserlib 1.0.0.a0 release has resolved
> this problem for me in my GithubActions-based CI pipelines that build Sphinx
> docs. (All these pipelines greedily upgrade to the latest available pip,
> setuptools, and wheel at the time of running.)
>
> This might also work for you until we get a new non-alpha release here.
>
> (For reference, see also issue #65)

docs/requirements.txt を次のように書いたところドキュメントがビルドできるようになりました。

[code]

    funcparserlib == 1.0.0a0
    sphinxcontrib-seqdiag
    sphindexer
    
[/code]

### 雑記

恐らくですが、seqdiagをreadthedocs環境で使うようなことがなければ、この問題には遭遇しないと思われます。


CC BY-SA 4.0
2021-10-31T22:54:22.070
83360
2021-11-01T00:48:39.133
2021-11-01T00:48:39.133
48452
48452
83359
answer