I have installed tensorflow and keras via pip and want to use it, but the following import is failing:
from tensorflow import keras
from tensorflow.keras.models import Sequential #This line fails
The error:
File "...AppDataLocalProgramsPythonPython39libsite-packageskerassrctree__init__.py", line 1, in <module>
from keras.src.tree.tree_api import assert_same_structure
File ""...AppDataLocalProgramsPythonPython39libsite-packageskerassrctreetree_api.py", line 10, in <module>
raise ImportError(
ImportError: To use Keras, you need to have `optree` installed. Install it via `pip install optree`
I checked that optree is installed, tried to reinstall it but no luck. Does anyone face this issue?
Versions:
- Tensforflow 2.16.1
- Keras 3.3.3
- Optree 0.11.0
New contributor
Vadim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.