I've had a hard time getting the sphinx-2i2c-theme
building on ReadTheDocs, unless I manually include node
as a part of the build environment. However, I thought that this package should automatically install node as-needed in order to build wheels.
Here's one example of a failed sphinx build:
Building wheels for collected packages: sphinx-2i2c-theme, livereload
Building wheel for sphinx-2i2c-theme (pyproject.toml): started
Building wheel for sphinx-2i2c-theme (pyproject.toml): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /home/docs/checkouts/readthedocs.org/user_builds/2i2c-team-compass/envs/304/bin/python /home/docs/checkouts/readthedocs.org/user_builds/2i2c-team-compass/envs/304/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpcyc47z8e
cwd: /tmp/pip-req-build-jza17p6x
Complete output (26 lines):
[stb] # nodeenv does not exist.
[stb] # Generating new nodeenv with NodeJS 16.13.0!
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/2i2c-team-compass/envs/304/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
main()
File "/home/docs/checkouts/readthedocs.org/user_builds/2i2c-team-compass/envs/304/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/docs/checkouts/readthedocs.org/user_builds/2i2c-team-compass/envs/304/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 261, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/tmp/pip-build-env-frl5r2ot/overlay/lib/python3.8/site-packages/sphinx_theme_builder/__init__.py", line 95, in build_wheel
return _generate_wheel(
File "/tmp/pip-build-env-frl5r2ot/overlay/lib/python3.8/site-packages/sphinx_theme_builder/_internal/distributions.py", line 157, in generate_wheel_distribution
generate_assets(project, production=not editable)
File "/tmp/pip-build-env-frl5r2ot/overlay/lib/python3.8/site-packages/sphinx_theme_builder/_internal/nodejs.py", line 176, in generate_assets
create_nodeenv(nodeenv, project.node_version)
File "/tmp/pip-build-env-frl5r2ot/overlay/lib/python3.8/site-packages/sphinx_theme_builder/_internal/nodejs.py", line 120, in create_nodeenv
if _should_use_system_node(node_version=node_version):
File "/tmp/pip-build-env-frl5r2ot/overlay/lib/python3.8/site-packages/sphinx_theme_builder/_internal/nodejs.py", line 99, in _should_use_system_node
process = subprocess.run(["node", "--version"], capture_output=True)
File "/home/docs/.asdf/installs/python/3.8.12/lib/python3.8/subprocess.py", line 493, in run
with Popen(*popenargs, **kwargs) as process:
File "/home/docs/.asdf/installs/python/3.8.12/lib/python3.8/subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/home/docs/.asdf/installs/python/3.8.12/lib/python3.8/subprocess.py", line 1704, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'node'
----------------------------------------
ERROR: Failed building wheel for sphinx-2i2c-theme
So it seems like the theme builder is correctly logging that it needs to download node, but it doesn't seem to happen. This error goes away if I configure the ReadTheDocs build to include nodejs
.
I think that this is related to this function, which is trying to allow for a non-0 exit code, but somehow this isn't working within ReadTheDocs...
https://github.com/pradyunsg/sphinx-theme-builder/blob/df7f089add6726064f0966741268e803c2d2d8b2/src/sphinx_theme_builder/_internal/nodejs.py#L98-L105