ageron / ageron/handson-ml2

Chapter 10 neither attribute keras.wrapper nor keras.__version__ being found :/

Open
#618 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
30k
Forks
13.1k
PR merge metrics
No merged PRs in 30d

Description

I'm receiving errors with my keras package where it isn't recognizing the .__version__ or .wrapper attributes.

In [11] in the official notebook :
```python
keras.__version__
```

This yields this error:
```stacktrace
AttributeError Traceback (most recent call last)
Cell In[9], line 1
----> 1 keras.__version__

File ~/miniconda3/envs/cs200-env/lib/python3.9/site-packages/tensorflow/python/util/lazy_loader.py:59, in LazyLoader.__getattr__(self, item)
57 def __getattr__(self, item):
58 module = self._load()
---> 59 return getattr(module, item)

AttributeError: module 'keras.api._v2.keras' has no attribute '__version__'
```
And.... In [95] in the official notebook :
```python
keras_reg = keras.wrappers.scikit_learn.KerasRegressor(build_model)
```

This code yields this error...
```stacktrace
AttributeError Traceback (most recent call last)
Cell In[92], line 1
----> 1 keras_reg = keras.wrappers.scikit_learn.KerasRegressor(build_model)

File ~/miniconda3/envs/cs200-env/lib/python3.9/site-packages/tensorflow/python/util/lazy_loader.py:59, in LazyLoader.__getattr__(self, item)
57 def __getattr__(self, item):
58 module = self._load()
---> 59 return getattr(module, item)

AttributeError: module 'keras.api._v2.keras' has no attribute 'wrappers'
```

I'm using...
- OS: [e.g. MacOSV 13.3.1
- Python: 3.9.16
- Keras: .api._v2.keras
- TensorFlow: 2.13.0-rcl

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.