Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

How to import ROOT #28

Closed
LovelyBuggies opened this issue Mar 23, 2020 · 5 comments
Closed

How to import ROOT #28

LovelyBuggies opened this issue Mar 23, 2020 · 5 comments

Comments

@LovelyBuggies
Copy link
Collaborator

I tried pip install ROOT and cannot find ROOT wheel. How can I install Python ROOT?

@jpivarski
Copy link
Member

conda install -c conda-forge root

ROOT is a large binary; it's not likely that it will ever be available on PyPI. (I have the PyPI name registered in case it ever becomes possible, but it's not likely.)

@LovelyBuggies
Copy link
Collaborator Author

LovelyBuggies commented Mar 24, 2020

@jpivarski Thx, but still a problem here.

I cannot use this command conda install -c conda-forge root directly in a Python3 venv. I have all other packages listed in requirements.txt and install them in my virtual environment to set up my dev env now. I wonder if there is a good way to install ROOT just like this.

Log:

(.env) NinodeMacBook-Pro:Nino-hist nino$ conda install -c conda-forge root
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: - failed with initial frozen solve. Retrying with flexible solve.

CondaError: KeyboardInterrupt

@jpivarski
Copy link
Member

Conda environments are their own virtual environments. If you just need isolation, you can conda create, but if you need it to specifically be a Python 3 venv, then you might be out of luck. Python venv might be limited to Python packaging, but the vast majority of ROOT is not Python and not easily packaged within Python's directory structures.

@LovelyBuggies
Copy link
Collaborator Author

LovelyBuggies commented Mar 24, 2020

Thanks. We might need to change our developing method.
However, whether the new version aghast will do some improvements on this feature, in order to better facilitate development in Python venv (it looks like we have to use conda if we want to import ROOT now)?

@jpivarski
Copy link
Member

ROOT is not a requirement for hist or aghast, and that's something that won't change when aghast becomes based on jagged arrays. (Be sure to keep in mind that that update is many months in the future.)

Some of the histogram types that aghast converts to and from are ROOT histograms; when converting from ROOT histograms, the user has already imported ROOT somehow—we don't care how—and when converting to ROOT histograms, we have to import ROOT internally in that function. If it fails with ImportError, we give an error message asking the user to install ROOT and provide some hints about how to do that.

How users install ROOT is their own business, and there are many ways. Conda is a new one, which plays well with the Python ecosystem because it can manage Python package versions in the same optimization as the ROOT version. Pip probably won't be one because ROOT extends so far beyond the expectations of what a Python package looks like. (It puts constraints on which C++ compiler you use for projects that use ROOT—things like that.) Most of the users who want to convert histograms into and out of PyROOT objects already have ROOT installed. In fact, it's not uncommon for physicists to have several versions of ROOT installed, some of which were compiled manually to get some feature.

So this is why our use of ROOT doesn't imply any changes in whether hist or aghast uses venv, pip, or other Python standards. It should be thought of as a big thing on the border, not a small package to absorb into the stack.

As a testing dependency, we can absorb it into the testing stack with conda, but that means that any projects with ROOT in their tests have to install testing dependencies with conda (uproot did that, for instance).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants