I used these instructions to build up a conda env and train tensorflow model:
conda create --name tf210 python=3.8
conda activate tf210
conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0
pip install tensorflow-gpu==2.10.0 keras==2.10.0
pip install opencv-python==4.4.0.44 pillow==8.2 numpy==1.22 matplotlib scipy pandas scikit-learn tqdm imutils PyYAML tensorboard seaborn protobuf==3.20 chardet
pip install tensorflow-datasets==4.6.0
conda install ipykernel
python -m ipykernel install --user --name=tf210 --display-name="tf210"
conda install -c conda-forge widgetsnbextension ipywidgets
The env worked well and I trained my MNIST model, but when I try to install the package below, my code reported errors. I wonder how can I fix this problem and export my tensorflow model directly into ONNX model.
pip install tf2onnx
pip install onnxruntime
Here is the error log:
Traceback (most recent call last):
File "F:pythonProjectmain.py", line 3, in <module>
import tensorflow_datasets as tfds
File "D:Anacondaenvstf210libsite-packagestensorflow_datasets__init__.py", line 52, in <module>
from tensorflow_datasets import image
File "D:Anacondaenvstf210libsite-packagestensorflow_datasetsimage__init__.py", line 43, in <module>
from tensorflow_datasets.image.dsprites import Dsprites
File "D:Anacondaenvstf210libsite-packagestensorflow_datasetsimagedsprites.py", line 23, in <module>
import h5py
File "D:Anacondaenvstf210libsite-packagesh5py__init__.py", line 26, in <module>
from . import _errors
ImportError: DLL load failed while importing _errors:The specified program cannot be found.
I searched the Internet and tried to find out which package is in conflict, but I failed. It seems that all the packages in my conda list are correct except the protobuf 3.20.3, but there is an answer in Stackoverflow that shows protobuf 3.20.x is the only suitable version for tensorflow-gpu 2.10.0 and tensorboard 2.14.0.
I wonder if I can still use tensorflow-gpu 2.10.0 and exported my tensorflow model into ONNX model, yet I haven’t figure out where the conflict is. I would be appreciated if anyone answers my question. Tell me if there is more details and information needed.
Me262-Stormbird is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1