For legacy reasons, I need to use TensorFlow 1.x. I followed this guide (https://caffeinedev.medium.com/how-to-install-tensorflow-on-m1-mac-8e9b91d93706) to install TensorFlow on my M1 MacBook, however it is only able to install TensorFlow 2.x.
I am also unable to install via conda because M1 only supports Python 3.8+ for conda, whereas TensorFlow 1.x is only supported on Python 3.7 or below.
Any workarounds?
tensorflow-macos is only available from tensorflow v2.5.0 but you can simulate the v1 behaviour using the following code:
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
Related
I am using Anaconda and Ubuntu 18.04. I installed TensorFlow probability base on Anaconda's command:
conda install -c conda-forge tensorflow-probability
but when I wanted to import TensorFlow probability, I faced with below error:
ImportError: cannot import name 'compiler' from 'tensorflow.python.autograph.pyct' (/home/alireza/anaconda3/envs/tf-gpu/lib/python3.8/site-packages/tensorflow/python/autograph/pyct/init.py)
I check Anaconda by conda list tensorflow and TensorFlow probability version 0.8 was installed.
I appreciate your suggestion.
I think it's been a long time since the conda recipe for TFP was updated (TFP is now at 0.12), so you would need to ensure the version of TensorFlow you have is compatible. FWIW from the 0.8 release notes: "It is tested and stable against TensorFlow version 2.0.0 and 1.15.0rc1."
I have a code that was running on colab with Tensorflow 2.0 and now I am trying to run it on a GPU with Tensorflow 1.14 and facing several errors. Is there an easy way to upgrade to tensorflow 2.0 or is it better to modify the code and make it working on the current version?
If your code is working on colab with TF 2.0, then you can uninstall TF-GPU 1.14 and install latest version of TF 2.4.
# Uninstall tensorflow
pip uninstall tensorflow-gpu == 1.14
# Requires the latest pip
pip install --upgrade pip
# Current stable release for CPU and GPU
pip install tensorflow (which install latest version of TF 2.4)
To know more details you can refer here
I was getting the error "NotFoundError: No algorithm worked!" on an architecture that was developed based on the older versions of tensorflow (pre-2.0.0 versions), and that is run on Colab.
Now, Google Colab has an updated version of Tensorflow (post-2.0.0 versions) and Keras.
Following the question that was asked here I downgraded Tensorflow to 1.15.0 : How to downgrade tensorflow version in colab?
I used this command to downgrade Tensorflow :
!pip install tensorflow==1.15.0
import tensorflow as tf
Still, I have a problem importing Keras.
To solve the problem, I downgraded the Keras version to 2.2.4 using this command :
!pip install keras==2.2.4
I want to ask about compatibility issues between keras and tensorflow.
Specifically, how can I find the latest compatible version of keras and tensorflow? I found a lot of places including the official website of keras and did not find how to find the tensorflow version compatible with the latest keras2.24.
My current version of tensorflow+keras is 1.4.0+2.1.0, which does not support some new features.
If you don't care about having the latest Keras version, you can use the tf.Keras module that is already available with your Tensorflow installation. Check here
As per the doc:
tf.keras can run any Keras-compatible code, but keep in mind:
The tf.keras version in the latest TensorFlow release might not be the
same as the latest keras version from PyPI. Check tf.keras.version.
When saving a model's weights, tf.keras defaults to the checkpoint
format. Pass save_format='h5' to use HDF5.
I have tensorflow 1.12.0 with keras 2.2.4. I got this by downloading the latest (Anaconda3-2018.12-Windows-x86_64.exe) anaconda which has conda 4.6.4 and python 3.6.8.
I believe I then did a conda update conda and a conda update anaconda.
I then did a conda install tensorflow and a conda install keras.
Activate your environment and update your anaconda version using
conda update anaconda
Next uninstall tensorflow and keras as below
pip uninstall keras
pip uninstall tensorflow
Install Keras and tensorflow again
pip install tensorflow
pip install keras
check the version is updated.If it is not possible comment below.
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