Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an argument for ignore_installed #2123

Open
antony-frolov opened this issue Aug 27, 2024 · 1 comment
Open

Add an argument for ignore_installed #2123

antony-frolov opened this issue Aug 27, 2024 · 1 comment

Comments

@antony-frolov
Copy link

antony-frolov commented Aug 27, 2024

What's the problem this feature will solve?

I'm trying to lock my dependencies for a docker image build. I've got a package already installed in my base image which is not present in any package index, so I need the dependency resolver to consider installed packages.

My setup seems to be similar to #1596

Describe the solution you'd like

I've found that BacktrackingResolver has an option ignore_installed to consider (or ignore) installed packages and that seems to be the solution, pip-compile works fine for me if I set ignore_installed to False here.

That would really help managing dependencies when some packages in a docker build are inherited from a base image.

@antony-frolov
Copy link
Author

antony-frolov commented Aug 27, 2024

Here's an example of what I'm trying to do

docker run --rm nvcr.io/nvidia/pytorch:24.02-py3 bash -c '
    git clone https://github.com/jazzband/pip-tools.git \
    && pip install ./pip-tools \
    && echo torch==2.3.0a0+ebedce2 > constraints.txt \
    && echo timm > requirements.in \
    && pip-compile -c constraints.txt requirements.in
'

this runs a container with torch==2.3.0a0+ebedce2 pre-installed and I'm trying to add timm on top of an existing environment. This fails because there's no torch==2.3.0a0+ebedce2 in any index.

If ingore_installed is set to False in resolve.py it seems to work fine

docker run --rm nvcr.io/nvidia/pytorch:24.02-py3 bash -c '                        ─╯
    git clone https://github.com/jazzband/pip-tools.git \
    && sed -i 's/ignore_installed=True/ignore_installed=False/g' pip-tools/piptools/resolver.py \
    && pip install ./pip-tools \
    && echo torch==2.3.0a0+ebedce2 > constraints.txt \
    && echo timm > requirements.in \
    && pip-compile -c constraints.txt requirements.in
'

@WhyNotHugo WhyNotHugo changed the title Add an argument for ingore_installed Add an argument for ignore_installed Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant