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

Poetry tries to install url dependency with platform='linux' on macOS #8106

Closed
3 of 4 tasks
kjyv opened this issue Jun 15, 2023 · 4 comments
Closed
3 of 4 tasks

Poetry tries to install url dependency with platform='linux' on macOS #8106

kjyv opened this issue Jun 15, 2023 · 4 comments
Labels
area/solver Related to the dependency resolver kind/question User questions (candidates for conversion to discussion) status/duplicate Duplicate issues

Comments

@kjyv
Copy link

kjyv commented Jun 15, 2023

  • Poetry version: 1.5.1

  • Python version: 3.11.3

  • OS version and name: macOS 13.4

  • 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. (does not produce more relevant output, so left it out)

Issue

I'm trying to install torch differently for darwin and linux. macOS should come from pypi, linux should come from a url.
My pyproject.toml entry is this:

torch = [
        {platform = "darwin", version = "==2.0.0"},
        {platform = "linux", markers = "sys_platform == 'linux' and platform_machine == 'x86_64'", url = "https://download.pytorch.org/whl/cpu/torch-2.0.0%2Bcpu-cp311-cp311-linux_x86_64.whl"}
]

(previously tried it with variations of platform_system, only using the platform argument, all behave the same though)

Locking works and adds hashes to the lock file. However upon install on macOS, poetry tries to install the linux wheel and this exception is generated:

 • Installing mpmath (1.3.0)
  • Installing networkx (3.1)
  • Installing sympy (1.12)
  • Installing torch (2.0.0+cpu https://download.pytorch.org/whl/cpu/torch-2.0.0%2Bcpu-cp311-cp311-linux_x86_64.whl): Failed

  RuntimeError

  Package https://download.pytorch.org/whl/cpu/torch-2.0.0%2Bcpu-cp311-cp311-linux_x86_64.whl cannot be installed in the current environment {'implementation_name': 'cpython', 'implementation_version': '3.11.3', 'os_name': 'posix', 'platform_machine': 'arm64', 'platform_release': '22.5.0', 'platform_system': 'Darwin', 'platform_version': 'Darwin Kernel Version 22.5.0: Mon Apr 24 20:52:24 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6000', 'python_full_version': '3.11.3', 'platform_python_implementation': 'CPython', 'python_version': '3.11', 'sys_platform': 'darwin', 'version_info': [3, 11, 3, 'final', 0], 'interpreter_name': 'cp', 'interpreter_version': '3_11'}

  at ~/.asdf/installs/python/3.11.3/lib/python3.11/site-packages/poetry/installation/executor.py:788 in _download_link
      784│             # Since we previously downloaded an archive, we now should have
      785│             # something cached that we can use here. The only case in which
      786│             # archive is None is if the original archive is not valid for the
      787│             # current environment.
    → 788│             raise RuntimeError(
      789│                 f"Package {link.url} cannot be installed in the current environment"
      790│                 f" {self._env.marker_env}"
      791│             )
      792│

I have seen that there are multiple torch related tickets, but these seem to discuss other issues and also, this does not seem to be specific to torch, poetry should not even try to install the wheel on macOS.

@kjyv kjyv added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jun 15, 2023
@kjyv kjyv changed the title Poetry tries to install dependency with platform='linux' on macOS Poetry tries to install url dependency with platform='linux' on macOS Jun 15, 2023
@dimbleby
Copy link
Contributor

duplicate #7452, #7722

@radoering radoering added area/solver Related to the dependency resolver status/duplicate Duplicate issues and removed status/triage This issue needs to be triaged labels Jun 18, 2023
@radoering
Copy link
Member

You have to specify source = "PyPI" for your first constraint, otherwise the constraints will be merged because the first one can be satisfied by the second one.

@radoering radoering closed this as not planned Won't fix, can't repro, duplicate, stale Jun 18, 2023
@radoering radoering added kind/question User questions (candidates for conversion to discussion) and removed kind/bug Something isn't working as expected labels Jun 18, 2023
@kjyv
Copy link
Author

kjyv commented Jun 19, 2023

I see, thanks and sorry for the unnecessary ticket. I guess it's not very intuitive that it has to be done like this. And I did try with both lines, respectively, using a custom source for torch and one with source="pypi" that apparently failed for other reasons (already being discussed in the torch issues)

Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/solver Related to the dependency resolver kind/question User questions (candidates for conversion to discussion) status/duplicate Duplicate issues
Projects
None yet
Development

No branches or pull requests

3 participants