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

Incorrect dependency resolution when specifying same package multiple times with different local version labels #256

Open
Hato1 opened this issue Jan 24, 2024 · 2 comments

Comments

@Hato1
Copy link

Hato1 commented Jan 24, 2024

I've configured markers in the pyproject.toml file to install TensorFlow with the Nvidia local version label exclusively when on the aarch64 architecture. However, when exporting to requirements.txt, only the Nvidia local version label is considered, resulting in the undesired installation of 2.12.0+nv23.06 on x86_64 platforms. As a workaround, setting PyPi tensorflow to a different base version (2.12.1) causes export to work as expected.

A minimal pyproject.toml

[tool.poetry]
name = "tensor"
version = "0.1.0"
description = ""
authors = []

[tool.poetry.dependencies]
python = "~3.11"
tensorflow = [
    { version = "2.12.0+nv23.06", markers = "platform_machine=='aarch64'", source = "Nvidia" },
    { version = "2.12.0", markers = "platform_machine=='x86_64'", source = "PyPI" }
]

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[[tool.poetry.source]]
name = "PyPI"
priority = "primary"

[[tool.poetry.source]]
# Source for special Jetson Tensorflow. 
# The numbers on the end of the URL should match the Jetpack version.
name = "Nvidia"
url = "https://developer.download.nvidia.com/compute/redist/jp/v512"
priority = "explicit"

Exporting

> poetry export --without-hashes -vvv
Loading configuration file /home/me/.config/pypoetry/config.toml
Adding repository PyPI (https://pypi.org/simple/) and setting it as primary
Adding repository Nvidia (https://developer.download.nvidia.com/compute/redist/jp/v512) and setting it as explicit
Source (poetry-lockfile): 1 packages found for tensorflow 2.12.0+nv23.06
Source (poetry-lockfile): 2 packages found for tensorflow 2.12.0
--extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v512

absl-py==2.1.0 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
astunparse==1.6.3 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
cachetools==5.3.2 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
certifi==2023.11.17 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
charset-normalizer==3.3.2 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
flatbuffers==23.5.26 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
gast==0.4.0 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
google-auth-oauthlib==1.0.0 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
google-auth==2.26.2 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
google-pasta==0.2.0 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
grpcio==1.60.0 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
h5py==3.10.0 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
idna==3.6 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
jax==0.4.23 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
keras==2.12.0 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
libclang==16.0.6 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
markdown==3.5.2 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
markupsafe==2.1.4 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
ml-dtypes==0.3.2 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
numpy==1.23.5 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
oauthlib==3.2.2 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
opt-einsum==3.3.0 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
packaging==23.2 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
protobuf==4.25.2 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
pyasn1-modules==0.3.0 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
pyasn1==0.5.1 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
requests-oauthlib==1.3.1 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
requests==2.31.0 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
rsa==4.9 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
scipy==1.12.0 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
setuptools==69.0.3 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
six==1.16.0 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
tensorboard-data-server==0.7.2 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
tensorboard==2.12.3 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
tensorflow-estimator==2.12.0 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
tensorflow-io-gcs-filesystem==0.35.0 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
tensorflow==2.12.0+nv23.06 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
termcolor==2.4.0 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
typing-extensions==4.9.0 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
urllib3==2.1.0 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
werkzeug==3.0.1 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
wheel==0.42.0 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
wrapt==1.14.1 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")
@Hato1 Hato1 changed the title Incorrect dependency resolution when same package multiple times with different local version labels Incorrect dependency resolution when specifying same package multiple times with different local version labels Jan 24, 2024
@iambocai
Copy link

same issue, can anyone help?

the output should be like:

tensorflow==2.12.0+nv23.06 ; python_version >= "3.11" and python_version < "3.12" and platform_machine == "aarch64"
tensorflow==2.12.0 ; python_version >= "3.11" and python_version < "3.12" and platform_machine == "x86_64"

instead we currently got:

tensorflow==2.12.0+nv23.06 ; python_version >= "3.11" and python_version < "3.12" and (platform_machine == "aarch64" or platform_machine == "x86_64")

@Hato1
Copy link
Author

Hato1 commented Nov 21, 2024

@iambocai Can you use the same workaround I did by changing one platform to use 2.12.1?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants