Print

Print


As a follow up, here's a Dockerfile where I've intentionally recreated the problem you describe, and then show how to get around it if you decided you need to install Python bindings globally with pip.

Dockerfile:
ARG BASE_IMAGE=gitlab-registry.cern.ch/linuxsupport/cc7-base:latest
FROM ${BASE_IMAGE} as base

SHELL [ "/bin/bash", "-c" ]

RUN yum update -y && \
    yum install -y \
        cmake3 \
        make \
        krb5-devel \
        libuuid-devel \
        libxml2-devel \
        openssl-devel \
        systemd-devel \
        zlib-devel \
        devtoolset-7-gcc-c++ \
        python3-devel \
        python3-setuptools \
        git \
        cppunit-devel && \
    yum clean all && \
    python3 -m pip install --no-cache-dir --upgrade pip setuptools wheel

RUN yum update -y && \
    yum install -y \
        xrootd-5.4.1 \
        xrootd-client-5.4.1 \
        python36-xrootd-5.4.1 && \
    yum clean all && \
    xrootd -v && \
    xrdcp --version && \
    python3 -m pip list && \
    python3 -m pip show xrootd  # 5.4.1

# The following would fail with the error:
#
# ERROR: Cannot uninstall 'xrootd'. It is a distutils installed project and thus we
# cannot accurately determine which files belong to it which would lead to only a
# partial uninstall.
#
# as you're asking pip to try to deal with something it didn't install.

# RUN . /opt/rh/devtoolset-7/enable && \
#     python3 -m pip install --upgrade --force-reinstall 'xrootd==5.4.2' && \
#     xrootd -v && \
#     xrdcp --version && \
#     python3 -m pip list && \
#     python3 -m pip show xrootd

# The solution is to uninstall the RPM package and _then_ to install things
# A better solution is to not be installing Python packages globally as pip
# warns us about:
#
# WARNING: Running pip as the 'root' user can result in broken permissions and
# conflicting behaviour with the system package manager. It is recommended to
# use a virtual environment instead: https://pip.pypa.io/warnings/venv
#
# and to instead either use an automatically activated virtual envrionment or to
# use pipx

RUN yum remove python36-xrootd -y && \
    . /opt/rh/devtoolset-7/enable && \
    python3 -m pip --verbose install \
        --upgrade \
        --force-reinstall \
        'xrootd==5.4.2' && \
    xrootd -v && \
    xrdcp --version && \
    python3 -m pip list && \
    python3 -m pip show xrootd && \
    python3 -c 'import XRootD; print(XRootD)' && \
    python3 -c 'import pyxrootd; print(pyxrootd)' && \
    python3 -c 'from XRootD import client; print(client.FileSystem("root://someserver:1094"))'

WORKDIR /

SHELL [ "/usr/bin/scl", "enable", "devtoolset-7", "/bin/bash", "-c"]

the commented out snippet

RUN . /opt/rh/devtoolset-7/enable && \
    python3 -m pip install --upgrade --force-reinstall 'xrootd==5.4.2' && \

snippet fails with your error:

ERROR: Cannot uninstall 'xrootd'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

The part that allows the build to succeed is the bit below where the rpm is first removed to avoid collisions like this that pip has no way of being able to solve

RUN yum remove python36-xrootd -y && \
    . /opt/rh/devtoolset-7/enable && \
    python3 -m pip --verbose install \
        --upgrade \
        --force-reinstall \
        'xrootd==5.4.2' && \
    ...

Does this all make sense?


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <xrootd/xrootd/issues/1641/1065815888@github.com>

[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/xrootd/xrootd/issues/1641#issuecomment-1065815888", "url": "https://github.com/xrootd/xrootd/issues/1641#issuecomment-1065815888", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

Use REPLY-ALL to reply to list

To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1