tensorflow should not be listed as dependency in setup.py
See original GitHub issueDescribe 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:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top GitHub Comments
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 ontensorflow
. 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:To install
stellargraph
+tensorflow
you can use the following:Finally, to install stellargraph without change to your existing tensorflow libraries:
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.
I am still facing this issue stellar graph is not using GPU, I am working with Watch Your Step Embedding Method.