Unable to run python-tensorflow-opt-cuda code

I have installed:

sudo pacman -S python-tensorflow-opt-cuda

but cannot run:

   ~  python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"                  ✔   
2024-12-11 20:13:47.064157: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:477] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
E0000 00:00:1733944427.098978    6650 cuda_dnn.cc:8310] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
E0000 00:00:1733944427.106910    6650 cuda_blas.cc:1418] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]

Why do you believe this? It printed the GPU, what did you expect? There are also some Warnings from the import that can be ignored in this case, but nothing that prevents the script from running.

Thank you for your message!

I wondered about the error E0000…

Actually I cannot run a tensorflow programm in IDE that runs well in windows - without GPU usage only on CPU.

I have this error on Manjaro - with GPU:

Process finished with exit code 134 (interrupted by signal 6:SIGABRT)

And: no, I do not have a minimal example, but I can paste the - short - tensorflow programm, if requested.

This is my JDK, which is given as a possible solution by google:

    ~  java -version                                                                                                                                                                           ✔  27s    
openjdk version "21.0.5" 2024-10-15
OpenJDK Runtime Environment (build 21.0.5+11)
OpenJDK 64-Bit Server VM (build 21.0.5+11, mixed mode, sharing)

Any idea?

Python PyTorch on GPU just runs fine, though!

The error is at the last comment:

import tensorflow as tf
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import MinMaxScaler, OneHotEncoder
from sklearn import datasets


digits = datasets.load_digits()
#
#
# # 2. Skalieren der Merkmale auf den Bereich [0, 1]
scaler = MinMaxScaler()
digits_scaled = scaler.fit_transform(digits.data)
#

# # Creating the encoder
enc = OneHotEncoder(handle_unknown='ignore', sparse_output=False)
#
result = enc.fit_transform(digits.target.reshape(-1, 1))

ratio = 0.2
X_train, X_test, y_train, y_test = train_test_split(digits_scaled, result, test_size=ratio, random_state=42)

model1 = tf.keras.models.Sequential()
model1.add(tf.keras.layers.Input(X_train.shape[1:])) #Process finished with exit code 134 (interrupted by signal 6:SIGABRT)

# model1.add(tf.keras.layers.Dense(128, input_dim=64, activation="relu")) # hidden1
# model1.add(tf.keras.layers.Dense(64, activation="relu")) # hidden2
# model1.add(tf.keras.layers.Dense(10, activation='softmax')) # outputlayer
# model1.summary()
# model1.compile(loss="categorical_crossentropy", optimizer=tf.keras.optimizers.SGD(learning_rate=0.01), # Adam()
#                metrics=(['accuracy']))