-
Notifications
You must be signed in to change notification settings - Fork 103
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
Vendored poetry monkeypatches subprocess.run and Popen #400
Comments
Hi @AlbertDeFusco, thanks so much for the report! I was confused at first since the monkeypatch you describe is within the I agree that revendoring Poetry would help. I hope to get around to this soon. |
@maresb, @AlbertDeFusco, I am experiencing the same problem, which is biting quite hard The issue is indeed related to the vendored Poetry, which has dropped most of Below a reproducible example of the behavior to help clarifying when this bites. In a nutshell, on Python 3.9 and 3.10 the presence of setuptool-scm and corresponding configuration (even empty) in pyproject.toml causes the issue, triggered by the vendored poetry. And this is completely unrelated to running conda-lock and making explicit usage of pyproject.toml as a source of dependencies. Any plan to update the vendored poetry? Or any quick workaround/fix to address the problem? We are planning to transition a large set of projects to conda-lock 2x from conda-lock1.0.5 and this is a major blocker. Python 3.9 mamba create -n conda-lock-test python=3.9 conda-lock setuptools-scm -c conda-forge --override-channels
conda activate conda-lock-test
mkdir conda-lock-test
cd conda-lock-test
git init
# all good so far
conda-lock --version
### conda-lock, version 2.1.0
echo "[tool.setuptools_scm]" > pyproject.toml
### TypeError: __init__() got an unexpected keyword argument 'capture_output'
# the actuall occurs at import time
python -c "import conda_lock"
### TypeError: Popen.__init__() got an unexpected keyword argument 'capture_output' Note that an empty Python 3.10 Same behavior Python 3.11 No issues |
If this helps: Poetry 1.2 should be enough for this, since python-poetry/poetry#3405 was included starting from 1.2.0a1 |
Yes, sorry about this. I have been meaning to do this for quite some time, and it's very high on my todo list. I'm hoping to get to it this weekend, but I can't promise anything. |
Thanks @maresb, much appreciated, and if there is anything I can help with, especially around testing, let me know! |
@maresb, would you have a realistic timeline for revendoring poetry and releasing a new conda-lock version? Not trying to put pressure on you, but rather to manage internally expectations around a timeline for the adoption of conda-lock 2.x. |
I'll try again this weekend, but since something might come up, better to assume that I'll get it by the subsequent weekend with about p=75%. |
I'm also getting hit by this, exactly as @riccardoporreca described. |
Hi @maresb, this still seems to be an issue. Are we planning to update the vendored Poetry anytime soon? |
Thanks for the reminder. This is still on my radar, and I would like very much to do the update soon, but it requires a big block of time that's very difficult for me to allocate at the moment. 😞 |
@maresb, let me know if there is anything I can help with: I understand this is quite delicate and time consuming, but if there is even some preparatory work we can help with, happy to support! |
Hi @maresb, just a reminder so it doesn't get forgotten. |
Just so I don't forget I found another edge case with the vendored poetry. Is there a safe way to manage the import of
This version of ❯ python
Python 3.9.19 (main, May 6 2024, 14:39:30)
[Clang 14.0.6 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from attrs import AttrsInstance
>>> but the vendored version from conda-lock does not ❯ python
Python 3.9.19 (main, May 6 2024, 14:39:30)
[Clang 14.0.6 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import conda_lock
>>> from attrs import AttrsInstance
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/adefusco/Desktop/cl/lib/python3.9/site-packages/attrs/__init__.py", line 3, in <module>
from attr import (
ImportError: cannot import name 'AttrsInstance' from 'attr' (/Users/adefusco/Desktop/cl/lib/python3.9/site-packages/conda_lock/_vendor/poetry/core/_vendor/attr/__init__.py)
>>> |
This will be closed by #637 once we fix the remaining failing test case. @AlbertDeFusco, that branch also fixes your import issue. |
Checklist
What happened?
I know that this is a strange bug report and that the problem is not conda-lock's fault. I wonder if a new version of poetry will help, even slightly. This compatibility code was removed for version 1.2.
I've noticed that when
conda_lock
is imported thensubprocess.run
no longer supportscapture_ouptut=True
. The error messages trace to the vendored version of poetry included with conda-lock.Conda Info
Conda Config
Conda list
Additional Context
I am a contributor to conda-project where conda-lock is utilized as a library. I noticed this error occurs when an environment containing conda-project also contains setupools-scm. Then when conda-project imports conda-lock something happens that setuptools-scm wants to do
subprocess.run(capture_output=True)
and this happens after the conda-lock-vendored poetry is imported.The text was updated successfully, but these errors were encountered: