This looks like an environment setting problem. When you say “a new python3 file on Jupyterhub” you mean a notebook?
What I would do is look in the JupyterHub documentation and check how to specify environment variables for the kernels. Then you will need to add the same PYTHONPATH and LD_LIBRARY_PATH that thisroot.sh sets (the fact that you put it in .profile does not seem to have any effect over the kernels of JupyterHub).
placed into a file which I created and named environment.py placed in /opt/tljh/config/jupyterhub_config.d/ (root privileges requested).
By doing this, the correct PATH is imported into JupyterHub.
Then an additional issue appeared. The python kernel of the notebooks is by default set to py3.7, while I built ROOT with py3.6, so actually I’m not able to import ROOT from the notebook because of this incompatibility.
Additional suggestion are highly appreciated. In the meantime, thanks to @etejedor for the help!
I’m trying to achieve both options, starting from building ROOT with py3.7. I take the interpreter from the installation directory related to TLJH, in order to match the exact version. The message I get when I try to run
Citing this thread, I also tried to add the option -DPYTHON_LIBRARY=/opt/tljh/user/lib/python3.7/config-3.7m-x86_64-linux-gnu/libpython3.7m.a and I get the following message:
-- Detected ROOT_VERSION 6.22.99
-- Looking for Python
-- Found PythonLibs: /opt/tljh/user/lib/python3.7/config-3.7m-x86_64-linux-gnu/libpython3.7m.a (found version "3.6.9")
CMake Error at cmake/modules/SearchRootCoreDeps.cmake:230 (message):
Version mismatch between Python interpreter (3.7.3) and libraries (3.6.9).
ROOT cannot work with this configuration. Please specify only
PYTHON_EXECUTABLE to CMake with an absolute path to ensure matching
versions are found.
Call Stack (most recent call first):
-- Configuring incomplete, errors occurred!
See also "/home/ubuntu/builddir/CMakeFiles/CMakeOutput.log".
Moreover, no file of the type libpython3.7.so is present.
The file CMakeCache.txt complicated things a lot.
The PYTHON_EXECUTABLE was correct, but the CMakeCache.txt was an old version, not updated. After having eliminated it, everything worked.
Thanks again @etejedor for the help