Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Exp PyROOT] Build PyROOT with multiple Python versions #4279

Closed
wants to merge 16 commits into from

Conversation

maxgalli
Copy link
Contributor

@maxgalli maxgalli commented Aug 25, 2019

The commits in this PR contain the necessary steps performed in order to allow the user to build PyROOT with more than one versions of Python. The version in use can be changed with the usual source thisroot.sh preceded by the specific Python version, e.g.:
ROOT_PYTHON_VERSION=3.6 source bin/thisroot.sh
performed inside the build directory.
Quick summary of the commits:
(1) set the necessary CMake variables to build the PyROOT libraries in lib/pythonX.Y
(2) modify thisroot.sh to allow the user to select the Python version
(3) necessary changes to pyunittests and tutorials CMake variables
(4) installation

@phsft-bot
Copy link
Collaborator

Starting build on ROOT-performance-centos7-multicore/default, ROOT-fedora27/noimt, ROOT-fedora29/python3, ROOT-ubuntu16/rtcxxmod, mac1014/cxx17, windows10/default
How to customize builds

@phsft-bot
Copy link
Collaborator

Build failed on ROOT-fedora29/python3.
See console output.

Warnings:

  • CMake Warning at /mnt/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:864 (message):

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on ROOT-performance-centos7-multicore/default.
See console output.

Warnings:

  • CMake Warning at /data/sftnight/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:864 (message):

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on ROOT-ubuntu16/rtcxxmod.
See console output.

Warnings:

  • CMake Warning at /mnt/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:864 (message):

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on mac1014/cxx17.
See console output.

Warnings:

  • CMake Warning at /build/jenkins/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:864 (message):
  • ld: warning: directory not found for option '-L/build/jenkins/workspace/root-pullrequests-build/build/lib:/build/jenkins/workspace/root-pullrequests-build/build/lib/python2.7'
  • ld: warning: directory not found for option '-L/build/jenkins/workspace/root-pullrequests-build/build/lib:/build/jenkins/workspace/root-pullrequests-build/build/lib/python2.7'
  • ld: warning: directory not found for option '-L/build/jenkins/workspace/root-pullrequests-build/build/lib:/build/jenkins/workspace/root-pullrequests-build/build/lib/python2.7'

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on ROOT-fedora27/noimt.
See console output.

Warnings:

  • CMake Warning at /mnt/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:864 (message):

Failing tests:

@maxgalli
Copy link
Contributor Author

@phsft-bot build

@phsft-bot
Copy link
Collaborator

Starting build on ROOT-performance-centos7-multicore/default, ROOT-fedora27/noimt, ROOT-fedora29/python3, ROOT-ubuntu16/rtcxxmod, mac1014/cxx17, windows10/default
How to customize builds

@phsft-bot
Copy link
Collaborator

Build failed on windows10/default.
See console output.

@phsft-bot
Copy link
Collaborator

Starting build on ROOT-performance-centos7-multicore/default, ROOT-fedora27/noimt, ROOT-fedora29/python3, ROOT-ubuntu16/rtcxxmod, mac1014/cxx17, windows10/default
How to customize builds

@phsft-bot
Copy link
Collaborator

Build failed on windows10/default.
See console output.

@phsft-bot
Copy link
Collaborator

Starting build on ROOT-performance-centos7-multicore/default, ROOT-fedora27/noimt, ROOT-fedora29/python3, ROOT-ubuntu16/rtcxxmod, mac1014/cxx17, windows10/default
How to customize builds

@phsft-bot
Copy link
Collaborator

Build failed on windows10/default.
See console output.

@phsft-bot
Copy link
Collaborator

Build failed on mac1014/cxx17.
See console output.

Warnings:

  • CMake Warning at /build/jenkins/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:864 (message):
  • ld: warning: directory not found for option '-L/build/jenkins/workspace/root-pullrequests-build/build/lib:/build/jenkins/workspace/root-pullrequests-build/build/lib/python2.7'
  • ld: warning: directory not found for option '-L/build/jenkins/workspace/root-pullrequests-build/build/lib:/build/jenkins/workspace/root-pullrequests-build/build/lib/python2.7'
  • ld: warning: directory not found for option '-L/build/jenkins/workspace/root-pullrequests-build/build/lib:/build/jenkins/workspace/root-pullrequests-build/build/lib/python2.7'

Failing tests:

And 26 more

@@ -94,6 +94,10 @@ foreach(py_source ${py_sources})
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -O -m py_compile ${d}/${py_source})")
endforeach()

if (NOT EXISTS ${localruntimedir}/python_default)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check how to make this portable for Windows

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is create_symlink portable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

fi

if [ -n "${old_rootsys}" ] ; then
drop_from_all_libs()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clean _environment

@@ -86,81 +87,162 @@ if [ -n "${old_rootsys}" ] ; then
drop_from_path "$JUPYTER_PATH" "${old_rootsys}/etc/notebook"
JUPYTER_PATH=$newpath
fi
if [ -z "${MANPATH}" ]; then
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put outside and not protected by if

if [ -z "${JUPYTER_PATH}" ]; then
JUPYTER_PATH=$ROOTSYS/etc/notebook; export JUPYTER_PATH # Linux, ELF HP-UX

if [ -z "${PYTHON_VERSION}" ] ; then
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this shold not protect the clean

{
# Assert that we got enough arguments
if test $# -ne 1 ; then
echo "drop_from_path: needs 1 argument"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change drop_from_path


if [ -z "${MANPATH}" ]; then
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put inside main

SHLIB_PATH=@libdir@:@libdir@/python${version}
export SHLIB_PATH # Linux, ELF HP-UX
else
SHLIB_PATH=@libdir@:@libdir@/python${version}:$SHLIBR_PATH
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SHLIB_PATH

Changed CMake variables in tutorials and pyunittests to make tests pass
with multiple Python versions.
Installation:
a new CMake variable CMAKE_INSTALL_PYROOTDIR was introduced in order to
install the PyROOT and cppyy packages in a directory which can be
automatically found by the Python interpreter the user keeps the default
value of CMAKE_INSTALL_PREFIX.
This value default to:
CMAKE_INSTALL_PREFIX/CMAKE_INSTALL_LIBDIR/pythonX.Y/site-packages
for standard Unix distributions and to:
CMAKE_INSTALL_PREFIX/CMAKE_INSTALL_LIBDIR/pythonX.Y/dist-packages
for Debian and Ubuntu.
.
├── CMakeLists.txt
├── JsMVA
│   └── python
├── JupyROOT
│   ├── python
│   ├── README.md
│   └── src
└── PyROOT
    ├── inc
    ├── python
    ├── src
    └── test
This is done to avoid changes to the macros that would be necessary due
to linking errors caused if we keep only one CMakeLists.txt file inside
PyROOT directory.

.
├── CMakeLists.txt
├── JsMVA
│   ├── CMakeLists.txt
│   └── python
├── JupyROOT
│   ├── CMakeLists.txt
│   ├── python
│   ├── README.md
│   └── src
└── PyROOT
    ├── CMakeLists.txt
    ├── inc
    ├── python
    ├── src
    └── test
… layout

Change of directory layout prevented makepchinput.py to construct the
correct path to PyROOT Experimental directories and for this reason
TPython related headers were not added to the PCH.

Deprecated, since with modules we do not have a PCH anymore.

Keep it just in case.
…up script

A python egg is created for the cppyy package. For doing this, we use
the usual "python setup.py install_egg_info" syntax.
…ipt specifically created

A setup script is added for PyROOT in order to access the information to
put in the python egg.
Here we make all the changes necessary to enable the pyroot experimental
related variables and paths only when we are in pyroot experimental.
This can easily be reverted once PyROOT experimental will be the
default.
…tisfied

Python eggs for PyROOT and Cppyy cannot be created in a complete and
pythonic way if setuptools is not installed and version is > 3.3. The
absence of this conditions actually also make the entire build fail.
If the requisites are not satisfied, eggs are created in a simpler way (with less information).
The following CMake variables:
PYTHON_INCLUDE_DIR
PYTHON_LIBRARY
are unset in order to allow the use to specify only -DPYTHON_EXECUTABLE
at configure time.

The following variable:
CMAKE_INSTALL_PYROOTIR
is unset in order to install the package in the correct path.
@phsft-bot
Copy link
Collaborator

Starting build on ROOT-performance-centos7-multicore/default, ROOT-fedora27/noimt, ROOT-fedora29/python3, ROOT-fedora30/cxx14, ROOT-ubuntu16/rtcxxmod, ROOT-ubuntu18.04-i386/cxx14, mac1014/cxx17, windows10/cxx14 with flags -Dpyroot_experimental=ON
How to customize builds

@phsft-bot
Copy link
Collaborator

Build failed on ROOT-ubuntu18.04-i386/cxx14.
See console output.

Errors:

  • /home/sftnight/build/workspace/root-pullrequests-build/root/bindings/pyroot_experimental/PyROOT/PyROOT/src/TTreePyz.cxx:93:61: error: invalid conversion from ‘long int*’ to ‘dims_t {aka int*}’ [-fpermissive]

Warnings:

  • /home/sftnight/build/workspace/root-pullrequests-build/root/bindings/pyroot_experimental/cppyy/CPyCppyy/src/Converters.cxx:547:88: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘Py_ssize_t {aka int}’ [-Wformat=]
  • /home/sftnight/build/workspace/root-pullrequests-build/root/bindings/pyroot_experimental/cppyy/CPyCppyy/src/Converters.cxx:547:88: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘Py_ssize_t {aka int}’ [-Wformat=]
  • /home/sftnight/build/workspace/root-pullrequests-build/root/bindings/pyroot_experimental/cppyy/CPyCppyy/src/CPPMethod.cxx:548:80: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘Py_ssize_t {aka int}’ [-Wformat=]
  • /home/sftnight/build/workspace/root-pullrequests-build/root/bindings/pyroot_experimental/cppyy/CPyCppyy/src/CPPMethod.cxx:548:80: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘Py_ssize_t {aka int}’ [-Wformat=]
  • /home/sftnight/build/workspace/root-pullrequests-build/root/bindings/pyroot_experimental/cppyy/CPyCppyy/src/CPPMethod.cxx:552:72: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘Py_ssize_t {aka int}’ [-Wformat=]
  • /home/sftnight/build/workspace/root-pullrequests-build/root/bindings/pyroot_experimental/cppyy/CPyCppyy/src/CPPMethod.cxx:552:72: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘Py_ssize_t {aka int}’ [-Wformat=]
  • /home/sftnight/build/workspace/root-pullrequests-build/root/bindings/pyroot_experimental/PyROOT/PyROOT/src/CppCallablePyz.cxx:290:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  • /home/sftnight/build/workspace/root-pullrequests-build/root/bindings/pyroot_experimental/PyROOT/PyROOT/src/RVecPyz.cxx:52:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

@phsft-bot
Copy link
Collaborator

Build failed on mac1014/cxx17.
See console output.

Errors:

  • FAILED: bindings/pyroot_experimental/cppyy/CPyCppyy/CMakeFiles/cppyy.dir/src/CallContext.cxx.o
  • /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h:534:5: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  • /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h:553:5: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  • /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h:575:5: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  • /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h:593:5: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  • /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/stringobject.h:173:5: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  • /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/stringobject.h:174:5: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  • /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/stringobject.h:175:5: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  • FAILED: bindings/pyroot_experimental/cppyy/CPyCppyy/CMakeFiles/cppyy.dir/src/CPPClassMethod.cxx.o
  • /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h:534:5: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]

And 46 more

@phsft-bot
Copy link
Collaborator

@phsft-bot
Copy link
Collaborator

@phsft-bot
Copy link
Collaborator

@phsft-bot
Copy link
Collaborator

@phsft-bot
Copy link
Collaborator

Build failed on windows10/cxx14.
See console output.

Errors:

  • C:\build\workspace\root-pullrequests-build\root\bindings\pyroot_experimental\PyROOT\PyROOT\src\TTreePyz.cxx(93,61): error C2664: 'CPyCppyy::Converter *CPyCppyy::CreateConverter(const std::string &,dims_t)': cannot convert argument 2 from 'long [2]' to 'dims_t' [C:\build\workspace\root-pullrequests-build\build\bindings\pyroot_experimental\PyROOT\PyROOT\ROOTPython.vcxproj]

@maxgalli
Copy link
Contributor Author

New version coming

@maxgalli maxgalli closed this Nov 26, 2019
maxgalli added a commit to maxgalli/root that referenced this pull request Dec 12, 2019
When PR root-project#4279 was initially sent on Aug 25th, the search for Python was
moved to RootBuildMacros in order to avoid a build failure due ot the
search for another package and the declaration of one of the new CMake
variables.
This seem not to be a problem anymore (something changed in the
meantime?), so the search for Python can be put back to the original
place.
This could also fix the tests failing with cxx17 due to a mismatch
between Python executable and libraries.
maxgalli added a commit to maxgalli/root that referenced this pull request Dec 13, 2019
When PR root-project#4279 was initially sent on Aug 25th, the search for Python was
moved to RootBuildMacros in order to avoid a build failure due ot the
search for another package and the declaration of one of the new CMake
variables.
This seem not to be a problem anymore (something changed in the
meantime?), so the search for Python can be put back to the original
place.
This could also fix the tests failing with cxx17 due to a mismatch
between Python executable and libraries.
etejedor pushed a commit that referenced this pull request Dec 16, 2019
When PR #4279 was initially sent on Aug 25th, the search for Python was
moved to RootBuildMacros in order to avoid a build failure due ot the
search for another package and the declaration of one of the new CMake
variables.
This seem not to be a problem anymore (something changed in the
meantime?), so the search for Python can be put back to the original
place.
This could also fix the tests failing with cxx17 due to a mismatch
between Python executable and libraries.
Falcort pushed a commit to Falcort/root that referenced this pull request Jan 7, 2020
When PR root-project#4279 was initially sent on Aug 25th, the search for Python was
moved to RootBuildMacros in order to avoid a build failure due ot the
search for another package and the declaration of one of the new CMake
variables.
This seem not to be a problem anymore (something changed in the
meantime?), so the search for Python can be put back to the original
place.
This could also fix the tests failing with cxx17 due to a mismatch
between Python executable and libraries.
Falcort pushed a commit to Falcort/root that referenced this pull request Jan 7, 2020
When PR root-project#4279 was initially sent on Aug 25th, the search for Python was
moved to RootBuildMacros in order to avoid a build failure due ot the
search for another package and the declaration of one of the new CMake
variables.
This seem not to be a problem anymore (something changed in the
meantime?), so the search for Python can be put back to the original
place.
This could also fix the tests failing with cxx17 due to a mismatch
between Python executable and libraries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants