iterative/dvc

pip3 install dvc: uninstalls cryptography

playertr opened this issue · 1 comments

Bug Report

Description

On Ubuntu focal systems that have the python3-openssl package installed via apt, running pip3 install dvc uninstalls the cryptography package, which breaks pip.

This error has caused my team some grief because it is tough to reinstall pip and retain other packages installed on a system. I haven't been able to narrow this bug down to a single improperly-specified DVC dependency yet. I'm willing to contribute a PR but figured I'd file a bug report for more insight from the (greatly appreciated) maintainers.

Reproduce

To reproduce this error, you can build this Dockerfile that fails on the last line. I built the Dockerfile with docker build . -f dvc.Dockerfile -t dvctest .

FROM ubuntu:focal@sha256:48c35f3de33487442af224ed4aabac19fd9bfbd91ee90e9471d412706b20ba73
RUN apt-get update && \
    apt-get install -y python3-pip
RUN apt-get install -y python3-openssl
RUN pip3 install dvc
RUN pip3 install numpy 
# AttributeError: module 'lib' has no attribute 'X509_V_FLAG_NOTIFY_POLICY'

Expected

I would expect the final pip install command to succeed, leading to the image being successfully built. Instead, I get the AttributeError above. (See full docker build output in attached out.txt).

Environment information

Output of dvc doctor:

$ dvc doctor
DVC version: 3.42.0 (pip)
-------------------------
Platform: Python 3.8.10 on Linux-6.0.12-76060012-generic-x86_64-with-glibc2.29
Subprojects:
        dvc_data = 3.8.0
        dvc_objects = 3.0.6
        dvc_render = 1.0.1
        dvc_task = 0.4.0
        scmrepo = 2.0.4
Supports:
        http (aiohttp = 3.9.3, aiohttp-retry = 2.8.3),
        https (aiohttp = 3.9.3, aiohttp-retry = 2.8.3)
Config:
        Global: /root/.config/dvc
        System: /etc/xdg/dvc

Here's your problem.

#7 35.12   Attempting uninstall: cryptography
#7 35.12     Found existing installation: cryptography 2.8
#7 35.12     Not uninstalling cryptography at /usr/lib/python3/dist-packages, outside environment /usr
#7 35.12     Can't uninstall 'cryptography'. No files were found to uninstall.

You are installing an older version of cryptography with python3-openssl, but some dependency of dvc require new version.
Try adding sudo pip3 uninstall cryptography before installing dvc and see? Or, install a latest version of python3-opensslthroughpip`.

There's nothing to do on dvc side. Closing.