Project

General

Profile

Bug #2709

pygments cannot be detected with PythonInterp is python3

Added by Christoph Junghans over 1 year ago. Updated 10 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
documentation
Target version:
Affected version - extra info:
Affected version:
Difficulty:
uncategorized
Close

Description

I was trying to build the manual with GMX_BUILD_MANUAL=On, however

CMake Warning:
  Manually-specified variables were not used by the project:

    GMX_BUILD_MANUAL

Ok, I found that add_subdirectory(manual) is inside and if(SPHINX_FOUND) block and Sphinx is detected quietly (bad - there should be a warning!) Then I did

sed -i '/find_package/s/QUIET//' docs/CMakeLists.txt

and got
-- Found PythonInterp: /usr/bin/python (found suitable version "3.6.5", minimum required is "2.7")
-- Could NOT find pygments (missing: PYTHONMODULE_PYGMENTS)
-- Could NOT find Sphinx (missing: pygments) (found suitable version "1.7.5", minimum required is "1.6.1")

which was strange so looking inside cmake/FindSphinx.cmake and then cmake/FindPythonModule.cmake, I see:
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" 
                "import re, ${module}; print re.compile('/__init__.py.*').sub('',${module}.__file__)" 

That work in python2:
python2 -c "import re, pygments; print re.compile('/__init__.py.*').sub('',pygments.__file__)" 
/usr/lib64/python2.7/site-packages/pygments

but not python3:
python3 -c "import re, pygments; print re.compile('/__init__.py.*').sub('',pygments.__file__)" 
  File "<string>", line 1
    import re, pygments; print re.compile('/__init__.py.*').sub('',pygments.__file__)
                                ^
SyntaxError: invalid syntax

Associated revisions

Revision d4025a3e (diff)
Added by Paul Bauer over 1 year ago

Give more info when trying to build manual

The manual build would fail with cryptic reasons when Sphinx was not
available because the include was not properly set.

Also set up Sphinx detection to be verbose so that users will have it
easier to see whether they can build the docs or not.

Building the docs will not work now when using Python3.

Add test script to check if ImageMagick convert actually works or not.

Refs #2709

Change-Id: I1c49d683d971a5bf0b0ce217f7e9ecd60603e6e6

History

#1 Updated by Paul Bauer over 1 year ago

There is right now no support for python 3 (we are working on a patch but that will not make it into 2019).
I agree that GMX_BUILD_MANUAL needs to be defined even if sphinx is not there.

#2 Updated by Gerrit Code Review Bot over 1 year ago

Gerrit received a related patchset '1' for Issue #2709.
Uploader: Paul Bauer ()
Change-Id: gromacs~release-2019~I1c49d683d971a5bf0b0ce217f7e9ecd60603e6e6
Gerrit URL: https://gerrit.gromacs.org/8592

#3 Updated by Christoph Junghans over 1 year ago

This patch doesn't really help, but if you set PYTHON_EXECUTABLE one can fix it to by python2.

Due to https://www.kb.cert.org/vuls/id/332928, Ubuntu doesn't allow conversion of svg to eps with 'convert' anymore, so the manual build fails with:

cd /var/tmp/portage/sci-chemistry/gromacs-2019.9999/work/gromacs-2019.9999_float/docs && convert /var/tmp/portage/sci-chemistry/gromacs
-2019.9999/work/gromacs-2019.9999/docs/reference-manual/plots/decomp.pdf -antialias -quality 03 -quiet -pointsize 12 -density 1200 -uni
ts PixelsPerInch /var/tmp/portage/sci-chemistry/gromacs-2019.9999/work/gromacs-2019.9999_float/docs/sphinx-input//reference-manual/plot
s/decomp.png
convert: not authorized `PDF' @ error/constitute.c/IsCoderAuthorized/408.
convert: no images defined `/var/tmp/portage/sci-chemistry/gromacs-2019.9999/work/gromacs-2019.9999_float/docs/sphinx-input//reference-
manual/plots/decomp.png' @ error/convert.c/ConvertImageCommand/3288.

#4 Updated by Paul Bauer over 1 year ago

We ran into a similar issue in our test environment with the image conversion that we had to circumvent by allowing it in the settings again.

#5 Updated by Mark Abraham over 1 year ago

Looks like we might need to a) properly use a FindImageMagick package, and b) verify that convert works, before we enable the docs build

#6 Updated by Paul Bauer over 1 year ago

FindImageMagick is already included in CMake since before our minimum required version.
I did a short hacky test and it works the same as with the current version that we get through the UseLatex script.
I guess we need a small custom script that does a minimal image conversion. Will get this done before the second beta.

#7 Updated by Christoph Junghans over 1 year ago

Considering that there is not much leave on the python2 clock (https://pythonclock.org/) how hard is adding python3 support?

#8 Updated by Mark Abraham over 1 year ago

Christoph Junghans wrote:

Considering that there is not much leave on the python2 clock (https://pythonclock.org/) how hard is adding python3 support?

It's not rocket science, but there's several aspects (releng scripts, docs build, and in future gmxapi), and a lot has been done (see https://gerrit.gromacs.org/#/c/6621/). But so far nobody's had the time to set up all Jenkins slaves to have python3 and for it all to work.

#9 Updated by Paul Bauer over 1 year ago

  • Status changed from New to Closed

#10 Updated by Mark Abraham 10 months ago

Not sure if relevant, but discussion related to this issue at https://redmine.gromacs.org/boards/6/topics/1355?r=1360#message-1360

Also available in: Atom PDF