# How to contribute to Root Code?

**URL:** <https://root-forum.cern.ch/t/how-to-contribute-to-root-code/46691>\
**Category:** Newbie\
**Created:** [September 6, 2021, 5:04am UTC](https://root-forum.cern.ch/t/how-to-contribute-to-root-code/46691 "2021-09-06T05:04:40Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sayandeep\_Ghosh](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/sayandeep_ghosh/32/29173_2.png) [@Sayandeep\_Ghosh](https://root-forum.cern.ch/u/Sayandeep_Ghosh)\
**Post date:** [September 6, 2021, 5:04am UTC](https://root-forum.cern.ch/t/how-to-contribute-to-root-code/46691/1 "2021-09-06T05:04:40Z")

</div>

Hi!, recently I have started learning about root and have also clone the official root repository after forking it in github to solve one good first issue. But when I tried to open it in Visual Studio Code I have installed the root extension and can view the root files but whenever I try to open any python file and try to run it is showing “No Module Named Root”. I have also installed root through Ubuntu, after enabling WSL. Can anyone help me as I have no experience in open source contribution before. My operating system is Windows. Should I try to add all the header files of root seperately(one by one) or there is any other way. Thanks in advance!

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [September 6, 2021, 6:28am UTC](https://root-forum.cern.ch/t/how-to-contribute-to-root-code/46691/2 "2021-09-06T06:28:40Z")

</div>

As you are working on windows I guess @bellenot can help.

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [September 6, 2021, 8:28am UTC](https://root-forum.cern.ch/t/how-to-contribute-to-root-code/46691/3 "2021-09-06T08:28:09Z")

</div>

Hi @Sayandeep_Ghosh ,  
if you get a `"no module named ROOT"` error when running `import ROOT` from Python in Ubuntu, it’s probably because the location of your ROOT installation is not in the `PYTHONPATH` environment variable.

Make sure to follow all steps of the installation instructions, e.g. if you installed a pre-compiled binary following the instructions here: [Installing ROOT - ROOT](https://root.cern/install/#download-a-pre-compiled-binary-distribution) , then step 4. is required to correctly set up `PYTHONPATH` and other environment variables.

Cheers,  
Enrico

---

<div class="post-metadata">

**Author:** ![Sayandeep\_Ghosh](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/sayandeep_ghosh/32/29173_2.png) [@Sayandeep\_Ghosh](https://root-forum.cern.ch/u/Sayandeep_Ghosh)\
**Post date:** [September 9, 2021, 3:41pm UTC](https://root-forum.cern.ch/t/how-to-contribute-to-root-code/46691/4 "2021-09-09T15:41:14Z")

</div>

Hi!, I have followed all the instructions again and I figured out my python development environment was missing. After installing it, updating it and sourcing all libraries by executing this command " ```  
source root/bin/thisroot.sh

```auto
Traceback (most recent call last):
  File "rf204_extrangefit.py", line 12, in <module>
    import ROOT
ImportError: No module named ROOT
Should I reinstall root again? Also I would like to know if jupyter notebook will work in this case since I am using Windows operating system. Thanks in advance!
```

---

<div class="post-metadata">

**Author:** ![jalopezg](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jalopezg/32/25844_2.png) [@jalopezg](https://root-forum.cern.ch/u/jalopezg)\
**Post date:** [September 9, 2021, 10:42pm UTC](https://root-forum.cern.ch/t/how-to-contribute-to-root-code/46691/5 "2021-09-09T22:42:48Z")

</div>

Hi @Sayandeep_Ghosh,

Could you please check that the `PATH` and `PYTHONPATH` environment variables are updated accordingly after sourcing `thisroot.sh`, e.g. by typing

```bash
$ echo $PYTHONPATH
$ echo $PATH

```

?

Also, is your Python interpreter running within WSL?

Cheers,  
J.

---

<div class="post-metadata">

**Author:** ![Sayandeep\_Ghosh](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/sayandeep_ghosh/32/29173_2.png) [@Sayandeep\_Ghosh](https://root-forum.cern.ch/u/Sayandeep_Ghosh)\
**Post date:** [September 10, 2021, 4:17am UTC](https://root-forum.cern.ch/t/how-to-contribute-to-root-code/46691/6 "2021-09-10T04:17:54Z")

</div>

Hi, after writing the command given by you I got a pretty large result e.g.

```auto
sayang@DESKTOP-IFS80HM:~$ echo $PYTHONPATH

sayang@DESKTOP-IFS80HM:~$ echo $PATH
/home/sayang/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.Ubuntu20.04onWindows_2004.2021.825.0_x64__79rhkp1fndgsc:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files/Intel/WiFi/bin/:/mnt/c/Program Files/Common Files/Intel/WirelessCommon/:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/Program Files/Java/jdk-11.0.4/bin:/mnt/c/Program Files (x86)/HP/Common/HPDestPlgIn/:/mnt/c/Program Files (x86)/Brackets/command:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Sayan_D/New folder/runtime/win64:/mnt/c/Sayan_D/New folder/bin:/mnt/c/Sayan_D/New folder/polyspace/bin:/mnt/c/Program Files (x86)/PuTTY/:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/Microsoft SQL Server/140/Tools/Binn/:/mnt/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/Binn/:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/Microsoft SQL Server/130/Tools/Binn/:/mnt/c/MinGW/bin:/mnt/c/Users/91704/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/91704/.dotnet/tools:/mnt/c/Users/91704/AppData/Local/Programs/Microsoft VS Code/bin:/snap/bin

```

And yes, my python interpreter is running within WSL

```auto
sayang@DESKTOP-IFS80HM:~$ which python3
/usr/bin/python3

```

Still I am getting import error.  
Thanks !

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [September 10, 2021, 7:09am UTC](https://root-forum.cern.ch/t/how-to-contribute-to-root-code/46691/7 "2021-09-10T07:09:08Z")

</div>

Hi,  
you still have an empty PYTHONPATH (see my comment above), so maybe you are not calling `source /path/to/your/root/installation/bin/thisroot.sh` ?

Cheers,  
Enrico

---

<div class="post-metadata">

**Author:** ![Sayandeep\_Ghosh](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/sayandeep_ghosh/32/29173_2.png) [@Sayandeep\_Ghosh](https://root-forum.cern.ch/u/Sayandeep_Ghosh)\
**Post date:** [September 10, 2021, 9:59am UTC](https://root-forum.cern.ch/t/how-to-contribute-to-root-code/46691/8 "2021-09-10T09:59:25Z")

</div>

Hi,  
Does that mean I should do this…  
sayang@DESKTOP-IFS80HM:~$ export PYTHONPATH=/home/sayang/root-6.24.04/bin/thisroot.sh

But import error is still coming …  
Thanks!

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [September 10, 2021, 10:12am UTC](https://root-forum.cern.ch/t/how-to-contribute-to-root-code/46691/9 "2021-09-10T10:12:17Z")

</div>

No, you really need to call `source /home/sayang/root-6.24.04/bin/thisroot.sh` as per point 4 of the instructions at /home/sayang/root-6.24.04 . That command sets all required environment variables for that shell session.

For the meaning of PYTHONPATH and what generally goes in there, see e.g. [python - What exactly should be set in PYTHONPATH? - Stack Overflow](https://stackoverflow.com/questions/7850908/what-exactly-should-be-set-in-pythonpath)

---

<div class="post-metadata">

**Author:** ![Sayandeep\_Ghosh](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/sayandeep_ghosh/32/29173_2.png) [@Sayandeep\_Ghosh](https://root-forum.cern.ch/u/Sayandeep_Ghosh)\
**Post date:** [September 11, 2021, 10:48am UTC](https://root-forum.cern.ch/t/how-to-contribute-to-root-code/46691/10 "2021-09-11T10:48:29Z")

</div>

I have read the link given by you and also followed a question related to pythonpath in the newbie section

> [@How to set PYTHONPATH when I obtain "Import ROOT error . No module found"](https://root-forum.cern.ch/t/how-to-set-pythonpath-when-i-obtain-import-root-error-no-module-found/39763/2):
>
> See if you have “pyroot” among: root-config --features In principle you should not set ROOT related environment variables manually. You should simply: source /full/path/to/your/root/bin/thisroot.sh

In the above question it has been told to export pythonpath in this way to avoid import error:  
export PYTHONPATH=$(root-config --libdir)

But even after doing this my import error is still coming and I have also called  
source /home/sayang/root-6.24.04/bin/thisroot.sh after exporting pythonpath based on the answer given in the above question. Thanks!

---

<div class="post-metadata">

**Author:** ![jalopezg](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jalopezg/32/25844_2.png) [@jalopezg](https://root-forum.cern.ch/u/jalopezg)\
**Post date:** [September 13, 2021, 7:28am UTC](https://root-forum.cern.ch/t/how-to-contribute-to-root-code/46691/11 "2021-09-13T07:28:09Z")

</div>

Hi @Sayandeep_Ghosh,

You have to make sure that ROOT was built with PyROOT support, i.e. check in the output of `root-config --features`. If you cannot find `pyroot` in the output, you should build ROOT specifying:

```bash
$ cmake -Dpyroot=ON ...

```

After enabling `pyroot`, as @eguiraud said, `thisroot.sh` should take care of setting `$PYTHONPATH`. Let us know if that’s not the case.

Cheers,  
J.

---

<div class="post-metadata">

**Author:** ![Sayandeep\_Ghosh](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/sayandeep_ghosh/32/29173_2.png) [@Sayandeep\_Ghosh](https://root-forum.cern.ch/u/Sayandeep_Ghosh)\
**Post date:** [September 13, 2021, 2:07pm UTC](https://root-forum.cern.ch/t/how-to-contribute-to-root-code/46691/12 "2021-09-13T14:07:17Z")

</div>

Hi @jalopezg ,  
Thanks a lot for your help. I just realized a huge mistake that I have made…

sayang@DESKTOP-IFS80HM:~$ root-config --features  
cxx14 asimage builtin\_afterimage builtin\_clang builtin\_cling builtin\_llvm builtin\_lz4 builtin\_lzma builtin\_nlohmannjson builtin\_openui5 builtin\_pcre builtin\_tbb builtin\_vdt builtin\_xrootd builtin\_xxhash builtin\_zstd clad dataframe exceptions gdml http imt mlp roofit webgui root7 runtime\_cxxmodules shared ssl tmva spectrum vdt x11 xrootd

sayang@DESKTOP-IFS80HM:~$ root-config --has-python  
no  
Although I have installed Python but still my python binding is missing in root-config --features. After seeing another one facing issue like me in this following link

> [@Import ROOT error](https://root-forum.cern.ch/t/import-root-error/14636):
>
> Hi, I’m getting a ImportError: No module named ROOT message when I try and run pyROOT, which is also happening in the python interactive mode. I’ve seen many a topic on this, but none of the solutions helped me with my problem. Here are my paths as defined in my bashrc: export ROOTSYS=/opt/root export LD\_LIBRARY\_PATH=$ROOTSYS/lib:$PYTHONDIR/lib:$LD\_LIBRARY\_PATH export PYTHONPATH=$ROOTSYS/lib:$PYTHONPATH export PATH=${PATH}:${ROOTSYS}/bin I’m running ROOT 5.34/01, Python 2.7.2+, GCC 4.6.1…

I realized that I need to rebuild root from scratch. Does that mean I should reinstall ROOT or there is any other way.  
Actually I followed this video to install root through WSL  
[Installing CERN ROOT in Windows with WSL - YouTube](https://www.youtube.com/watch?v=pmfM4Zq6OQU&t=587s)  
Thanks!

---

<div class="post-metadata">

**Author:** ![jalopezg](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jalopezg/32/25844_2.png) [@jalopezg](https://root-forum.cern.ch/u/jalopezg)\
**Post date:** [September 14, 2021, 11:04am UTC](https://root-forum.cern.ch/t/how-to-contribute-to-root-code/46691/13 "2021-09-14T11:04:20Z")

</div>

Hi @Sayandeep_Ghosh,

> [@Sayandeep\_Ghosh](#):
>
> I realized that I need to rebuild root from scratch. Does that mean I should reinstall ROOT or there is any other way.

Yes, if you installed ROOT building from sources, you need to rebuild (+ install) including PyROOT. To do so, be sure to include `-Dpyroot=ON` in the `cmake` command line, e.g.

```bash
$ cmake -Dpyroot=ON ...

```

Reusing the same build directory should (hopefully) work for an incremental build, which saves some compilation time.

Cheers,  
J.

---

<div class="post-metadata">

**Author:** ![Sayandeep\_Ghosh](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/sayandeep_ghosh/32/29173_2.png) [@Sayandeep\_Ghosh](https://root-forum.cern.ch/u/Sayandeep_Ghosh)\
**Post date:** [September 14, 2021, 2:05pm UTC](https://root-forum.cern.ch/t/how-to-contribute-to-root-code/46691/14 "2021-09-14T14:05:43Z")

</div>

Yes, if you installed ROOT building from sources, you need to rebuild (+ install) including PyROOT. To do so, be sure to include `-Dpyroot=ON` in the `cmake` command line, e.g.

No , I haven’t build from the sources from github. Is there any way to include python bindings or pyroot root-config --features by providing any one or two line command in wsl ubuntu terminal?  
I actually followed this video to install root which doesn’t include installing pyroot and python

[![](https://img.youtube.com/vi/pmfM4Zq6OQU/maxresdefault.jpg "Installing CERN ROOT in Windows with WSL") ](https://www.youtube.com/watch?v=pmfM4Zq6OQU)

Please help! I have been stuck here for months…

---

<div class="post-metadata">

**Author:** ![jalopezg](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jalopezg/32/25844_2.png) [@jalopezg](https://root-forum.cern.ch/u/jalopezg)\
**Post date:** [September 15, 2021, 8:50am UTC](https://root-forum.cern.ch/t/how-to-contribute-to-root-code/46691/15 "2021-09-15T08:50:29Z")

</div>

Hi @Sayandeep_Ghosh,

> [@Sayandeep\_Ghosh](#):
>
> I actually followed this video to install root which doesn’t include installing pyroot and python

What is shown in the video is how to build and install ROOT from sources. Typically, this is for advanced users only (or for some specific cases). The recommended way of installing ROOT is either through package managers or Conda, as seen in the [Installation guide](https://root.cern/install/).

That said, now that you already built succesfully ROOT from sources, I would recommend to perform the following steps from the `buildroot/` directory:

```bash
$ cmake -Dpyroot=ON ../
$ make -j4
$ make install

```

Cheers,  
J.

---

<div class="post-metadata">

**Author:** ![Sayandeep\_Ghosh](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/sayandeep_ghosh/32/29173_2.png) [@Sayandeep\_Ghosh](https://root-forum.cern.ch/u/Sayandeep_Ghosh)\
**Post date:** [September 15, 2021, 11:34am UTC](https://root-forum.cern.ch/t/how-to-contribute-to-root-code/46691/16 "2021-09-15T11:34:36Z")

</div>

Hi @jalopezg ,  
I have followed the steps successfully as told by you. Still after writing root-config --features it is not showing Python or PyRoot. Is there any one or two line command to include python in root-config --features?

ImportError: Failed to import libcppyy2\_7. Please check that ROOT has been built for Python 2.7

All the .C files are running successfully but whenever I try to compile .py files for e.g rf204\_extrangefit.py it is showing the import error but now its not showing “No module names ROOT”. Thanks for your help again! its started to work properly but still not able to run .py files in tutorials/roofit.

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [September 15, 2021, 11:50am UTC](https://root-forum.cern.ch/t/how-to-contribute-to-root-code/46691/17 "2021-09-15T11:50:45Z")

</div>

`sudo apt-get install python3-dev python2-dev`

---

<div class="post-metadata">

**Author:** ![Sayandeep\_Ghosh](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/sayandeep_ghosh/32/29173_2.png) [@Sayandeep\_Ghosh](https://root-forum.cern.ch/u/Sayandeep_Ghosh)\
**Post date:** [September 15, 2021, 1:07pm UTC](https://root-forum.cern.ch/t/how-to-contribute-to-root-code/46691/18 "2021-09-15T13:07:02Z")

</div>

Thanks, pyroot is now present in root -config–features but not python. Also I would like to know whether I can solve this error after including Python 2.7 in root -config–features

ImportError: Failed to import libcppyy2\_7. Please check that ROOT has been built for Python 2.7

Thanks!

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [September 15, 2021, 1:56pm UTC](https://root-forum.cern.ch/t/how-to-contribute-to-root-code/46691/19 "2021-09-15T13:56:14Z")

</div>

> [@Python: No module named 'root'](https://root-forum.cern.ch/t/python-no-module-named-root/43589/2):
>
> root-config --has-pyroot # "pyroot" in ROOT 6 was "python" in ROOT 5 BTW. Regardless of the version, the python’s module is named “ROOT”, not “root”.

> [@Python: No module named 'root'](https://root-forum.cern.ch/t/python-no-module-named-root/43589/5):
>
> You MUST use EXACTLY the same Python version (and the same compiler) that your ROOT binaries were built for (otherwise, expect mysterious crashes anywhere, anytime): root-config --python-version # C/C++ calling python ; root-config --python2-version # python 2 calling C/C++ ; root-config --python3-version # python 3 calling C/C++ ; BTW. Remember to “source /the/location/of/ROOT/bin/thisroot.sh” to add your ROOT executables and libraries to your environment (when ROOT is not installed in some “…

---

<div class="post-metadata">

**Author:** ![Sayandeep\_Ghosh](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/sayandeep_ghosh/32/29173_2.png) [@Sayandeep\_Ghosh](https://root-forum.cern.ch/u/Sayandeep_Ghosh)\
**Post date:** [September 16, 2021, 2:59pm UTC](https://root-forum.cern.ch/t/how-to-contribute-to-root-code/46691/20 "2021-09-16T14:59:46Z")

</div>

Hi @Wile_E_Coyote ,  
I am using the same python version as it is in my root binaries which were built and pyroot is also present.(3.8.10 in ROOT 6).  
In spite of all this I got this error when running

sayang@DESKTOP-IFS80HM:~/root-6.24.04/tutorials/roofit$ python rf204\_extrangefit.py

ImportError: Failed to import libcppyy2\_7. Please check that ROOT has been built for Python 2.7

[Next page](https://root-forum.cern.ch/t/how-to-contribute-to-root-code/46691.md?page=2)
