question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

poetry dependency resolution oddity

See original GitHub issue
  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

Issue

I am having trouble understanding how poetry determines dependencies. The tensorflow-macos package does not seem to depend on tensorflow-io-gcs-filesystem when installed via pip but does depend on it when installed via poetry and I can’t understand why.

I am trying to add tensorflow-macos, like so

poetry add tensorflow-macos --lock
poetry show tensorflow-macos --tree

I get this:

β”œβ”€β”€ absl-py >=0.4.0
β”‚   └── six *
β”œβ”€β”€ astunparse >=1.6.0
β”‚   └── six >=1.6.1,<2.0
β”œβ”€β”€ flatbuffers >=1.12,<3.0
β”œβ”€β”€ gast >=0.2.1,<0.5.0
β”œβ”€β”€ google-pasta >=0.1.1
β”‚   └── six *
β”œβ”€β”€ grpcio >=1.24.3,<2.0
β”‚   └── six >=1.5.2
β”œβ”€β”€ h5py >=2.9.0
β”‚   └── numpy >=1.14.5
β”œβ”€β”€ keras >=2.7.0rc0,<2.8
β”œβ”€β”€ keras-preprocessing >=1.1.1
β”‚   β”œβ”€β”€ numpy >=1.9.1
β”‚   └── six >=1.9.0
β”œβ”€β”€ libclang >=9.0.1
β”œβ”€β”€ numpy >=1.14.5
β”œβ”€β”€ opt-einsum >=2.3.2
β”‚   └── numpy >=1.7
β”œβ”€β”€ protobuf >=3.9.2
β”œβ”€β”€ six >=1.12.0
β”œβ”€β”€ tensorboard >=2.6,<3.0
β”‚   β”œβ”€β”€ absl-py >=0.4
β”‚   β”‚   └── six *
β”‚   β”œβ”€β”€ google-auth >=1.6.3,<3
β”‚   β”‚   β”œβ”€β”€ cachetools >=2.0.0
β”‚   β”‚   β”œβ”€β”€ pyasn1-modules >=0.2.1
β”‚   β”‚   β”‚   └── pyasn1 >=0.4.6,<0.5.0
β”‚   β”‚   β”œβ”€β”€ rsa >=3.1.4
β”‚   β”‚   β”‚   └── pyasn1 >=0.1.3 (circular dependency aborted here)
β”‚   β”‚   └── six >=1.9.0 (circular dependency aborted here)
β”‚   β”œβ”€β”€ google-auth-oauthlib >=0.4.1,<0.5
β”‚   β”‚   β”œβ”€β”€ google-auth >=1.0.0 (circular dependency aborted here)
β”‚   β”‚   └── requests-oauthlib >=0.7.0
β”‚   β”‚       β”œβ”€β”€ oauthlib >=3.0.0
β”‚   β”‚       └── requests >=2.0.0
β”‚   β”‚           β”œβ”€β”€ certifi >=2017.4.17
β”‚   β”‚           β”œβ”€β”€ charset-normalizer >=2.0.0,<2.1.0
β”‚   β”‚           β”œβ”€β”€ idna >=2.5,<4
β”‚   β”‚           └── urllib3 >=1.21.1,<1.27
β”‚   β”œβ”€β”€ grpcio >=1.24.3
β”‚   β”‚   └── six >=1.5.2 (circular dependency aborted here)
β”‚   β”œβ”€β”€ markdown >=2.6.8
β”‚   β”‚   └── importlib-metadata >=4.4
β”‚   β”‚       └── zipp >=0.5
β”‚   β”œβ”€β”€ numpy >=1.12.0
β”‚   β”œβ”€β”€ protobuf >=3.6.0
β”‚   β”œβ”€β”€ requests >=2.21.0,<3 (circular dependency aborted here)
β”‚   β”œβ”€β”€ tensorboard-data-server >=0.6.0,<0.7.0
β”‚   β”œβ”€β”€ tensorboard-plugin-wit >=1.6.0
β”‚   └── werkzeug >=0.11.15
β”œβ”€β”€ tensorflow-estimator >=2.7.0rc0,<2.8
β”œβ”€β”€ **tensorflow-io-gcs-filesystem** >=0.21.0
β”œβ”€β”€ termcolor >=1.1.0
β”œβ”€β”€ typing-extensions >=3.6.6
└── wrapt >=1.11.0

When I actually install the package via pip, and use pipdeptree to identify the dependencies, I see the following:

poetry run pip install pipdepdree
poetry run pip install tensorflow-macos
poetry run pipdeptree
tensorflow-macos==2.7.0
  - absl-py [required: >=0.4.0, installed: 1.0.0]
    - six [required: Any, installed: 1.15.0]
  - astunparse [required: >=1.6.0, installed: 1.6.3]
    - six [required: >=1.6.1,<2.0, installed: 1.15.0]
    - wheel [required: >=0.23.0,<1.0, installed: 0.37.1]
  - flatbuffers [required: >=1.12,<3.0, installed: 2.0]
  - gast [required: >=0.2.1,<0.5.0, installed: 0.4.0]
  - google-pasta [required: >=0.1.1, installed: 0.2.0]
    - six [required: Any, installed: 1.15.0]
  - grpcio [required: >=1.24.3,<2.0, installed: 1.43.0]
    - six [required: >=1.5.2, installed: 1.15.0]
  - h5py [required: >=2.9.0, installed: 3.6.0]
    - numpy [required: >=1.14.5, installed: 1.22.1]
  - keras [required: >=2.7.0rc0,<2.8, installed: 2.7.0]
  - keras-preprocessing [required: >=1.1.1, installed: 1.1.2]
    - numpy [required: >=1.9.1, installed: 1.22.1]
    - six [required: >=1.9.0, installed: 1.15.0]
  - libclang [required: >=9.0.1, installed: 12.0.0]
  - numpy [required: >=1.14.5, installed: 1.22.1]
  - opt-einsum [required: >=2.3.2, installed: 3.3.0]
    - numpy [required: >=1.7, installed: 1.22.1]
  - protobuf [required: >=3.9.2, installed: 3.19.3]
  - six [required: >=1.12.0, installed: 1.15.0]
  - tensorboard [required: ~=2.6, installed: 2.7.0]
    - absl-py [required: >=0.4, installed: 1.0.0]
      - six [required: Any, installed: 1.15.0]
    - google-auth [required: >=1.6.3,<3, installed: 1.6.3]
      - cachetools [required: >=2.0.0, installed: 5.0.0]
      - pyasn1-modules [required: >=0.2.1, installed: 0.2.8]
        - pyasn1 [required: >=0.4.6,<0.5.0, installed: 0.4.8]
      - rsa [required: >=3.1.4, installed: 4.8]
        - pyasn1 [required: >=0.1.3, installed: 0.4.8]
      - six [required: >=1.9.0, installed: 1.15.0]
    - google-auth-oauthlib [required: >=0.4.1,<0.5, installed: 0.4.6]
      - google-auth [required: >=1.0.0, installed: 1.6.3]
        - cachetools [required: >=2.0.0, installed: 5.0.0]
        - pyasn1-modules [required: >=0.2.1, installed: 0.2.8]
          - pyasn1 [required: >=0.4.6,<0.5.0, installed: 0.4.8]
        - rsa [required: >=3.1.4, installed: 4.8]
          - pyasn1 [required: >=0.1.3, installed: 0.4.8]
        - six [required: >=1.9.0, installed: 1.15.0]
      - requests-oauthlib [required: >=0.7.0, installed: 1.3.0]
        - oauthlib [required: >=3.0.0, installed: 3.1.1]
        - requests [required: >=2.0.0, installed: 2.27.1]
          - certifi [required: >=2017.4.17, installed: 2021.10.8]
          - charset-normalizer [required: ~=2.0.0, installed: 2.0.10]
          - idna [required: >=2.5,<4, installed: 3.3]
          - urllib3 [required: >=1.21.1,<1.27, installed: 1.26.8]
    - grpcio [required: >=1.24.3, installed: 1.43.0]
      - six [required: >=1.5.2, installed: 1.15.0]
    - markdown [required: >=2.6.8, installed: 3.3.6]
      - importlib-metadata [required: >=4.4, installed: 4.10.0]
        - zipp [required: >=0.5, installed: 3.7.0]
    - numpy [required: >=1.12.0, installed: 1.22.1]
    - protobuf [required: >=3.6.0, installed: 3.19.3]
    - requests [required: >=2.21.0,<3, installed: 2.27.1]
      - certifi [required: >=2017.4.17, installed: 2021.10.8]
      - charset-normalizer [required: ~=2.0.0, installed: 2.0.10]
      - idna [required: >=2.5,<4, installed: 3.3]
      - urllib3 [required: >=1.21.1,<1.27, installed: 1.26.8]
    - setuptools [required: >=41.0.0, installed: 60.5.0]
    - tensorboard-data-server [required: >=0.6.0,<0.7.0, installed: 0.6.1]
    - tensorboard-plugin-wit [required: >=1.6.0, installed: 1.8.1]
    - werkzeug [required: >=0.11.15, installed: 2.0.2]
    - wheel [required: >=0.26, installed: 0.37.1]
  - tensorflow-estimator [required: ~=2.7.0rc0,<2.8, installed: 2.7.0]
  - termcolor [required: >=1.1.0, installed: 1.1.0]
  - typing-extensions [required: >=3.6.6, installed: 4.0.1]
  - wheel [required: >=0.32.0,<1.0, installed: 0.37.1]
  - wrapt [required: >=1.11.0, installed: 1.13.3]

Note that tensorflow-io-gcs-filesystem is not listed and it is not installed.

I downloaded the wheel for tensorflow-macos and this is the content of the metadata file:

Metadata-Version: 2.1
Name: tensorflow-macos
Version: 2.7.0
Summary: TensorFlow is an open source machine learning framework for everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: packages@tensorflow.org
License: Apache 2.0
Download-URL: https://github.com/tensorflow/tensorflow/tags
Keywords: tensorflow tensor machine learning
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: GPU :: NVIDIA CUDA :: 11.2
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy (>=1.14.5)
Requires-Dist: absl-py (>=0.4.0)
Requires-Dist: astunparse (>=1.6.0)
Requires-Dist: libclang (>=9.0.1)
Requires-Dist: flatbuffers (<3.0,>=1.12)
Requires-Dist: google-pasta (>=0.1.1)
Requires-Dist: h5py (>=2.9.0)
Requires-Dist: keras-preprocessing (>=1.1.1)
Requires-Dist: opt-einsum (>=2.3.2)
Requires-Dist: protobuf (>=3.9.2)
Requires-Dist: six (>=1.12.0)
Requires-Dist: termcolor (>=1.1.0)
Requires-Dist: typing-extensions (>=3.6.6)
Requires-Dist: wheel (<1.0,>=0.32.0)
Requires-Dist: wrapt (>=1.11.0)
Requires-Dist: gast (<0.5.0,>=0.2.1)
Requires-Dist: tensorboard (~=2.6)
Requires-Dist: tensorflow-estimator (<2.8,~=2.7.0rc0)
Requires-Dist: keras (<2.8,>=2.7.0rc0)
Requires-Dist: grpcio (<2.0,>=1.24.3)

[![Python](https://img.shields.io/pypi/pyversions/tensorflow.svg?style=plastic)](https://badge.fury.io/py/tensorflow)
[![PyPI](https://badge.fury.io/py/tensorflow.svg)](https://badge.fury.io/py/tensorflow)

TensorFlow is an open source software library for high performance numerical
computation. Its flexible architecture allows easy deployment of computation
across a variety of platforms (CPUs, GPUs, TPUs), and from desktops to clusters
of servers to mobile and edge devices.

Originally developed by researchers and engineers from the Google Brain team
within Google's AI organization, it comes with strong support for machine
learning and deep learning and the flexible numerical computation core is used
across many other scientific domains.

Note that tensorflow-io-gcs-filesystem is not listed as a dependency.

And here’s the setup.py dependency specification section:

REQUIRED_PACKAGES = [
    # NOTE: As numpy has releases that break semver guarantees and several other
    # deps depend on numpy without an upper bound, we must install numpy before
    # everything else.
    'numpy >= 1.14.5', # keras 2.6 needs 1.19.2, h5py needs 1.14.5 for py37
    # Install other dependencies
    'absl-py >= 0.4.0',
    'astunparse >= 1.6.0',
    'libclang >= 9.0.1',
    'flatbuffers >= 1.12, < 3.0', # capped as jax 0.1.71 needs < 3.0
    'google_pasta >= 0.1.1',
    'h5py >= 2.9.0', # capped since 3.3.0 lacks py3.6
    'keras_preprocessing >= 1.1.1', # 1.1.0 needs tensorflow==1.7
    'opt_einsum >= 2.3.2', # sphinx pin not removed up til 3.3.0 release
    'protobuf >= 3.9.2',
    'six >= 1.12.0',
    'termcolor >= 1.1.0',
    'typing_extensions >= 3.6.6',
    'wheel >= 0.32.0, < 1.0', # capped as astunparse 1.6.0-1.6.3 requires < 1.0
    'wrapt >= 1.11.0',
    # These packages need to be pinned exactly as newer versions are
    # incompatible with the rest of the ecosystem
    'gast >= 0.2.1, < 0.5.0', # TODO(lpak): if this breaks, revert to 0.4.0
    # TensorFlow ecosystem packages that TF exposes API for
    # These need to be in sync with the existing TF version
    # They are updated during the release process
    # When updating these, please also update the nightly versions below
    'tensorboard ~= 2.6',
    'tensorflow_estimator ~= 2.7.0rc0, < 2.8',
    # Keras release is not backward compatible with old tf release, and we have
    # to make the version aligned between TF and Keras.
    'keras >= 2.7.0rc0, < 2.8',
    # 'tensorflow-io-gcs-filesystem >= 0.21.0',
]

Note that the tensorflow-io-gcs-filesystem is listed but has been commented out.

So, my question is how is poetry coming to a conclusion that tensorflow-io-gcs-filesystem is a dependency of tensorflow-macos?

I am asking because I am unable to install tensorflow-macos using poetry because of this reason. poetry install shows the following error:

  β€’ Installing tensorflow-io-gcs-filesystem (0.23.1): Failed

  RuntimeError

  Unable to find installation candidates for tensorflow-io-gcs-filesystem (0.23.1)

  at ~/.poetry/lib/poetry/installation/chooser.py:72 in choose_for
       68β”‚
       69β”‚             links.append(link)
       70β”‚
       71β”‚         if not links:
    β†’  72β”‚             raise RuntimeError(
       73β”‚                 "Unable to find installation candidates for {}".format(package)
       74β”‚             )
       75β”‚
       76β”‚         # Get the best link

This is understandable because tensorflow-io-gcs-filesystem does not have binaries for macOS arm64. But why is it considered a dependency in the first place?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

8reactions
oscar-defelicecommented, Sep 21, 2022

I have a very similar problem and this is not due to python version nor to tensorflow dependency.

I run poetry add tensorflow==2.9.1

 Installing tensorflow-io-gcs-filesystem (0.26.0): Failed

  RuntimeError

  Unable to find installation candidates for tensorflow-io-gcs-filesystem (0.26.0)

  at ~/miniconda3/envs/tempr/lib/python3.9/site-packages/poetry/installation/chooser.py:72 in choose_for
       68β”‚ 
       69β”‚             links.append(link)
       70β”‚ 
       71β”‚         if not links:
    β†’  72β”‚             raise RuntimeError(
       73β”‚                 "Unable to find installation candidates for {}".format(package)
       74β”‚             )
       75β”‚ 
       76β”‚         # Get the best link

Read more comments on GitHub >

github_iconTop Results From Across the Web

FAQ | Documentation | Poetry - Python dependency ...
Once Poetry has cached the releases' information, the dependency resolution process will be much faster. Why are unbound version constraints a bad idea?...
Read more >
How to disable dependency resolution in Poetry?
Is there any practical way to either disable or speed up the dependency resolution? I want to keep using poetry for it's support...
Read more >
HARDY AND WORDSWORTH - jstor
since Thomson's day". His poetry can represent a third great stage of the English meditative lyric, a Victorian resolution. At the same.
Read more >
Dependency Management With Python Poetry
A dependency manager like Python Poetry helps you specify, install, and resolve external packages in your projects.
Read more >
relaxed-poetry - PyPI
Fork of Poetry (Python dependency management and packaging tool), attempts to be faster and less strict.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found