You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pixi install installs all environments in multi env setting when pypi-dependency is used #1046
I assume this always happens, regardless of the type of requirement. This is expected behavior because all environments have pypi-dependencies (inherited from the default feature). To be able to solve these pypi environments we need to install a python interpreter, this is done by first only installing the conda packages into their target prefixes.
Hmm, i guess this makes sense... But i still don't like this behavior as this will fill up your drive quite fast if you have a large number of environments that you want to test against 😅
In polarify this totals to 3.6 GB being used while the default environment (which is used in 99% of local development use cases) is only 309 MB large.
I planned on using
changed the title [-]`pixi install` installs all environment in multi env setting when pypi-dependency with `path` is used[/-][+]`pixi install` installs all environment in multi env setting when `pypi-dependency` is used[/+]on Mar 22, 2024
changed the title [-]`pixi install` installs all environment in multi env setting when `pypi-dependency` is used[/-][+]`pixi install` installs all environments in multi env setting when `pypi-dependency` is used[/+]on Mar 22, 2024
Ah I see your use case. The problem is that to determine the dependencies of your path based project we need python to execute the build backend. Since you have environments with different python versions, the only way to reliably lock this is to invoke python.
The only thing I can think of is that we dont need all conda dependencies to run python. However, some of them might be used by the build backend so its also not really clear which dependencies we can skip during this step..
it's probably not possible to let the pypi dependencies be evaluated by pixi because the build backend could theoretically do arbitrary stuff?
At least in polarify, the pyproject.toml doesn't contain anything that's not already in pixi.toml.
The problem is that to determine the dependencies of your path based project we need python to execute the build backend.
Not sure if this is a good idea or not: how about creating a hash of pyproject.toml, setup.py and setup.cfg and if nothing changes don't try to re-resolve the lockfile and thus not download all envs?
The problem is that to determine the dependencies of your path based project we need python to execute the build backend
Actually, how are you handling other platforms?
On macOS for example, i cannot install a linux python (because of ncurses). How is the lockfile resolved for other platforms in this case?
The problem is that to determine the dependencies of your path based project we need python to execute the build backend
Actually, how are you handling other platforms? On macOS for example, i cannot install a linux python (because of ncurses). How is the lockfile resolved for other platforms in this case?
Also note that the python interpreter is used for source dependencies and for the resolving we only care about the metadata. It is now kind of assumed that once created, this metadata is static across platforms. There are examples where this is not the case, at least thats what I gather from reading python threads. With https://peps.python.org/pep-0643/ we can actually check if the METADATA is static.
But I don't know if it will change the behavior much, as there is a lot of old packages, that don't have this. But going onwards from this it will help us avoid having to have the python executable at some point. UV guys helped merge this in warehouse recently.
I'd like to mention this issue is accentuated if one uses a pyproject.toml file as pixi manifest, due to the automatic injection of the Python project's dependencies as pypi-dependencies on the default environment.
Activity
baszalmstra commentedon Mar 22, 2024
I assume this always happens, regardless of the type of requirement. This is expected behavior because all environments have pypi-dependencies (inherited from the default feature). To be able to solve these pypi environments we need to install a python interpreter, this is done by first only installing the conda packages into their target prefixes.
pavelzw commentedon Mar 22, 2024
Hmm, i guess this makes sense... But i still don't like this behavior as this will fill up your drive quite fast if you have a large number of environments that you want to test against 😅
In polarify this totals to
3.6 GBbeing used while the default environment (which is used in 99% of local development use cases) is only309 MBlarge.I planned on using
to fix #524 but it's annoying that this requires all environments to be actually installed...
[-]`pixi install` installs all environment in multi env setting when pypi-dependency with `path` is used[/-][+]`pixi install` installs all environment in multi env setting when `pypi-dependency` is used[/+]pavelzw commentedon Mar 22, 2024
Do you have envisioned another approach to get rid of
pixi run postinstallthat doesn't require all envs being installed?[-]`pixi install` installs all environment in multi env setting when `pypi-dependency` is used[/-][+]`pixi install` installs all environments in multi env setting when `pypi-dependency` is used[/+]baszalmstra commentedon Mar 22, 2024
Ah I see your use case. The problem is that to determine the dependencies of your path based project we need python to execute the build backend. Since you have environments with different python versions, the only way to reliably lock this is to invoke python.
The only thing I can think of is that we dont need all conda dependencies to run python. However, some of them might be used by the build backend so its also not really clear which dependencies we can skip during this step..
pavelzw commentedon Mar 22, 2024
it's probably not possible to let the pypi dependencies be evaluated by pixi because the build backend could theoretically do arbitrary stuff?
At least in polarify, the
pyproject.tomldoesn't contain anything that's not already inpixi.toml.Not sure what other shenanigans hatchling supports.
pavelzw commentedon Mar 25, 2024
Not sure if this is a good idea or not: how about creating a hash of pyproject.toml, setup.py and setup.cfg and if nothing changes don't try to re-resolve the lockfile and thus not download all envs?
baszalmstra commentedon Mar 25, 2024
Well the same goes for any source based dependencies (there are still a lot of them).
But we are indeed planning to lock the path based dependency based on the hash of the pyproject.
pavelzw commentedon Mar 27, 2024
Actually, how are you handling other platforms?
On macOS for example, i cannot install a linux python (because of ncurses). How is the lockfile resolved for other platforms in this case?
ruben-arts commentedon Mar 27, 2024
Pixi uses the current platforms python to do the solving. If that is not available you get this issue: #1051
tdejager commentedon Mar 28, 2024
Also note that the python interpreter is used for source dependencies and for the resolving we only care about the metadata. It is now kind of assumed that once created, this metadata is static across platforms. There are examples where this is not the case, at least thats what I gather from reading python threads. With https://peps.python.org/pep-0643/ we can actually check if the METADATA is static.
But I don't know if it will change the behavior much, as there is a lot of old packages, that don't have this. But going onwards from this it will help us avoid having to have the python executable at some point. UV guys helped merge this in warehouse recently.
anjos commentedon Apr 5, 2024
I'd like to mention this issue is accentuated if one uses a
pyproject.tomlfile as pixi manifest, due to the automatic injection of the Python project's dependencies aspypi-dependencieson the default environment.ruben-arts commentedon Apr 29, 2024
For documentation purpose: @anjos The auto injection is a helper. You are allowed to move it to a feature. e.g.
Your comment still holds, just want to get this out there for users that find this issue.
anjos commentedon May 1, 2024
Thank you, @ruben-arts - that is what we ended up doing for now.
baszalmstra commentedon May 27, 2026
I can no longer reproduce this with pixi 0.69.0. Closing, feel free to reopen if I missed something!