# The version of ROOT and the compatibility with the Python

**URL:** <https://root-forum.cern.ch/t/the-version-of-root-and-the-compatibility-with-the-python/14812>\
**Category:** ROOT\
**Created:** [August 23, 2012, 8:25am UTC](https://root-forum.cern.ch/t/the-version-of-root-and-the-compatibility-with-the-python/14812 "2012-08-23T08:25:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![violin](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/v/919ad9/32.png) [@violin](https://root-forum.cern.ch/u/violin)\
**Post date:** [August 23, 2012, 8:25am UTC](https://root-forum.cern.ch/t/the-version-of-root-and-the-compatibility-with-the-python/14812/1 "2012-08-23T08:25:24Z")

</div>

Hello

I want to check the compatibility of ROOT with the Python. The version of ROOT is 5.30 and the PYTHON is 2.7.3. I check them by in a shell the commands

* * *

root-config --has-python

* * *

The result is

* * *

no

* * *

What can I do?

Best wishes  
violin

---

<div class="post-metadata">

**Author:** ![Pepe\_Le\_Pew](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pepe_le_pew/32/12365_2.png) [@Pepe\_Le\_Pew](https://root-forum.cern.ch/u/Pepe_Le_Pew)\
**Post date:** [August 23, 2012, 9:37am UTC](https://root-forum.cern.ch/t/the-version-of-root-and-the-compatibility-with-the-python/14812/2 "2012-08-23T09:37:58Z")

</div>

[url][Import ROOT error](https://root-forum.cern.ch/t/import-root-error/14636/1)  
[url][PyROOT and Ubuntu 12.04](https://root-forum.cern.ch/t/pyroot-and-ubuntu-12-04/14227/1)  
[url][Installation succeeds but root doesn't start](https://root-forum.cern.ch/t/installation-succeeds-but-root-doesnt-start/14657/1)

---

<div class="post-metadata">

**Author:** ![violin](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/v/919ad9/32.png) [@violin](https://root-forum.cern.ch/u/violin)\
**Post date:** [August 24, 2012, 1:54am UTC](https://root-forum.cern.ch/t/the-version-of-root-and-the-compatibility-with-the-python/14812/3 "2012-08-24T01:54:36Z")

</div>

[quote=“Pepe Le Pew”][url][Import ROOT error](https://root-forum.cern.ch/t/import-root-error/14636/1)  
[url][PyROOT and Ubuntu 12.04](https://root-forum.cern.ch/t/pyroot-and-ubuntu-12-04/14227/1)  
[url][Installation succeeds but root doesn’t start](https://root-forum.cern.ch/t/installation-succeeds-but-root-doesnt-start/14657/1)

Hi

I have installed root3.50,  
./configure --enable-python --prefix=/home/…/root5.30  
make  
make install  
Then I add “PATH=/home/…/root5.30:$PATH” in .bashrc.  
But it still doesn’t work now. I enter root -config --has-python. The result is no.

I installed python2.7.3 in my computer. I set the PATH in .bashrc.  
I dont know why root has no python.

Thanks for you help

Best withes  
violin

---

<div class="post-metadata">

**Author:** ![Pepe\_Le\_Pew](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pepe_le_pew/32/12365_2.png) [@Pepe\_Le\_Pew](https://root-forum.cern.ch/u/Pepe_Le_Pew)\
**Post date:** [August 24, 2012, 8:33am UTC](https://root-forum.cern.ch/t/the-version-of-root-and-the-compatibility-with-the-python/14812/4 "2012-08-24T08:33:58Z")

</div>

[http://root.cern.ch/download/doc/ROOTUsersGuideHTML/ch28s05.html](http://root.cern.ch/download/doc/ROOTUsersGuideHTML/ch28s05.html)  
[http://root.cern.ch/download/doc/ROOTUsersGuideHTML/ch19.html#d5e27343](http://root.cern.ch/download/doc/ROOTUsersGuideHTML/ch19.html#d5e27343)

---

<div class="post-metadata">

**Author:** ![violin](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/v/919ad9/32.png) [@violin](https://root-forum.cern.ch/u/violin)\
**Post date:** [August 25, 2012, 2:12pm UTC](https://root-forum.cern.ch/t/the-version-of-root-and-the-compatibility-with-the-python/14812/5 "2012-08-25T14:12:38Z")

</div>

[quote=“Pepe Le Pew”][http://root.cern.ch/download/doc/ROOTUsersGuideHTML/ch28s05.html](http://root.cern.ch/download/doc/ROOTUsersGuideHTML/ch28s05.html)  
[http://root.cern.ch/download/doc/ROOTUsersGuideHTML/ch19.html#d5e27343](http://root.cern.ch/download/doc/ROOTUsersGuideHTML/ch19.html#d5e27343)[/quote]

Hi：

I’m so sorry to waste your time. I am not good at the program.

I have installed ROOT, it can work. But I still have problem. When I entered “root-config --has-python” , the result is “no”. And I didn’t find [libpyroot.so](http://libpyroot.so) in root directory.  
Then I installed python2.7.3 again. But I didnt find $PYTHONPATH,$PYTHONDIR in .bashrc. And I entered  
"echo $PYTHONPATH "“echo $PYTHONDIR”, there is no result. I added $PYTHONPATH,$PYTHONDIR in .bashrc by myself:

export PYTHONDIR=/usr/local — the file has /bin and /lib (the lib have libpython2.7.a ,python2.7 , pkgconfig)  
export PATH=$ROOTSYS/bin:$PYTHONDIR/bin:$PATH  
export LD\_LIBRARY\_PATH=$ROOTSYS/lib:$PYTHONDIR/lib:$LD\_LIBRARY\_PATH

export PYTHONPATH=/usr/local/include/python2.7 ------ the file has many header files including python.h  
export PYTHONPATH=$ROOTSYS/bin:$PYTHONPATH

I installed root again. But I have the follow problem:

/usr/local/lib/libpython2.7.a(thread.o): In function `PyThread_start_new_thread': /usr/local/Python-2.7.3/Python/thread_pthread.h:193: undefined reference to`pthread\_create’  
/usr/local/Python-2.7.3/Python/thread\_pthread.h:209: undefined reference to `pthread_detach' /usr/local/Python-2.7.3/Python/thread_pthread.h:183: undefined reference to`pthread\_attr\_setstacksize’  
/usr/local/lib/libpython2.7.a(thread.o): In function `PyThread_allocate_lock': /usr/local/Python-2.7.3/Python/thread_pthread.h:268: undefined reference to`sem\_init’  
/usr/local/lib/libpython2.7.a(thread.o): In function `PyThread_free_lock': /usr/local/Python-2.7.3/Python/thread_pthread.h:292: undefined reference to`sem\_destroy’  
/usr/local/lib/libpython2.7.a(thread.o): In function `PyThread_acquire_lock': /usr/local/Python-2.7.3/Python/thread_pthread.h:323: undefined reference to`sem\_trywait’  
/usr/local/Python-2.7.3/Python/thread\_pthread.h:321: undefined reference to `sem_wait' /usr/local/lib/libpython2.7.a(thread.o): In function`PyThread\_release\_lock’:  
/usr/local/Python-2.7.3/Python/thread\_pthread.h:346: undefined reference to `sem_post' /usr/local/lib/libpython2.7.a(thread.o): In function`\_pythread\_pthread\_set\_stacksize’:  
/usr/local/Python-2.7.3/Python/thread\_pthread.h:491: undefined reference to `pthread_attr_setstacksize' /usr/local/lib/libpython2.7.a(posixmodule.o): In function`posix\_openpty’:  
/usr/local/Python-2.7.3/./Modules/posixmodule.c:3756: undefined reference to `openpty' /usr/local/lib/libpython2.7.a(posixmodule.o): In function`posix\_forkpty’:  
/usr/local/Python-2.7.3/./Modules/posixmodule.c:3816: undefined reference to `forkpty’  
collect2: ld back 1  
make: \*\*\* [lib/libPyROOT.so] error 1

I’m going crazy. I really dont know what to do.

Thank you very much.

Best wishes  
violin

---

<div class="post-metadata">

**Author:** ![Pepe\_Le\_Pew](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pepe_le_pew/32/12365_2.png) [@Pepe\_Le\_Pew](https://root-forum.cern.ch/u/Pepe_Le_Pew)\
**Post date:** [August 25, 2012, 5:08pm UTC](https://root-forum.cern.ch/t/the-version-of-root-and-the-compatibility-with-the-python/14812/6 "2012-08-25T17:08:40Z")

</div>

The name “/usr/local/lib/libpython2.7.a” (the archive library that is used) suggests that you do not have the python shared library installed (i.e. the corresponding “[libpython2.7.so](http://libpython2.7.so)” file is missing).  
If this is the case, you probably need to configure and build your python adding the “–enable-shared” flag.  
Then you need to configure and build your ROOT from scratch again also adding the “–enable-shared” flag.

---

<div class="post-metadata">

**Author:** ![violin](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/v/919ad9/32.png) [@violin](https://root-forum.cern.ch/u/violin)\
**Post date:** [August 27, 2012, 2:22am UTC](https://root-forum.cern.ch/t/the-version-of-root-and-the-compatibility-with-the-python/14812/7 "2012-08-27T02:22:16Z")

</div>

[quote=“Pepe Le Pew”]The name “/usr/local/lib/libpython2.7.a” (the archive library that is used) suggests that you do not have the python shared library installed (i.e. the corresponding “[libpython2.7.so](http://libpython2.7.so)” file is missing).  
If this is the case, you probably need to configure and build your python adding the “–enable-shared” flag.  
Then you need to configure and build your ROOT from scratch again also adding the “–enable-shared” flag.[/quote]

Thank you very much! I have succeed to install root with python. My problem is that I didn’t add the “–enable-shared” building my ROOT, though I installed the python adding the “–enable-shared”.  
Thanks for your time again

violin
