referring to correct tensorflow installation

Viewed 179

I am working with a python library which uses tensorflow on the background. However for it to work properly I believe it should refer to an older version of tensorflow I have installed:1.14.0. I believe on my system also tensorflow 2.1.0 is installed, which I believe it refers to now.

When running my code I get the following error:

AttributeError: module 'tensorflow' has no attribute 'set_random_seed'

Is there a way I can force my code to refer to the right tensorflow installation (i.e. 1.14.0)

I cannot simply remove installations as I am working on a shared system for which I do not have all the rights.

I have tried creating a new environment through anaconda and installing tensorflow 1.14.0 in there. However when importing tensorflow and checking the version it imports version 2.1.0.

1 Answers

You cannot force the Tensorflow Execution to select 1.14 version.

However, you can create a Virtual Environment and install Tensorflow Version 1.14 using the below steps and it will work:

sudo apt-get updateFor
# Install the Package, virtualenv
sudo apt-get install python-virtualenv
# Create a New Virtual Environment
sudo virtualenv -p /usr/bin/python3 tf_1_14_VE
# Activate the Virtual Environment
source tf_1_14_VE/bin/activate
# Install the TF Version you need
(tf_1_14_VE):~$ pip3 install tensorflow==1.14
Related