I have just installed Tensorflow 2.2.0 from a source on my Raspberry Pi 4B running Raspbian 32-bit (armv7l) OS, but when I try to run python code, it gives me the following error, I don’t know if it is something about the version as it doesn’t say anything specifically about the version of TF.
importError: cannot import name ‘L2’ from ‘tensorflow.keras.regularizers’ (/usr/local/lib/python3.7/dist-packages/tensorflow/keras/regularizers/init.py)
from future import print_function as _print_function
import sys as _sys
from tensorflow.python.keras.regularizers import L1L2
from tensorflow.python.keras.regularizers import Regularizer
from tensorflow.python.keras.regularizers import deserialize
from tensorflow.python.keras.regularizers import get
from tensorflow.python.keras.regularizers import l1
from tensorflow.python.keras.regularizers import l1_l2
from tensorflow.python.keras.regularizers import l2
from tensorflow.python.keras.regularizers import serialize
Yes, I was thinking about shifting to tf 2.5.0 but I didn’t find any article or anything to install tf 2.5.0 on RPi 4B running Raspbian 32-bit (armv7l).
Just an update: Just in case anyone runs into the same issue in the future, I had to install Raspbian 64-bit (aarch64) which is the latest version of the Raspbian OS for Raspberry Pi’s having a 64-bit architecture support, then installed Tensorflow 2.5.0 and Opencv 4.5.2 both from a source. I never recommend installing Tensorflow and OpenCV using the pip commands. Always go for sources.