The issue you encountered with conda is that it installs XRootD in its own environment, which isn't accessible to Colab's default Python interpreter.
Solution: Install via pip
The most reliable method is to use pip with the xrootd package (lowercase):
python
!pip install xrootd
After installation, import it using:
python
from XRootD import client
from XRootD.client.flags import DirListFlags, OpenFlags, MkDirFlags, QueryCode
Alternative: System Package + pip
If you need the full XRootD client tools, you can install both system packages and Python bindings:
bash
# Install system dependencies
!apt-get update
!apt-get install -y xrootd-client xrootd-client-libs
# Install Python bindings
!pip install xrootd
Verification
To verify the installation:
python
import XRootD
print(XRootD._version_)
# Test basic functionality
from XRootD import client
myclient = client.FileSystem("root://someserver.example.com")
Why conda didn't work
Conda creates isolated environments, and in Google Colab, the conda-installed packages aren't automatically available to Colab's default Python kernel. Using pip installs directly into Colab's Python environment, avoiding this issue.
Note: Make sure to use uppercase XRootD when importing, even though the pip package name is lowercase xrootd.