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

How does pipx resolve conflicting subdependencies when using inject option #1577

Open
maxkoretskyi opened this issue Nov 14, 2024 · 6 comments

Comments

@maxkoretskyi
Copy link

maxkoretskyi commented Nov 14, 2024

Suppose I have a library kywy v1 that defines the dependency on numpy==1.26.4. Then I have a kywy-server app v5 that depends on kywy==1 and the matching numpy==1.26.4. When I

pipx install kywy-server==5

all is good and I can run $ kywy-server.

Now, I update the kywy version to v2 and change the dependency to numpy==2.1.3. It's now different to numpy==1.26.4 used by kywy-server. Then I want to inject this new kywy v2 into the kywy-server:

pipx inject kywy-server kywy==2

which would result into a collition of subdependencies: kywy==2 requires numpy==2.1.3, but kywy-server==5 which hasn't changed still requires numpy==1.26.4. Pip would result into a subdeps conflict and won't resolve this automatically.

I'm wondering how pipx handles it?

@dukecat0
Copy link
Member

As you injected both of them into the same virtual environment, it is very likely that the same issue will occur here. I would recommend you to install these two versions separately instead of injecting both of them in the same venv.

@maxkoretskyi
Copy link
Author

thanks for the reply! so basically pipx under the hood uses pip, sort of pipx runpip in a particular venv, correct?

@dukecat0
Copy link
Member

Yes exactly!

@maxkoretskyi
Copy link
Author

thanks, got it, just to clarify, I could do the same as pipx inject myapp newdep==3 with pipx runpip myapp newdep==3 ?

@dukecat0
Copy link
Member

dukecat0 commented Nov 17, 2024

Yes, except that newdep==3 will not be recorded in pipx metadata if you use runpip, which means it will not be upgraded if you run pipx upgrade myapp --include-injected.

@maxkoretskyi
Copy link
Author

got it, appreciate your help!

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

2 participants