'pyROOT in virtualenv
I want to use pyROOT
in a virtualenv
, I have ROOT installed on my system, when outside the virtualenv
I can do import ROOT
and it works, but inside a virtualenv
doing an import ROOT
gives the following error:
ModuleNotFoundError: No module named 'ROOT'
How do I add ROOT in there?
Thanks in advance.
Solution 1:[1]
You'll need to install root within the virtual environment too. Run a pip install
command after activating the environment.
Solution 2:[2]
Like many Python packages, support for the ROOT framework in Python exists as two parts...a C++ framework, and a Python binding around that framework. In this case, both the C++ framework and the Python binding are provided by the same group and so are discussed together on the same web site. https://root.cern is the home page for the framework, and https://root.cern/manual/python is the Python module page.
The C++ framework should be installed first. How that is done will vary by platform. Then, the Python module should be installed into each Python version and/or virtual environment in which one wishes to use the ROOT framework, via the command:
pip install pyroot
Say you have a virtualenv in the directory ~/envs/myenv
. You'd then want to do:
source ~/envs/myenv/bin/activate
pip install pyroot
Solution 3:[3]
Install pyroot. try "pyroot file.py" instead of "python file.py"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | CryptoFool |
Solution 2 | CryptoFool |
Solution 3 | Anjitha J M |