bugROOT - Bugs: bug #98486, How to configure ROOT to use...

 
 
Show feedback again

You are not allowed to post comments on this tracker with your current authentication level.

bug #98486: How to configure ROOT to use python 3 on Ubuntu?

Submitted by:  Christoph Deil <cdeil>
Submitted on:  2012-10-26 14:56  
 
Bug / Feature: Feature requestCategory: Build system
Priority: 5 - NormalSeverity: 3 - Normal
Status: NonePrivacy: Public
Assigned to: Wim Lavrijsen <wlav>Open/Closed: Open
Release: 5.34Operating System: All

2012-12-04 22:32, comment #5:

I think ROOT 5 will be in use with many experiments for several years, so if ROOT 5.34 can be made more Python 3 compatible easily, I think it's worth it.

Most of the issues that show up with Python 3 are simple to fix in a way that should be compatible with Python 2.5, I think.
The quickest way would be to run one of the autopep8 tools and then check with Python 2.5 and 3.2 before committing.

I did not try this myself yet, maybe you know that some real issue would come up that I am not aware of?
Let me know if you don't have time for this and I'll give it a shot and send patches.

Christoph

Anonymous
2012-12-04 19:39, comment #4:

Christoph,

how important is it to get genreflex fixed, given that it's going to be gone soon in ROOT6?

For the tutorials and others, I think p2.5 must still be supported, which does not have p3 features in _future_ yet. I'll see what can be done, but can't promise anything.

I'll have a look at what can be done for modding the configure script as suggested.

Cheers,
Wim

Wim Lavrijsen <wlav>In charge of this item.
2012-11-05 15:33, comment #3:

About half of the python examples in tutorials/pyroot as well as tmva/test/TMVAClassification.py don't run.
I think it's all trivial stuff like using print("something") instead print "something", so it's trivial to make the examples python2 and 3 compatible at the same time.
Wim, can you fix those or would it help if I attach patches?

Also on Mac at the very end of the make build there are some Python TabError and SyntaxErrors in genreflex:

Install roots wrapper.
bin/rmkdepend -R -fmain/src/h2root.d -Y -w 1000 -- -m64 -pipe -Wshadow -W -Wall -Woverloaded-virtual -fsigned-char -fno-common -Iinclude -pthread -D__cplusplus -- /Users/deil/software/root/root/main/src/h2root.cxx
clang++ -O2 -m64 -pipe -Wshadow -W -Wall -Woverloaded-virtual -fsigned-char -fno-common -Iinclude -pthread -o main/src/h2root.o -c /Users/deil/software/root/root/main/src/h2root.cxx
clang++ -O2 -m64 -mmacosx-version-min=10.8 -o bin/h2root main/src/h2root.o \
-Llib -lRIO -lHist -lGraf -lGraf3d -lGpad -lTree -lMatrix -lNet -lThread -lMathCore -lCore -lCint lib/libminicern.so \
/opt/local/lib/gcc47/gcc/x86_64-apple-darwin12/4.7.2/../../../libgfortran.dylib /opt/local/lib/gcc47/gcc/x86_64-apple-darwin12/4.7.2/../../../libgfortran.a /opt/local/lib/gcc47/gcc/x86_64-apple-darwin12/4.7.2/libgfortranbegin.a -lm -Wl,-rpath,@loader_path/../lib -lpthread -ldl
gfortran -O2 -m64 -std=legacy -o main/src/g2root.o -c /Users/deil/software/root/root/main/src/g2root.f 2>&1 | sed -e s/arning:/arn-Ignore:/ >&2
/Users/deil/software/root/root/main/src/g2root.f:412.30:

call toreals(3,pmixt,creals,ncr)
1
Warn-Ignore: Actual argument contains too few elements for dummy argument 'r' (3/200) at (1)
/Users/deil/software/root/root/main/src/g2root.f:728.29:

call toreals(-npar0,dummypars(1),creals,ncr)
1
Warn-Ignore: Actual argument contains too few elements for dummy argument 'r' (100/200) at (1)
/Users/deil/software/root/root/main/src/g2root.f:730.28:

call toreals(npar0,qjv(7),creals,ncr)
1
Warn-Ignore: Actual argument contains too few elements for dummy argument 'r' (94/200) at (1)
gfortran -O2 -m64 -mmacosx-version-min=10.8 -o bin/g2root main/src/g2root.o \
-Llib lib/libminicern.so \
/opt/local/lib/gcc47/gcc/x86_64-apple-darwin12/4.7.2/../../../libgfortran.dylib /opt/local/lib/gcc47/gcc/x86_64-apple-darwin12/4.7.2/../../../libgfortran.a /opt/local/lib/gcc47/gcc/x86_64-apple-darwin12/4.7.2/libgfortranbegin.a -lm -Wl,-rpath,@loader_path/../lib -lpthread -ldl
cp /Users/deil/software/root/root/cint/reflex/python/genreflex/gccdemangler.py lib/python/genreflex/gccdemangler.py
File "lib/python/genreflex/gccdemangler.py", line 210
if debug : print 'demangle_mangled_name ', name[:50]
^
SyntaxError: invalid syntax

cp /Users/deil/software/root/root/cint/reflex/python/genreflex/gencapa.py lib/python/genreflex/gencapa.py
cp /Users/deil/software/root/root/cint/reflex/python/genreflex/gendict.py lib/python/genreflex/gendict.py
Sorry: TabError: inconsistent use of tabs and spaces in indentation (gendict.py, line 248)
cp /Users/deil/software/root/root/cint/reflex/python/genreflex/genheader.py lib/python/genreflex/genheader.py
File "lib/python/genreflex/genheader.py", line 18
if id[-1] == u'c' :
^
SyntaxError: invalid syntax

cp /Users/deil/software/root/root/cint/reflex/python/genreflex/genreflex-rootcint.py lib/python/genreflex/genreflex-rootcint.py
File "lib/python/genreflex/genreflex-rootcint.py", line 55
except getopt.GetoptError, e:
^
SyntaxError: invalid syntax

cp /Users/deil/software/root/root/cint/reflex/python/genreflex/genreflex.py lib/python/genreflex/genreflex.py
File "lib/python/genreflex/genreflex.py", line 34
print 'Usage:'
^
SyntaxError: invalid syntax

cp /Users/deil/software/root/root/cint/reflex/python/genreflex/genrootmap.py lib/python/genreflex/genrootmap.py
cp /Users/deil/software/root/root/cint/reflex/python/genreflex/selclass.py lib/python/genreflex/selclass.py
File "lib/python/genreflex/selclass.py", line 52
except xml.parsers.expat.ExpatError, e :
^
SyntaxError: invalid syntax

Anonymous
2012-11-05 15:06, comment #2:

Hi Wim,

this works, thanks for the tip!

I saw that the cmake build has a PYTHON_EXECUTABLE option:
http://root.cern.ch/drupal/content/...

Would it be possible to add a --with-python-executable to the configure & make build matching the cmake build option?

I think there's more and more systems that have python2 and python3 installed and more and more scientific python analysis moves on to python3, so having a simple way to select the PYTHON_EXECUTABLE instead of having to know about an undocumented hack to create a symlink and add it to PATH would be useful.

Anonymous
2012-10-26 20:27, comment #1:

Hi,

don't relink python3 in /usr/bin, just add a symlink to it somewhere local, such as in $ROOTSYS/bin as you're going to add that to PATH anyway for use of root.

Then it should all work (does for me, anyway).

Cheers,
Wim

Wim Lavrijsen <wlav>In charge of this item.
2012-10-26 14:56, original submission:

I would like to use PyROOT with python 3.2, but I can't figure out how to configure the ROOT build for python 3.

travis@ubuntu:~/build/v5-34-03$ ./configure --with-python-incdir=/usr/include/python3.2mu --with-python-libdir=/usr/lib/python3.2/config-3.2mu | grep python
Checking for Python.h ... /usr/include/python3.2mu
Checking for python2.7, libpython2.7, libpython, python, or Python ... no

travis@ubuntu:~/build/v5-34-03$ which python
/usr/bin/python

travis@ubuntu:~/build/v5-34-03$ ls -lh /usr/bin/python*
lrwxrwxrwx 1 root root 18 Oct 26 03:29 /usr/bin/python -> /usr/bin/python2.7
lrwxrwxrwx 1 root root 9 Oct 25 11:23 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 2.7M Jul 31 22:46 /usr/bin/python2.7
-rwxr-xr-x 1 root root 1.7K Jul 31 22:45 /usr/bin/python2.7-config
lrwxrwxrwx 1 root root 16 Apr 17 2012 /usr/bin/python2-config -> python2.7-config
lrwxrwxrwx 1 root root 9 Apr 14 2012 /usr/bin/python3 -> python3.2
lrwxrwxrwx 1 root root 11 Oct 19 13:15 /usr/bin/python3.2 -> python3.2mu
lrwxrwxrwx 1 root root 18 Oct 19 13:15 /usr/bin/python3.2-config -> python3.2mu-config
-rwxr-xr-x 1 root root 2.7M Oct 19 13:15 /usr/bin/python3.2mu
-rwxr-xr-x 1 root root 1.8K Oct 19 13:13 /usr/bin/python3.2mu-config
lrwxrwxrwx 1 root root 16 Apr 14 2012 /usr/bin/python3-config -> python3.2-config
lrwxrwxrwx 1 root root 11 Apr 14 2012 /usr/bin/python3mu -> python3.2mu
lrwxrwxrwx 1 root root 18 Apr 14 2012 /usr/bin/python3mu-config -> python3.2mu-config
lrwxrwxrwx 1 root root 16 Apr 17 2012 /usr/bin/python-config -> python2.7-config

I think the problem is that the first python on the PATH is used by configure (2.7 in my case) and I have no way to tell it to use another python?

Symlinking /usr/bin/python to /usr/bin/python3.2 doesn't work, it gives this error:

travis@ubuntu:~/build/v5-34-03$ sudo ln -sf /usr/bin/python3.2 /usr/bin/python

travis@ubuntu:~/build/v5-34-03$ ./configure
Checking for source directory ... /home/travis/build/v5-34-03
Configuring for linux
File "/usr/bin/lsb_release", line 67
print ':'.join(verinfo)
^
SyntaxError: invalid syntax
File "/usr/bin/lsb_release", line 67
print ':'.join(verinfo)
^
SyntaxError: invalid syntax
File "/usr/bin/lsb_release", line 67
print ':'.join(verinfo)
^
SyntaxError: invalid syntax
Checking for GNU Make version >= 3.80 ... ok
Checking for C compiler ... gcc
Checking for C++ compiler ... g++
Checking for linker (LD) ... g++
Checking for F77 compiler ... no F77 compiler gfortran found
Checking for libX11 ... no
configure: libX11 MUST be installed
See http://root.cern.ch/drupal/content/...

Christoph Deil <cdeil>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by wlav (Posted a comment)
  • -unavailable- added by pcanal (Updated the item)
  • -unavailable- added by cdeil (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independantly of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    2012-10-26 14:57pcanalAssigned toNone=>wlav
    Show feedback again

    Back to the top


    Powered by Savane SVN (toward 3.1)

    This project has been migrated to a new system.
    You will be redirected in 5 seconds.
    Or click here to go now.
    Let me continue in Savannah