sphinx-action
sphinx-action copied to clipboard
set a specific python version
I've been using your action for a while now with no problems but I'm now getting build errors consistently. The action seems to run the Sphinx build with Python 3.10 and fails with the traceback below.
I've set up a build matrix to run specific Python versions, with 3.10 an allowed failure, but it continues to use Python 3.10 in each environment. What's the recommended way to tell the action to use a specific version of Python?
ERROR: Command errored out with exit status 1: /usr/local/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-pfh4xj24/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-pfh4xj24/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'"'"'))' install --record /tmp/pip-record-aw7cgm0a/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.10/sdss-datamodel Check the logs for full command output.
WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.10/site-packages/sphinx/__main__.py", line 13, in <module>
from sphinx.cmd.build import main
File "/usr/local/lib/python3.10/site-packages/sphinx/cmd/build.py", line 25, in <module>
from sphinx.application import Sphinx
File "/usr/local/lib/python3.10/site-packages/sphinx/application.py", line 32, in <module>
from sphinx.config import Config
File "/usr/local/lib/python3.10/site-packages/sphinx/config.py", line 23, in <module>
from sphinx.util import logging
File "/usr/local/lib/python3.10/site-packages/sphinx/util/__init__.py", line 35, in <module>
from sphinx.util import smartypants # noqa
File "/usr/local/lib/python3.10/site-packages/sphinx/util/smartypants.py", line 33, in <module>
from sphinx.util.docutils import __version_info__ as docutils_version
File "/usr/local/lib/python3.10/site-packages/sphinx/util/docutils.py", line 31, in <module>
from sphinx.util.typing import RoleFunction
File "/usr/local/lib/python3.10/site-packages/sphinx/util/typing.py", line 34, in <module>
from types import Union as types_Union
ImportError: cannot import name 'Union' from 'types' (/usr/local/lib/python3.10/types.py)
make: *** [Makefile:20: html] Error 1
[sphinx-action] Starting sphinx-action build.
Traceback (most recent call last):
File "/entrypoint.py", line 22, in <module>
Running: apt-get update -y && apt-get install -y gcc && pip install .[docs]
====================================
Building docs in docs/sphinx/
====================================
action.build_all_docs(github_env, [os.environ.get("INPUT_DOCS-FOLDER")])
File "/sphinx_action/action.py", line 152, in build_all_docs
return_code, annotations = build_docs(github_env.build_command, docs_dir)
File "/sphinx_action/action.py", line 134, in build_docs
with open(log_file, "r") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/sphinx-log'
[sphinx-action] Running: ['make', 'html', '-e']
I have a similar question. I would like to run with the Python from my conda environment. This is unsuccessful for the same reason. Ref: https://github.com/tdegeus/prrng/pull/31
I don't think there is a way to set the Python version with this action. Usually you could do something in the "with" options, but this action doesn't have a python-version option. I have replaced the action to get the Python version I need with:
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Upgrade pip, install package, install requirements, build docs
run: |
pip install --upgrade pip
pip install .
pip install -r ./docs/requirements.txt
pip install sphinx
sphinx-build docs ./docs/_build/html/
+1 for being able specify specific python version. It was using python 3.8 for me and I need at least python 3.10 for my documentation build.