Python setup.py: Could not find suitable distribution for Requirement.parse('tensorflow')

15,588

This appears to have been caused by using Python version 3.8, which is currently an unsupported version of Python. Once I created a new Anaconda environment with Python version 3.7 this issue went away.

The only remaining issue is this error that I see when I run pip install -e . for my project which includes tensorflow:

ERROR: tensorflow-cpu 1.15.0rc2 has requirement tensorboard<1.16.0,>=1.15.0, but you'll have tensorboard 2.1.0 which is incompatible.
ERROR: tensorflow-cpu 1.15.0rc2 has requirement tensorflow-estimator==1.15.1, but you'll have tensorflow-estimator 2.1.0 which is incompatible.

So the issue of tensorflow-cpu version 1.15.0rc2 actually being installed when version 2.1.0 shows as being the installed version is still a mystery. To wit:

$ conda list tensorflow
# packages in environment at /home/james/miniconda3/envs/cvd:
#
# Name                    Version                   Build  Channel
tensorflow                2.1.0                    pypi_0    pypi
tensorflow-estimator      2.1.0                    pypi_0    pypi
$ python -c "import tensorflow as tf; print(tf.__version__)"
1.15.0-rc2
Share:
15,588
James Adams
Author by

James Adams

Updated on June 07, 2022

Comments

  • James Adams
    James Adams almost 2 years

    I have tensorflow listed as a requirement in the install_requires section of the setup.py of my project.

    When I attempt to install my project into a new Anaconda environment I get the following error:

    $ python setup.py install
    
    ...
    
    Searching for tensorflow
    Reading https://pypi.org/simple/tensorflow/
    No local packages or working download links found for tensorflow
    error: Could not find suitable distribution for Requirement.parse('tensorflow')
    

    I can get past this by installing tensorflow "manually" via conda:

    $ conda install tensorflow
    

    Once I do this the install via setup.py works without a hitch.

    Am I mistaken in assuming that something is amiss with my environment? If not then what is going on and how can I avoid this issue? (My concern is that users of my package will not be able to install from source using setup.py)

    Another oddity that I assume is related or may provide a clue is that the version of TensorFlow listed in my Anaconda environment is 2.0 but if I import it when running Python it appears to instead be using version 1.15. For example:

    $ conda list tensorflow
    # packages in environment at /home/james/miniconda3/envs/cvdata_test:
    #
    # Name                    Version                   Build  Channel
    tensorflow                2.0.0           mkl_py37h66b46cc_0  
    tensorflow-base           2.0.0           mkl_py37h9204916_0  
    tensorflow-estimator      2.0.0              pyh2649769_0  
    
    $ python 
    Python 3.7.6 | packaged by conda-forge | (default, Jan  7 2020, 22:33:48) 
    [GCC 7.3.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import tensorflow as tf
    >>> tf.__version__
    '1.15.0-rc2'
    

    This is on a Dell laptop running Ubuntu 18.04 without a GPU, so perhaps the version shown in the interpreter is akin to tensorflow-cpu? If I run pip freeze I see tensorflow==2.0.0 and tensorflow-cpu==1.15.0rc2, which is a bit confusing...