How to find which version of TensorFlow is installed in my system?
Question:
I need to find which version of TensorFlow I have installed. I’m using Ubuntu 16.04 Long Term Support.
Answers:
This depends on how you installed TensorFlow. I am going to use the same headings used by TensorFlow’s installation instructions to structure this answer.
Pip installation
Run:
python -c 'import tensorflow as tf; print(tf.__version__)' # for Python 2
python3 -c 'import tensorflow as tf; print(tf.__version__)' # for Python 3
Note that python
is symlinked to /usr/bin/python3
in some Linux distributions, so use python
instead of python3
in these cases.
pip list | grep tensorflow
for Python 2 or pip3 list | grep tensorflow
for Python 3 will also show the version of Tensorflow installed.
Virtualenv installation
Run:
python -c 'import tensorflow as tf; print(tf.__version__)' # for both Python 2 and Python 3
pip list | grep tensorflow
will also show the version of Tensorflow installed.
For example, I have installed TensorFlow 0.9.0 in a virtualenv
for Python 3. So, I get:
$ python -c 'import tensorflow as tf; print(tf.__version__)'
0.9.0
$ pip list | grep tensorflow
tensorflow (0.9.0)
If you’re using anaconda distribution of Python,
$ conda list | grep tensorflow
tensorflow 1.0.0 py35_0 conda-forge
To check it using Jupyter Notebook (IPython Notebook)
In [1]: import tensorflow as tf
In [2]: tf.__version__
Out[2]: '1.0.0'
Almost every normal package in python assigns the variable .__version__
to the current version. So if you want to find the version of some package you can do the following
import a
a.__version__
For tensorflow it will be
import tensorflow as tf
tf.version.VERSION
For old versions of tensorflow (below 0.10), use tf.__version__
import tensorflow as tf
print(tf.VERSION)
python -c 'import tensorflow as tf; print(tf.__version__)' # for Python 2
python3 -c 'import tensorflow as tf; print(tf.__version__)' # for Python 3
Here -c represents program passed in as string (terminates option list)
For python 3.6.2:
import tensorflow as tf
print(tf.version.VERSION)
To get more information about tensorflow and its options you can use below command:
>> import tensorflow as tf
>> help(tf)
If you have installed via pip, just run the following
$ pip show tensorflow
Name: tensorflow
Version: 1.5.0
Summary: TensorFlow helps the tensors flow
Easily get KERAS and TENSORFLOW version number –>
Run this command in terminal:
[[email protected]:~] python3
>>import keras; print(keras.__version__)
Using TensorFlow backend.
2.2.4
>>import tensorflow as tf; print(tf.__version__)
1.12.0
The tensorflow version can be checked either on terminal or console or in any IDE editer as well (like Spyder or Jupyter notebook, etc)
Simple command to check version:
(py36) C:WINDOWSsystem32>python
Python 3.6.8 |Anaconda custom (64-bit)
>>> import tensorflow as tf
>>> tf.__version__
'1.13.1'
On Latest TensorFlow release 1.14.0
tf.VERSION
is deprecated, instead of this use
tf.version.VERSION
ERROR:
WARNING: Logging before flag parsing goes to stderr.
The name tf.VERSION is deprecated. Please use tf.version.VERSION instead.
Tensorflow version in Jupyter Notebook:-
!pip list | grep tensorflow
If you have TensorFlow 2.x:
sess = tf.compat.v1.Session(config=tf.compat.v1.ConfigProto(log_device_placement=True))
Another variation, i guess 😛
python3 -c 'print(__import__("tensorflow").__version__)'
For knowing any version of the python library then if your library is installed using the pip then use the following command.
pip show tensorflow
The Output of the above command will be shown below:-
Name: tensorflow
Version: 2.3.0
Summary: TensorFlow is an open source machine learning framework for everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: [email protected]
License: Apache 2.0
Location: /usr/local/lib/python3.6/dist-packages
Requires: astunparse, wheel, keras-preprocessing, gast, tensorflow-estimator, opt-einsum, tensorboard, protobuf, absl-py, six, wrapt, termcolor, numpy, grpcio, scipy, google-pasta, h5py
Required-by: fancyimpute
For Windows cmd
pip list | FINDSTR tensorflow
OR
pip show tensorflow
For Linux
pip list | grep tensorflow
OR
pip show tensorflow
Printing python version in human readable format
python -c 'import sys; print(".".join(map(str, sys.version_info[:3])))'
The version of Tensorflow can simply be checked on jupyter notebook using the following simple steps.
import tensorflow as tf
print(tf.__version__) # for Python 3
I need to find which version of TensorFlow I have installed. I’m using Ubuntu 16.04 Long Term Support.
This depends on how you installed TensorFlow. I am going to use the same headings used by TensorFlow’s installation instructions to structure this answer.
Pip installation
Run:
python -c 'import tensorflow as tf; print(tf.__version__)' # for Python 2
python3 -c 'import tensorflow as tf; print(tf.__version__)' # for Python 3
Note that python
is symlinked to /usr/bin/python3
in some Linux distributions, so use python
instead of python3
in these cases.
pip list | grep tensorflow
for Python 2 or pip3 list | grep tensorflow
for Python 3 will also show the version of Tensorflow installed.
Virtualenv installation
Run:
python -c 'import tensorflow as tf; print(tf.__version__)' # for both Python 2 and Python 3
pip list | grep tensorflow
will also show the version of Tensorflow installed.
For example, I have installed TensorFlow 0.9.0 in a virtualenv
for Python 3. So, I get:
$ python -c 'import tensorflow as tf; print(tf.__version__)'
0.9.0
$ pip list | grep tensorflow
tensorflow (0.9.0)
If you’re using anaconda distribution of Python,
$ conda list | grep tensorflow
tensorflow 1.0.0 py35_0 conda-forge
To check it using Jupyter Notebook (IPython Notebook)
In [1]: import tensorflow as tf
In [2]: tf.__version__
Out[2]: '1.0.0'
Almost every normal package in python assigns the variable .__version__
to the current version. So if you want to find the version of some package you can do the following
import a
a.__version__
For tensorflow it will be
import tensorflow as tf
tf.version.VERSION
For old versions of tensorflow (below 0.10), use tf.__version__
import tensorflow as tf
print(tf.VERSION)
python -c 'import tensorflow as tf; print(tf.__version__)' # for Python 2
python3 -c 'import tensorflow as tf; print(tf.__version__)' # for Python 3
Here -c represents program passed in as string (terminates option list)
For python 3.6.2:
import tensorflow as tf
print(tf.version.VERSION)
To get more information about tensorflow and its options you can use below command:
>> import tensorflow as tf
>> help(tf)
If you have installed via pip, just run the following
$ pip show tensorflow
Name: tensorflow
Version: 1.5.0
Summary: TensorFlow helps the tensors flow
Easily get KERAS and TENSORFLOW version number –>
Run this command in terminal:
[[email protected]:~] python3
>>import keras; print(keras.__version__)
Using TensorFlow backend.
2.2.4
>>import tensorflow as tf; print(tf.__version__)
1.12.0
The tensorflow version can be checked either on terminal or console or in any IDE editer as well (like Spyder or Jupyter notebook, etc)
Simple command to check version:
(py36) C:WINDOWSsystem32>python
Python 3.6.8 |Anaconda custom (64-bit)
>>> import tensorflow as tf
>>> tf.__version__
'1.13.1'
On Latest TensorFlow release 1.14.0
tf.VERSION
is deprecated, instead of this use
tf.version.VERSION
ERROR:
WARNING: Logging before flag parsing goes to stderr.
The name tf.VERSION is deprecated. Please use tf.version.VERSION instead.
Tensorflow version in Jupyter Notebook:-
!pip list | grep tensorflow
If you have TensorFlow 2.x:
sess = tf.compat.v1.Session(config=tf.compat.v1.ConfigProto(log_device_placement=True))
Another variation, i guess 😛
python3 -c 'print(__import__("tensorflow").__version__)'
For knowing any version of the python library then if your library is installed using the pip then use the following command.
pip show tensorflow
The Output of the above command will be shown below:-
Name: tensorflow
Version: 2.3.0
Summary: TensorFlow is an open source machine learning framework for everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: [email protected]
License: Apache 2.0
Location: /usr/local/lib/python3.6/dist-packages
Requires: astunparse, wheel, keras-preprocessing, gast, tensorflow-estimator, opt-einsum, tensorboard, protobuf, absl-py, six, wrapt, termcolor, numpy, grpcio, scipy, google-pasta, h5py
Required-by: fancyimpute
For Windows cmd
pip list | FINDSTR tensorflow
OR
pip show tensorflow
For Linux
pip list | grep tensorflow
OR
pip show tensorflow
Printing python version in human readable format
python -c 'import sys; print(".".join(map(str, sys.version_info[:3])))'
The version of Tensorflow can simply be checked on jupyter notebook using the following simple steps.
import tensorflow as tf
print(tf.__version__) # for Python 3