space-ros / docs

The Space ROS documentation site.
Creative Commons Attribution 4.0 International
9 stars 11 forks source link

Failure to compile docs using docker due to version of `docutils` installed #21

Closed ivanperez-keera closed 10 months ago

ivanperez-keera commented 1 year ago

I am having a problem compiling the documentation using docker/image/Dockerfile. It appears that some of the versions of dependencies installed are incompatible.

The error message I get initially is the following:

Summary (click to see complete log): ``` $ docker run -v $PWD/:/tmp/doc_repository -it spaceros-docs [... details omitted...] ERROR: doc8 1.1.1 has requirement docutils<0.21,>=0.19, but you'll have docutils 0.16 which is incompatible. ERROR: sphinx 6.1.3 has requirement docutils<0.20,>=0.18, but you'll have docutils 0.16 which is incompatible. ERROR: sphinx-tabs 3.4.1 has requirement docutils~=0.18.0, but you'll have docutils 0.16 which is incompatible. ``` Complete log: ``` $ docker run -v $PWD/:/tmp/doc_repository -it spaceros-docs WARNING: The directory '/home/rosindex/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Collecting doc8 Downloading doc8-1.1.1-py3-none-any.whl (25 kB) Collecting docutils==0.16 Downloading docutils-0.16-py2.py3-none-any.whl (548 kB) |████████████████████████████████| 548 kB 1.6 MB/s Collecting pip Downloading pip-23.0.1-py3-none-any.whl (2.1 MB) |████████████████████████████████| 2.1 MB 6.0 MB/s Collecting sphinx Downloading sphinx-6.1.3-py3-none-any.whl (3.0 MB) |████████████████████████████████| 3.0 MB 9.4 MB/s Collecting sphinx-copybutton Downloading sphinx_copybutton-0.5.1-py3-none-any.whl (13 kB) Collecting sphinx-multiversion Downloading sphinx_multiversion-0.2.4-py3-none-any.whl (9.6 kB) Collecting sphinx-rtd-theme Downloading sphinx_rtd_theme-1.2.0-py2.py3-none-any.whl (2.8 MB) |████████████████████████████████| 2.8 MB 9.3 MB/s Collecting sphinx-sitemap Downloading sphinx_sitemap-2.5.0-py3-none-any.whl (5.2 kB) Collecting sphinx-tabs Downloading sphinx_tabs-3.4.1-py3-none-any.whl (10.0 kB) Collecting stevedore Downloading stevedore-5.0.0-py3-none-any.whl (49 kB) |████████████████████████████████| 49 kB 12.3 MB/s Collecting tomli; python_version < "3.11" Downloading tomli-2.0.1-py3-none-any.whl (12 kB) Collecting Pygments Downloading Pygments-2.14.0-py3-none-any.whl (1.1 MB) |████████████████████████████████| 1.1 MB 10.2 MB/s Collecting restructuredtext-lint>=0.7 Downloading restructuredtext_lint-1.4.0.tar.gz (16 kB) Collecting sphinxcontrib-qthelp Downloading sphinxcontrib_qthelp-1.0.3-py2.py3-none-any.whl (90 kB) |████████████████████████████████| 90 kB 10.2 MB/s Collecting sphinxcontrib-applehelp Downloading sphinxcontrib_applehelp-1.0.4-py3-none-any.whl (120 kB) |████████████████████████████████| 120 kB 8.7 MB/s Collecting packaging>=21.0 Downloading packaging-23.0-py3-none-any.whl (42 kB) |████████████████████████████████| 42 kB 12.6 MB/s Collecting alabaster<0.8,>=0.7 Downloading alabaster-0.7.13-py3-none-any.whl (13 kB) Collecting imagesize>=1.3 Downloading imagesize-1.4.1-py2.py3-none-any.whl (8.8 kB) Collecting importlib-metadata>=4.8; python_version < "3.10" Downloading importlib_metadata-6.0.0-py3-none-any.whl (21 kB) Collecting sphinxcontrib-jsmath Downloading sphinxcontrib_jsmath-1.0.1-py2.py3-none-any.whl (5.1 kB) Collecting requests>=2.25.0 Downloading requests-2.28.2-py3-none-any.whl (62 kB) |████████████████████████████████| 62 kB 11.4 MB/s Collecting sphinxcontrib-serializinghtml>=1.1.5 Downloading sphinxcontrib_serializinghtml-1.1.5-py2.py3-none-any.whl (94 kB) |████████████████████████████████| 94 kB 10.4 MB/s Collecting Jinja2>=3.0 Downloading Jinja2-3.1.2-py3-none-any.whl (133 kB) |████████████████████████████████| 133 kB 13.5 MB/s Collecting babel>=2.9 Downloading Babel-2.12.1-py3-none-any.whl (10.1 MB) |████████████████████████████████| 10.1 MB 10.1 MB/s Collecting sphinxcontrib-htmlhelp>=2.0.0 Downloading sphinxcontrib_htmlhelp-2.0.1-py3-none-any.whl (99 kB) |████████████████████████████████| 99 kB 9.5 MB/s Collecting snowballstemmer>=2.0 Downloading snowballstemmer-2.2.0-py2.py3-none-any.whl (93 kB) |████████████████████████████████| 93 kB 10.6 MB/s Collecting sphinxcontrib-devhelp Downloading sphinxcontrib_devhelp-1.0.2-py2.py3-none-any.whl (84 kB) |████████████████████████████████| 84 kB 11.9 MB/s Collecting sphinxcontrib-jquery!=3.0.0,>=2.0.0; python_version > "3" Downloading sphinxcontrib_jquery-2.0.0-py3-none-any.whl (3.2 kB) Collecting pbr!=2.1.0,>=2.0.0 Downloading pbr-5.11.1-py2.py3-none-any.whl (112 kB) |████████████████████████████████| 112 kB 11.3 MB/s Collecting zipp>=0.5 Downloading zipp-3.15.0-py3-none-any.whl (6.8 kB) Collecting certifi>=2017.4.17 Downloading certifi-2022.12.7-py3-none-any.whl (155 kB) |████████████████████████████████| 155 kB 11.3 MB/s Collecting charset-normalizer<4,>=2 Downloading charset_normalizer-3.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (195 kB) |████████████████████████████████| 195 kB 12.0 MB/s Collecting idna<4,>=2.5 Downloading idna-3.4-py3-none-any.whl (61 kB) |████████████████████████████████| 61 kB 3.8 MB/s Collecting urllib3<1.27,>=1.21.1 Downloading urllib3-1.26.15-py2.py3-none-any.whl (140 kB) |████████████████████████████████| 140 kB 11.9 MB/s Collecting MarkupSafe>=2.0 Downloading MarkupSafe-2.1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB) Collecting pytz>=2015.7; python_version < "3.9" Downloading pytz-2022.7.1-py2.py3-none-any.whl (499 kB) |████████████████████████████████| 499 kB 11.3 MB/s Requirement already satisfied, skipping upgrade: setuptools in /usr/lib/python3/dist-packages (from sphinxcontrib-jquery!=3.0.0,>=2.0.0; python_version > "3"->sphinx-rtd-theme->-r requirements.txt (line 7)) (45.2.0) Building wheels for collected packages: restructuredtext-lint Building wheel for restructuredtext-lint (setup.py) ... done Created wheel for restructuredtext-lint: filename=restructuredtext_lint-1.4.0-py3-none-any.whl size=13793 sha256=3ff98962cf37062f9e2d9aadab8e70451d804b52e460784fc5bd290a5108fbe6 Stored in directory: /tmp/pip-ephem-wheel-cache-nrpwe8kg/wheels/b6/9d/8a/31f24f45d7b026ec9ca2dc1626c8d1229063351d1cae47284a Successfully built restructuredtext-lint ERROR: doc8 1.1.1 has requirement docutils<0.21,>=0.19, but you'll have docutils 0.16 which is incompatible. ERROR: sphinx 6.1.3 has requirement docutils<0.20,>=0.18, but you'll have docutils 0.16 which is incompatible. ERROR: sphinx-tabs 3.4.1 has requirement docutils~=0.18.0, but you'll have docutils 0.16 which is incompatible. Installing collected packages: pbr, stevedore, docutils, tomli, Pygments, restructuredtext-lint, doc8, pip, sphinxcontrib-qthelp, sphinxcontrib-applehelp, packaging, alabaster, imagesize, zipp, importlib-metadata, sphinxcontrib-jsmath, certifi, charset-normalizer, idna, urllib3, requests, sphinxcontrib-serializinghtml, MarkupSafe, Jinja2, pytz, babel, sphinxcontrib-htmlhelp, snowballstemmer, sphinxcontrib-devhelp, sphinx, sphinx-copybutton, sphinx-multiversion, sphinxcontrib-jquery, sphinx-rtd-theme, sphinx-sitemap, sphinx-tabs ^CERROR: Operation cancelled by user ```

The following changes to the requirements.txt file allow me to compile without errors. I tried different variations to narrow down the versions needed for each of these libraries, but perhaps an alternative combination would also work.

diff --git a/requirements.txt b/requirements.txt
index 4d95bd1..a6e2efd 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,5 @@
-doc8
-docutils==0.16
+doc8<1.0.0
+docutils~=0.18.0
 pip
 sphinx
 sphinx-copybutton
Bckempa commented 10 months ago

Trying to run locally on Ubuntu 22.04 with Python 3.10 in a virtualenv with the requirements.txt installed I get this exception:

❯ make multiversion
sphinx-multiversion -c . "source" build/html
outputdir 'rolling' for refs/remotes/origin/rolling conflicts with other versions
Running Sphinx v5.3.0

Exception occurred:
  File "/home/bckempa/.pyenv/versions/3.10.13/envs/spaceROS-docs/lib/python3.10/site-packages/sphinx_tabs/tabs.py", line 341, in setup
    app.add_javascript(path)
AttributeError: 'Sphinx' object has no attribute 'add_javascript'
The full traceback has been saved in /tmp/sphinx-err-m_8n0dyr.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!
Traceback (most recent call last):
  File "/home/bckempa/.pyenv/versions/spaceROS-docs/bin/sphinx-multiversion", line 8, in <module>
    sys.exit(main())
  File "/home/bckempa/.pyenv/versions/3.10.13/envs/spaceROS-docs/lib/python3.10/site-packages/sphinx_multiversion/main.py", line 338, in main
    subprocess.check_call(cmd, cwd=current_cwd)
  File "/home/bckempa/.pyenv/versions/3.10.13/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '('/home/bckempa/.pyenv/versions/3.10.13/envs/spaceROS-docs/bin/python3.10', '-R', '-m', 'sphinx', '-D', 'smv_metadata_path=/tmp/tmp44_256mq/versions.json', '-D', 'smv_current_version=rolling', '-c', '/home/bckempa/spaceros_ws/docs', '/tmp/tmp44_256mq/dd8cff49220293c16884ba25b776b7db2f8cecc2/source', '/home/bckempa/spaceros_ws/docs/build/html/rolling')' returned non-zero exit status 2.
make: *** [Makefile:13: multiversion] Error 1

This method has been deprecated since Sphinx v1.8 released in September 2018 and was removed in v4.0 released in May 2021. Looks like we just need to pin all the versions until we can modernize this stack.

Bckempa commented 10 months ago

This was addressed upstream by https://github.com/ros2/ros2_documentation/pull/2725

I back-ported the relevant commit https://github.com/ros2/ros2_documentation/pull/2725/commits/e43347d0413bef6801339894a8e63b2bd56e4c3a and am testing it now.