UOB-AI / UOB-AI.github.io

A repository to host our documentations website.
https://UOB-AI.github.io
1 stars 3 forks source link

Error in Runing the code that related to Tenserflow . #55

Closed Amalsalem closed 2 months ago

Amalsalem commented 5 months ago

i tried to run :

try: %tensorflow_version 1.x except Exception: pass import sys

sys.path.insert(0, '/home/nfs/20015279/DynAE_Amal_Ap') sys.path.insert(0, '/home/nfs/20015279/DynAE_Amal_Ap/data') import tensorflow as tf

from tensorflow.keras.optimizers import SGD, Adam

import os import numpy as np from time import time

from DynAE import DynAE

from DynAE_fmnist import DynAE from datasets import load_data, load_data_conv import metrics from metrics import clustering_metrics import pandas as pd

Error:

I have this error message : SymbolAlreadyExposedError: Symbol Zeros is already exposed as (). ​ in the line ( import tensorflow as tf )

this error is in : DynAE_Amal_Ap /
Notebook : dynAE_Fmnist_Err

Amalsalem commented 5 months ago

Also , I tried to uninstall Terserflow from my environment, So i can use the version 2.11.0 . but i couldnot it shows: access denied.

asubah commented 5 months ago

I have this error message : SymbolAlreadyExposedError: Symbol Zeros is already exposed as ().

This is probably because the local tensorflow package is broken for some reason.

Also , I tried to uninstall Terserflow from my environment, So i can use the version 2.11.0 . but i couldnot it shows: access denied.

Because it is trying to remove the package in the base environment, which should not happen unless the local one is broken and pip can't recognize it.

You can remove the local tensorflow package by deleting the following directory:

~/.local/lib/python3.9/site-packages/tensorflow

BTW, you can use code and syntax hilighting to make your code more readable in the issue. See this link: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code-and-syntax-highlighting

Amalsalem commented 5 months ago

Issue Description:

I attempted to remove the directory ~/.local/lib/python3.9/site-packages/tensorflow and ran the following code:

try:
    %tensorflow_version 1.x
except Exception:
    pass

import sys
sys.path.insert(0, '/home/nfs/20015279/DynAE_Amal_Ap')
sys.path.insert(0, '/home/nfs/20015279/DynAE_Amal_Ap/data')

import tensorflow as tf
from tensorflow.keras.optimizers import SGD, Adam

However, I encountered the following error:

SymbolAlreadyExposedError: Symbol Zeros is already exposed as ()

This error occurred on the line import tensorflow as tf.

asubah commented 5 months ago

This happened because you have a local keras installation that conflicts with the base environment tensorflow. If you run pip show keras you will get:

Name: keras
Version: 2.15.0
Summary: Deep learning for humans.
Home-page: https://keras.io/
Author: Keras team
Author-email: keras-users@googlegroups.com
License: Apache 2.0
Location: /home/nfs/20015279/.local/lib/python3.9/site-packages
Requires: 
Required-by: tensorflow

Notice the version of keras is 2.15.0, but the tensorflow in the base environment is version 2.11.0.

In the base environment, there is already an installation of keras with the proper version:

Name: keras
Version: 2.11.0
Summary: Deep learning for humans.
Home-page: https://keras.io/
Author: Keras team
Author-email: keras-users@googlegroups.com
License: Apache 2.0
Location: /data/software/miniconda3/lib/python3.9/site-packages
Requires: 
Required-by: tensorflow