🛠️ Scheduled Maintenance | We’ll be undergoing scheduled maintenance and upgrades between 00:00 PST Jan 26th until 00:00 PST Jan 28th. There may be brief interruption of services in that period. We apologize for the inconvenience.

The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Anybody can ask a question
Anybody can answer
The best answers are voted up and moderated by our team

AttributeError: module ‘tensorflow’ has no attribute ‘placeholder’

AttributeError: module ‘tensorflow’ has no attribute ‘placeholder’


How to resolve this issue in the current version of TensorFlow
print(tf.__version__) =



1 Answer

365 Team

Hi Jignesh,
Tensorflow 2 introduced the concept of eager execution which makes the tf.placeholder method obsolete.
You’re getting this error because your have TF v.2 installed but the code is for TF v.1.
You are watching lectures of the “Deep Learning with TensorFlow” course which uses TF 1.
If you wish to follow that course, that’s fine, but make sure to have tensorflow 1.* installed in your conda environment.
Otherwise, if you wish to write in the newer TF v.2 you should follow the “Deep Learning with TensorFlow 2.0” lectures. 
Hope that helps and don’t hesitate to ask more questions as they arise!