ageron / handson-ml2

A series of Jupyter notebooks that walk you through the fundamentals of Machine Learning and Deep Learning in Python using Scikit-Learn, Keras and TensorFlow 2.
Apache License 2.0
27.77k stars 12.73k forks source link

Chapter 18: cannot import name 'naming' from 'tensorflow.python.autograph.core' #148

Open Quoding opened 4 years ago

Quoding commented 4 years ago

Hi,

I've been trying to make the TF-Agents examples work on my machine and I keep getting this error which I can't seem to find a solution for (went on Tensorflow's github repo to search for issues and at a surface level nothing seemed to match what I had).

The error is the following : ImportError: cannot import name 'naming' from 'tensorflow.python.autograph.core' (/home/quoding/AI/ai_venv/lib/python3.7/site-packages/tensorflow/python/autograph/core/__init__.py)

This error happens when importing with this line: from tf_agents.environments import suite_atari

I have installed the Python packages in the following manner : pip install -r requirements.txt with the requirements.txt file provided in this repo.

If it is worth noting, the error happens in the Notebook as well as in an editor with only the code.

I'll keep looking for a workaround, but any help is appreciated.

tfboyd commented 4 years ago

This issue started for me with TensorFlow nightly but TensorFlow 2.2 seems to be working fine for me. I do not know how it relates to this branch, but I recently did the release of TF-Agents 0.5.0RC and it passes all the tests and the colabs run with TF 2.2 Here is the branch. and 0.5.0 will be the official stable in 24 hours or so.

ageron commented 3 years ago

Hi @tfboyd, I updated the project to use the latest version of TensorFlow and TF Agents. Could you please update your libs to the latest versions (see environment.yml) and update the project? Everything should work fine now.