issue in install tensorflow - tensorflow

when I use pip install tensorflow command that error appear :-
'''
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tf-nightly 2.6.0.dev20210601 requires gast==0.4.0, but you have gast 0.3.3 which is incompatible.
tf-nightly 2.6.0.dev20210601 requires h5py~=3.1.0, but you have h5py 2.10.0 which is incompatible.
tf-nightly 2.6.0.dev20210601 requires numpy~=1.19.2, but you have numpy 1.18.5 which is incompatible.'''

Looks like you are trying to install Tensorflow and tf-nightly on the same environment. Since Tensorflow and tf-nightly uses same code, you should never install both in same environment. Latest version overrides the most of the packages, thats how pip works. It recommended to use virtual environment each tensorflow version.
Tf-nightly require gast==0.4.0 and numpy==1.19.2.
Follow the below steps
python -m tf_nightly --system-site-packages .\venv
.\venv\Scripts\activate
pip install --upgrade pip
pip install tf-nightly

Related

How to install tensorflow==2.3.0

I would like to test some function in the new tensorflow2.3 However, I am struggling with installation process.
I saw: How do I install the most recent Tensorflow (here: 2.2) on Windows when conda does not yet support it?
I executed: pip install --upgrade pip
I got:
ERROR: Could not find a version that satisfies the requirement tensorflow-cpu==2.3.0rc2 (from versions: 1.15.0rc0, 1.15.0rc1, 1.15.0rc2, 1.15.0rc3, 1.15.0, 2.1.0rc0, 2.1.0rc1, 2.1.0rc2, 2.1.0)
ERROR: No matching distribution found for tensorflow-cpu==2.3.0rc2
please make sure pip is pointing to pip3 because tensorflow requires python3
pip --version
pip3 install --upgrade tensorflow
I just ran into the same issue, but had to downgrade python from 3.9 to 3.8.
Python 3.8 is the latest version that supports tensorflow 2.3.0
For some cases, you need to upgrade your pip version
pip install --upgrade pip
then install tensorflow 2.3.0 version

installing tensorflow_transform and apache_beam on Datalab

I'm going over these example from google-cloud Coursera courses, and although they worked till a few weeks ago, I can't install tf.transform or apache_beam on Datalab anymore.
https://github.com/GoogleCloudPlatform/training-data-analyst/blob/master/courses/machine_learning/feateng/tftransform.ipynb
https://github.com/GoogleCloudPlatform/training-data-analyst/blob/master/courses/machine_learning/deepdive/06_structured/4_preproc_tft.ipynb
When installing tensorflow_transform I get the following errors:
%bash
pip install --upgrade --force tensorflow_transform==0.6.0
twisted 18.7.0 requires PyHamcrest>=1.9.0, which is not installed.
datalab 1.1.3 has requirement six==1.10.0, but you'll have six 1.11.0 which is incompatible.
gapic-google-cloud-pubsub-v1 0.15.4 has requirement oauth2client<4.0dev,>=2.0.0, but you'll have oauth2client 4.1.2 which is incompatible.
proto-google-cloud-pubsub-v1 0.15.4 has requirement oauth2client<4.0dev,>=2.0.0, but you'll have oauth2client 4.1.2 which is incompatible.
apache-airflow 1.9.0 has requirement bleach==2.1.2, but you'll have bleach 1.5.0 which is incompatible.
apache-airflow 1.9.0 has requirement funcsigs==1.0.0, but you'll have funcsigs 1.0.2 which is incompatible.
google-cloud-monitoring 0.28.0 has requirement google-cloud-core<0.29dev,>=0.28.0, but you'll have google-cloud-core 0.25.0 which is incompatible.
proto-google-cloud-datastore-v1 0.90.4 has requirement oauth2client<4.0dev,>=2.0.0, but you'll have oauth2client 4.1.2 which is incompatible.
pandas-gbq 0.3.0 has requirement google-cloud-bigquery>=0.28.0, but you'll have google-cloud-bigquery 0.25.0 which is incompatible.
googledatastore 7.0.1 has requirement httplib2<0.10,>=0.9.1, but you'll have httplib2 0.11.3 which is incompatible.
googledatastore 7.0.1 has requirement oauth2client<4.0.0,>=2.0.1, but you'll have oauth2client 4.1.2 which is incompatible.
Cannot uninstall 'dill'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
The tensorflow version on my Datalab instance was 1.4.
I had to add this one line of code to update tensorflow to 1.10.1
%bash
pip install --upgrade --force-reinstall pip==10.0.1
pip install tensorflow==1.10.1
pip install tensorflow_transform
my environment:
apache-airflow==1.9.0
apache-beam==2.6.0
tensorflow==1.10.1
tensorflow-metadata==0.9.0
tensorflow-tensorboard==0.4.0rc3
tensorflow-transform==0.8.0
The current version of Datalab uses TensorFlow 1.8, so please change the notebook cell in question to:
%bash
pip uninstall -y google-cloud-dataflow
pip install --upgrade --force tensorflow_transform==0.8.0 apache-beam[gcp]
I've updated and checked in the two notebooks linked above.
Another problem might be that you are using Python 2. Datalab by default now uses Python 3 and your pip install (above) happens in Python 3 even if the kernel is Python 2 because %%bash opens up a new shell in which the conda activate of Python 2 has not happened.
To make sure the pip install happens in Python 2, change your pip install of apache-beam[gcp] as follows:
%%bash
source activate py2env
conda install -y dill pytz # do this for all the distutils complaints
pip uninstall -y google-cloud-dataflow
pip install --upgrade --force tensorflow_transform==0.8.0 apache-beam[gcp]

How to install Keras if the required version of setuptools is older than default?

I'm using conda 4.4.9. I have already installed TensorFlow and I want to install Keras as well.
Then I tried to activate my virtual environment and install Keras as below:-
activate tensorflow_env_001
pip install --ignore-installed --upgrade keras
Then I got the following error message:
tensorflow 1.9.0 has requirement setuptools<=39.1.0, but you'll have setuptools 39.2.0 which is incompatible
That means my setuptools is too new. In fact, I can run the TensorFlow codes without any error. But I just can't install Keras. I tried to update setuptools but that had just made the situation worse, as setuptools now become 40.0.0.
If I run conda list, and I will see this:-
That means all TensorFlow, Keras and setuptools are here. But when I tried to import Keras in my Python code, I just got ModuleNotFoundError: No module named 'keras'.
How can I properly install Keras? Many thanks!!
tensorflow 1.9.0 has requirement setuptools<=39.1.0, but you'll have setuptools 39.2.0 which is incompatible
i got same error.To downgrade your setuptools version you can use
pip install setuptools==39.1.0
hope this helps further for keras installations.
Try to remove the env
conda remove --name ENVNAME --all
Then create a new one but first upgrade the pip version
python -m pip install --upgrade pip
and then install tensorflow:
pip install --ignore-installed --upgrade tensorflow==1.9.0
It will automatically get (downgrade) your version of setuptools
#
# Name Version Build Channel
.......
python 3.5.6 he025d50_0
setuptools 39.1.0 pypi_0 pypi
six 1.12.0 pypi_0 pypi
tensorboard 1.9.0 pypi_0 pypi
tensorflow 1.9.0 pypi_0 pypi
termcolor 1.1.0 pypi_0 pypi
.....

Tensorflow on Ubuntu 16.04 Not Installing

I'm trying to install the GPU version of Tensorflow using Virtualenv on Ubuntu 16.04 and Python 3.6 (Anaconda), but it keeps on outputting these errors
tensorflow-gpu 1.7.0 requires numpy>=1.13.3, which is not installed.
tensorflow-gpu 1.7.0 requires six>=1.10.0, which is not installed.
tensorboard 1.7.0 requires numpy>=1.12.0, which is not installed.
tensorboard 1.7.0 requires six>=1.10.0, which is not installed.
tensorboard 1.7.0 requires werkzeug>=0.11.10, which is not installed.
protobuf 3.5.2.post1 requires six>=1.9, which is not installed.
html5lib 0.9999999 requires six, which is not installed.
grpcio 1.10.0 requires six>=1.5.2, which is not installed.
bleach 1.5.0 requires six, which is not installed.
absl-py 0.1.13 requires six, which is not installed.
I've tried installing both numpy and six using sudo pip install numpy six both in the virtualenv and out of it, but the error is still present. Any ideas on how to fix this?
You are using the conda and virtualenv simultaneously which is usually a bad idea. If you installed Python from anaconda use their environment tool.
conda create -n tensorflow pip python=3.6
source activate tensorflow
pip install --ignore-installed --upgrade\
https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.6.0-cp36-cp36m-linux_x86_64.whl
Additionally, have a look at how to install tensorflow with anaconda.

error of import tensorflow as tf python 3.6.0

I downloaded the tensorflow package for python3.6.0 from http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy then installed it by pip, it showed successful . when I import tensorflow as tf,it failed like following
import tensorflow as tf
From Documentation
Install TensorFlow Python dependencies
To install TensorFlow, you must install the following packages:
numpy, which is a numerical processing package that TensorFlow requires.
dev, which enables adding extensions to Python.
pip, which enables you to install and manage certain Python packages.
wheel, which enables you to manage Python compressed packages in the wheel (.whl) format.
Install the dependency packages First.
or direct from command prompt.
pip3 install --upgrade tensorflow
for CPU version only for TensorFlow.
pip3 install --upgrade tensorflow-gpu
for GPU version of TensorFlow