-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Environment markers with different sources for a dependency #7300
Comments
PTAL @radoering |
update and install aren't very different, it doesn't make a lot of sense that they would install from different places
Are you sure you're not just seeing poetry using the cached wheel - as obtained during update - when it does the install? You've made it rather hard to tell what's going on by making poetry choose betwen identical wheels in different places - I can't see a reason that anyone would do that in real life. If you can construct a more plausible scenario in which the two cases give actually different results, then probably it would be clearer whether this is behaving correctly or not |
I'm removing the cache between runs. So if I was getting a cached wheel, wouldn't it be from the update? It's not identical wheels. It's a wheel built for MacOS ARM64 on one source, and falling back to PyPI. That's what this does: grpcio = [
{version="==1.47.2", markers="sys_platform != 'darwin' and platform_machine != 'arm64'", source="pypi"},
{version="==1.47.2", markers="sys_platform == 'darwin' and platform_machine == 'arm64'", source="pythonbuild"},
] If platform is darwin and machine is arm64, use source The reason this is useful is because compiling Python packages on MacOS is a painful experience, especially when they require different packages, or you have multiple projects and need to compile each time. |
Maybe, I missed something, but I didn't read what happened during By the way, |
was always hard to tell what was being reported here: python.build is now dead and so I suppose we'll likely never get anywhere with this. recommend closing. |
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. |
Poetry version: 1.4.0.dev0, commit ef89e90fc1305e07a62e9e715c91a66c8d7425f7, also happens on 1.3.1
Python version: 3.10.9
OS version and name: macOS 12.6 (21G115)
pyproject.toml: https://github.com/kilnbuild/pythonbuild_examples/blob/main/poetry/pyproject.toml
I am on the latest stable Poetry version, installed using a recommended method.
I have searched the issues of this repo and believe that this is not a duplicate.
I have consulted the FAQ and blog for any relevant entries or release notes.
If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option) and have included the output below.Issue
I'm trying to use two different sources in Poetry for a dependency using markers:
markers="sys_platform == 'darwin' and platform_machine == 'arm64'"
markers="sys_platform != 'darwin' and platform_machine != 'arm64'"
)This is because I'm hosting wheels on a source for Apple Silicon, and want to fallback to PyPI for everything else. grpcio for example does not provide wheels for Apple Silicon, so I'm hosting them on a soon-to-be public source (though you can use it now if you want :-)).
If I have a custom mirror for a marker, let's call it "pythonbuild", then can I fall back to PyPI for the other marker, is this supported in Poetry?
Example:
Doing a
poetry update -vvv
on MacOS ARM64 (using Poetry frommaster
, as of 2022-01-05, commit ef89e90fc1305e07a62e9e715c91a66c8d7425f7), I get the following output (Gist).Doing this builds the following lock file: lockfile.
During the update process this works, as it looks at the markers and uses the correct source for the dependency, but when I try to install the lock file, it installs from pypi, as that's listed higher in the lock file. That's how it should work in theory, but there should be a way to tell the lockfile which source to use for a dependency.
You can see an example project here that you can use: https://github.com/kilnbuild/pythonbuild_examples/tree/main/poetry (use
poetry install
on MacOS ARM64 (Apple Silicon, M1/M2 whatever buzzword Apple is using now) to see the issue).I've read through the following issues:
#5205
#6710
And this PR:
#6679
And my source looks like this:
Before each step, I ensure that I'm starting with a clean environment:
rm -rf ~/Library/Caches/pypoetry .venv poetry.lock
I can verify the wheel is being used when using
poetry update
:Shows
So I should be able to run
poetry install
now, and have the same results, using the lock file..rm -rf ~/Library/Caches/pypoetry .venv
I can see via network monitoring, it hits
https://pypi.org/pypi/grpcio/1.47.2/json
for both the update + install, but during the update it downloads fromhttps://wheels.python.build/grpcio-1.47.2-cp310-cp310-macosx_11_0_arm64.whl
, where as during the install it does not.The text was updated successfully, but these errors were encountered: