Keras / Debian 12.8 / Tensorflow / Python library

39 views
Skip to first unread message

oldboy

unread,
Nov 25, 2024, 6:30:02 AM11/25/24
to Keras-users
Hi, I'm trying to use Keras / Tensorflow-gpu with anaconda and Python. The dependencies are horrible and never satisfied. there is always an error ...

with the following versions :
print("python version: ”, sys.version)
print("TensorFlow version: ”, tf.__version__)
print("Panda version: ”, pd.__version__)
print("version Keras : ”, tf.keras.__version__)
print("Num GPUs Available: ‘, len(tf.config.list_physical_devices(’GPU')))
=>  
python version : 3.9.20 (main, Oct 3 2024, 07:27:41)
[GCC 11.2.0]
TensorFlow version: 2.4.1
Panda version: 2.2.2
Keras version: 2.4.0
Num GPUs Available: 1

I try to create a model :
model = Sequential()
model.add(LSTM(50, return_sequences=True, input_shape=(time_step, 1)))
model.add(LSTM(50, return_sequences=False))
model.add(Dense(25))
model.add(Dense(4, activation='softmax'))

but I still get an error:
ile ~/anaconda3/envs/IA-01/lib/python3.9/site-packages/tensorflow/python/framework/ops.py:852, in Tensor.__array__(self)
    851 def __array__(self):
--> 852 raise NotImplementedError(
853 "Cannot convert a symbolic Tensor ({}) to a numpy array."
854 " This error may indicate that you're trying to pass a Tensor to"
855 " a NumPy call, which is not supported".format(self.name))

NotImplementedError: Cannot convert a symbolic Tensor (lstm_2/strided_slice:0) to a numpy array. This error may indicate that you're trying to pass a Tensor to a NumPy call, which is not supported

EVEN  though all my variables are np arrays

Can anyone tell me if tensorflow gpu 2.4.1 is compatible with python 3.9 ?

Samer Attrah

unread,
Nov 25, 2024, 9:16:33 AM11/25/24
to Keras-users
Hello,

I just checked online and I am afraid it is not, 
so you should either downgrade python to 3.8 and you can keep the tensorflow version,
or you upgrade tensorflow to 2.5 and then you can keep the python version.
you can check the table at: 

I hope that helps.

Kind regards
Samer Attrah

oldboy

unread,
Nov 26, 2024, 12:06:29 PM11/26/24
to Keras-users

Thank you Samir for your reply. It's very annoying because I installed python 3.9 in an Anaconda environment precisely because tensorflow classic (ie NOT gpu) requires it! So, on the one hand tensorflow requires it to work BUT on the other hand tensorflow-gpu (to take advantage of nvidia CUDA) doesn't want it... Haven't we entered “the house that drives you crazy”? I confess I'm beginning to have serious doubts. Thanks again for your help in confirming that “i am in the trouble”.

Samer Attrah

unread,
Nov 26, 2024, 7:50:59 PM11/26/24
to Keras-users
Please check online because "Tensorflow-gpu" package was cancelled and removed some time ago that is why it is not in the table I shared earlier, so just by installing "tensorflow" you can use your GPU to work on machine learning.
so create an environment and install python and tensorflow library, and work. The GPU will be utilized to accelerate the running of your program.

Nicky Mac

unread,
Nov 27, 2024, 5:08:26 AM11/27/24
to abdula...@gmail.com, Keras-users
I don't use anaconda environments so
I generally struggle with dependency failures but they don't always affect one's project.
I'm on windows 3.9  and work ok with
 keras 2.10.0  numpy 1.23.0 pandas 2.2.3  tensorflow 2.10.0  torch 1.10.0 cu118.

best of luck
Nick

--
You received this message because you are subscribed to the Google Groups "Keras-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keras-users...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/keras-users/aadc70d2-1898-4b29-a386-64c014467699n%40googlegroups.com.


--
Nick "Mac" McElwaine
Reply all
Reply to author
Forward
0 new messages