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

PyPI only dependencies should always come from PyPI #2238

Open
2 tasks done
ruben-arts opened this issue Oct 9, 2024 · 3 comments
Open
2 tasks done

PyPI only dependencies should always come from PyPI #2238

ruben-arts opened this issue Oct 9, 2024 · 3 comments
Labels
🐞 bug Something isn't working 🐍 pypi Issue related to PyPI dependencies

Comments

@ruben-arts
Copy link
Contributor

Checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pixi, using pixi --version.

Reproducible example

Setup a project, add and install conda deps, then replace one conda dep with pypi dep.

pixi init test
cd test
pixi add python flask
pixi add --pypi flask
pixi remove flask --no-lockfile-update # Or remove by hand
pixi install

This should have resulted in a pypi package for flask but there are no pypi dependencies found.

❯ pixi list
Package             Version    Build               Size       Kind   Source
...
flask               3.0.3      pyhd8ed1ab_0        78.9 KiB   conda  flask-3.0.3-pyhd8ed1ab_0.conda
...

Issue description

We normally want this behavior if a package is both defined as a conda dependency and a pypi dependency. But since our logic for the satisfiability also checks the locked conda packages against the pypi requirements these packages stay.

The crux is this part of the satisfiability function:

if !identifier.satisfies(&requirement) {
// The record does not match the spec, the lock-file is inconsistent.
return Err(PlatformUnsat::CondaUnsatisfiableRequirement(
Box::new(requirement.clone()),
source.into_owned(),
));
}
FoundPackage::Conda(*repodata_idx)

Because the (conda_locked_package) identifier satisfies the pypi requirement this function continues and adds the package as a FoundPackage::Conda() which should be only correct if there was already a conda package asking for this.

Expected behavior

I expect the same behavior as when you rm pixi.lock and then pixi install, that flask is a pypi package.

❯ pixi list
Package           Version    Build               Size       Kind   Source
...
flask             3.0.3                          329.2 KiB  pypi   flask-3.0.3-py3-none-any.http.whl
...
@skayred
Copy link

skayred commented Oct 15, 2024

Hello,

We are hitting the same issue with Numpy package. Is there any known workaround with the current latest version?

@ruben-arts
Copy link
Contributor Author

@skayred The trick would be to remove conda version from the lock-file by hand. Which invalidates the lock-file, and should reproduce the correct lock-file. It's a one time thing while you move from conda to pypi so it should reappear.

That said why would you want numpy from pypi? #curious 😄

@ruben-arts ruben-arts added the 🐍 pypi Issue related to PyPI dependencies label Oct 16, 2024
@skayred
Copy link

skayred commented Oct 16, 2024

@ruben-arts thanks, I will try that! For the numpy - it seems that there is some issue with numpy and PyInstaller combo on Windows, although I am not 100% sure it happens because of conda-based numpy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 🐍 pypi Issue related to PyPI dependencies
Projects
None yet
Development

No branches or pull requests

2 participants