teachablemachine-community
teachablemachine-community copied to clipboard
[BUG]: python using latest tensorflow issue
Hi,
I copied the code from this link https://github.com/googlecreativelab/teachablemachine-community/blob/master/snippets/markdown/image/tensorflow/keras.md And changed the testing image path. But when I run the python code, There is error. I suspect it may be the tensorflow library version issue? Or did I do something wrong? If yes, how to update the model to the latest tensorflow?
Thanks.
[Running] python -u "d:\temp\testing\teachablemachine\converted_keras\code.py"
2022-07-05 23:20:38.487534: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2022-07-05 23:20:38.515442: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
File "d:\temp\testing\teachablemachine\converted_keras\code.py", line 1, in <module>
from keras.models import load_model
File "D:\Anaconda3_2021\lib\site-packages\keras\__init__.py", line 21, in <module>
from tensorflow.python import tf2
File "D:\Anaconda3_2021\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "D:\Anaconda3_2021\lib\site-packages\tensorflow\python\__init__.py", line 41, in <module>
from tensorflow.python.eager import context
File "D:\Anaconda3_2021\lib\site-packages\tensorflow\python\eager\context.py", line 29, in <module>
import numpy as np
File "D:\Anaconda3_2021\lib\site-packages\numpy\__init__.py", line 150, in <module>
from . import core
File "D:\Anaconda3_2021\lib\site-packages\numpy\core\__init__.py", line 72, in <module>
from . import numeric
File "D:\Anaconda3_2021\lib\site-packages\numpy\core\numeric.py", line 23, in <module>
from . import shape_base
File "D:\Anaconda3_2021\lib\site-packages\numpy\core\shape_base.py", line 11, in <module>
from ._asarray import array, asanyarray
File "D:\Anaconda3_2021\lib\site-packages\numpy\core\_asarray.py", line 6, in <module>
from .overrides import (
ImportError: cannot import name 'set_array_function_like_doc' from 'numpy.core.overrides' (D:\Anaconda3_2021\lib\site-packages\numpy\core\overrides.py
It seems like my numpy is not update... sorry. But I still have problem with other libraries. May I know if the model works with the latest tensorlfow and Kera? Thx
Hi,
I have updated all library, here is the error.... >_< I looked at this stack overflow, https://stackoverflow.com/questions/72029857/no-module-named-tensorflow-compat People are confused which version should be used....
[Running] python -u "d:\temp\testing\teachablemachine\converted_keras\code.py"
2022-07-06 00:52:05.764216: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2022-07-06 00:52:05.764575: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
File "d:\temp\testing\teachablemachine\converted_keras\code.py", line 1, in <module>
from keras.models import load_model
File "D:\Anaconda3_2021\lib\site-packages\keras\__init__.py", line 21, in <module>
from tensorflow.python import tf2
File "D:\Anaconda3_2021\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "D:\Anaconda3_2021\lib\site-packages\tensorflow\python\__init__.py", line 46, in <module>
from tensorflow.python import data
File "D:\Anaconda3_2021\lib\site-packages\tensorflow\python\data\__init__.py", line 25, in <module>
from tensorflow.python.data import experimental
File "D:\Anaconda3_2021\lib\site-packages\tensorflow\python\data\experimental\__init__.py", line 96, in <module>
from tensorflow.python.data.experimental import service
File "D:\Anaconda3_2021\lib\site-packages\tensorflow\python\data\experimental\service\__init__.py", line 140, in <module>
from tensorflow.python.data.experimental.ops.data_service_ops import distribute
File "D:\Anaconda3_2021\lib\site-packages\tensorflow\python\data\experimental\ops\data_service_ops.py", line 25, in <module>
from tensorflow.python.data.experimental.ops import compression_ops
File "D:\Anaconda3_2021\lib\site-packages\tensorflow\python\data\experimental\ops\compression_ops.py", line 20, in <module>
from tensorflow.python.data.util import structure
File "D:\Anaconda3_2021\lib\site-packages\tensorflow\python\data\util\structure.py", line 26, in <module>
from tensorflow.python.data.util import nest
File "D:\Anaconda3_2021\lib\site-packages\tensorflow\python\data\util\nest.py", line 41, in <module>
from tensorflow.python.framework import sparse_tensor as _sparse_tensor
File "D:\Anaconda3_2021\lib\site-packages\tensorflow\python\framework\sparse_tensor.py", line 29, in <module>
from tensorflow.python.framework import constant_op
File "D:\Anaconda3_2021\lib\site-packages\tensorflow\python\framework\constant_op.py", line 29, in <module>
from tensorflow.python.eager import execute
File "D:\Anaconda3_2021\lib\site-packages\tensorflow\python\eager\execute.py", line 28, in <module>
from tensorflow.python.framework import ops
File "D:\Anaconda3_2021\lib\site-packages\tensorflow\python\framework\ops.py", line 63, in <module>
from tensorflow.python.platform import app
File "D:\Anaconda3_2021\lib\site-packages\tensorflow\python\platform\app.py", line 23, in <module>
from absl.app import run as _run
File "D:\Anaconda3_2021\lib\site-packages\absl\app.py", line 35, in <module>
import pdb
File "D:\Anaconda3_2021\lib\pdb.py", line 77, in <module>
import code
File "d:\temp\testing\teachablemachine\converted_keras\code.py", line 1, in <module>
from keras.models import load_model
File "D:\Anaconda3_2021\lib\site-packages\keras\models.py", line 18, in <module>
import tensorflow.compat.v2 as tf
ModuleNotFoundError: No module named 'tensorflow.compat'
Just try the latest version for all.
@AK51 seems like you don't have the tensorflow module downloaded, could you try it with tensorflow installed as well? pip install tensorflow