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.

tensorflow should not be listed as dependency in setup.py

See original GitHub issue

Describe the bug The stellargraph library includes tensorflow (i.e., "tensorflow>=1.14,<1.15") as a dependency in setup.py. If a user has tensorflow-gpu installed, then pip3 install stellargraph installs tensorflow, which overwrites things and causes all models to be trained on CPU instead of GPU. To fix, users must remove the tensorflow* installations and reinstall tensorflow-gpu. This was true for TF 1.14 at least, and I think may hold true with TF 2.0.

To Reproduce Steps to reproduce the behavior: On a system where tensorflow-gpu is installed, install stellargraph with: pip3 install stellargraph

Expected behavior Installing stellargraph shouldn’t corrupt existing tensorflow-gpu installations.

Solution The tensorflow entry should be removed as a dependency in setup.py and requirements. Instead, the Installation section in the stellargraph README should include a note about installing tensorflow (or tensorflow-gpu) separately when installing stellargraph. This is how other libraries typically handle it. For instance, see the installation instructions for graph_nets:

To install the Graph Nets library for CPU, run:

$ pip install graph_nets “tensorflow>=1.15,<2” tensorflow_probability

To install the Graph Nets library for GPU, run:

$ pip install graph_nets “tensorflow_gpu>=1.15,<2” tensorflow_probability

In setup.py of graph_nets:

    # Additional "tensorflow" and "tensorflow_probability" requirements should
    # be installed separately (See README).
    install_requires=[
        "absl-py",
        "dm-sonnet<2",
        "future",
        "networkx",
        "numpy",
        "setuptools",
        "six",
    ],

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
adochertycommented, Dec 9, 2019

Hi @amaiya,

Thanks for trying the library! We understand the issue and will look at updating the setup.py file to remove a hard dependency on tensorflow. I am thinking instead of removing tensorflow as a requirement we can add it as a ‘extra’ requirement, so that you can specify stellargraph either with gpu or cpu support, for example:

To install stellargraph + tensorflow-gpu you can use the following:

pip install stellargraph[gpu]

To install stellargraph + tensorflow you can use the following:

pip install stellargraph[cpu]

Finally, to install stellargraph without change to your existing tensorflow libraries:

pip install stellargraph

However, there should be a warning in the latter case if tensorflow is not installed, or an incompatible version of tensorflow is installed. This will help users who install StellarGraph without reading the fine print so they do not face unexplained errors.

0reactions
shauryauppalcommented, Nov 5, 2021

I am still facing this issue stellar graph is not using GPU, I am working with Watch Your Step Embedding Method.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Match versions between packages in setup.py install_requires
Note: Since TensorFlow is not included as a dependency of the TensorFlow Probability package (in setup.py), you must explicitly install the ...
Read more >
Install TensorFlow Model Optimization
Since TensorFlow is not included as a dependency of the TensorFlow Model Optimization package (in setup.py ), you must explicitly install ...
Read more >
How to Package Python dependencies with PIP setuptools
To install a setup.py file including dependencies listed in ... In order to download dependencies not found in PyPI, you will need to...
Read more >
Managing Python Pipeline Dependencies - Apache Beam
If your pipeline uses packages that are not available publicly (e.g. ... If you have the setup.py for that package then you can...
Read more >
The Nine Circles of Python Dependency Hell - Medium
Circle 4: Overlapping transitive dependencies ... If two of your dependencies are demanding overlapping versions of a library, pip will not necessarily install...
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