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
Poetry overwrites existing conda packages even if versions match #6408
Comments
This is likely because Conda does not conform to PEP 610 and write the origin URL to the package install directory. Poetry 1.2 is PEP 610 compliant and will not consider a package to be equivalent unless it comes from the same source (as determined by the PEP 610 record). |
@neersighted thank you for explaining! Do you think there are any workarounds for this or will this workflow remain unsupported? |
I don't think there are any workarounds -- Poetry expects to be the sole manager of the environment and will act like it. From a practical standpoint, Poetry is correct in the packages not being 100% the same as defined by your lockfile, as well... Is there a reason your workflow requires mixing packages installed by Conda and Poetry? In the long run if Conda supports PEP 610 (and uses the same origins as Poetry) this will become 'supported' again, but I don't think it will ever by anything but happy chance, unless there's a compelling reason many users would benefit from this mixed workflow in Poetry itself. |
I don't think poetry would write or expect to see a direct_url.json for a package that it installs from pypi. I think the explanation in this thread is likely essentially right but it's sort of the opposite : conda does write |
The reason we have this setup is that on M1 Macs some packages are not available on PyPi and the only way to install them is via conda. In our case, we use poetry to solely manage the whole environment on Linux, but for the folks that have an M1 machine, we were using conda + poetry as a workaround. |
Oh, fair point -- I forget that we don't write |
@dpp23 Depending on how Conda authentication works (if it's even necessary for these packages), you could actually use a platform constraint for a direct URL dependency on Macs, using the URL taken from the conda-written |
I experimented in the docker container eg {"dir_info": {}, "url": "file:///tmp/build/80754af9/lightgbm_1633019183505/work"} I'm not familiar with the conda ecosystem at all but this feels like a bug at their end, delivering these files is surely an accident Maybe you can try reporting this to them |
Interesting -- looks like those are artifacts of their build backend and this is a Conda issue after all. I'm going to close this issue since it's now clear that if Conda didn't deliver these files, things would work as @dpp23 expects. That being said, feel free to report back here if Conda resolves the junk artifact issue, for posterity's sake. |
Thank you @neersighted and @dimbleby for the quick responses! I've resolves this for now with a |
For others who wish to try this fix, put the The correct command is |
We're having the same problem. As I understand, Poetry considers conda package to have different version than the one it finds on PyPI. However, how does it determine if the current version needs to be upgraded? Would there be a way to tell Poetry that the conda version is higher than the PyPI one? |
I'm seeing an issue that I think might be related to this and I'd welcome some other perspectives. I'm seeing intermittent CI issues that seem to be due to missing files when reinstalling packages previously installed by conda. I don't see this issue when I use the workaround of removing all the direct_url.json files.
My understanding is that poetry should be able to install packages concurrently, but is it possible that it doesn't realize that it needs to serialize these reinstalls, perhaps because it thinks it already has the correct version installed? |
I just encountered the same issue...
The fact is removing the direct_url.json from my conda solved the poetry install hang. here are the versions I use :
I have different execution environments, some are on linux ubuntu 22.04 laptops / desktops, macOS laptops, all using docker. What I do not understand is that the previous version ( before removing direct_urls .. ) of my python app dockerfile ( ubuntu 22.04 image + conda install ) -> perfectly worked - on ubuntu desktop or server, it also worked on ubuntu VMs under proxmox, What other reason for docker build not being reproducible ? What the difference in building docker between 22.04 lxc image and 22.04 iso image ? By the way, thank you, this thread saved my day ! |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
-vvv
option).Issue
If running inside a conda environment, poetry 1.1.* is happy to use the conda packages if their versions matches, however this is not the case with poetry 1.2 which re-installs them.
This is problematic in the case of packages that are not easy to install from
pip
on Mac M1, likelightgbm
As you can see in the reproduction steps,
poetry
saysUpdating lightgbm (3.3.2 /Users/runner/miniforge3/conda-bld/lightgbm_1641600116991/work -> 3.3.2)
so the version patches, but poetry decides to re-install it anyway.reproduction steps:
The text was updated successfully, but these errors were encountered: