tflearn x tensorflow 2.0

44 views
Skip to first unread message

milton barbosa felix

unread,
Jul 27, 2020, 11:22:21 AM7/27/20
to deep-learning-illustrated
Hi,
I`m Milton. I trying to run notebook Alex_net_in_keras, but I getting the message:

`No module named `tensor flow.contrib``

I think tflearn don't work with tensor flow 2.2. How do I fix this?

I didn`t get tensorflow 1.4 or less to download. In the repo there ar only tensorflow 2.2 or upper.

Milton Barbosa Felix 

Jon Krohn

unread,
Jul 27, 2020, 11:29:55 AM7/27/20
to deep-learning-illustrated
Hi Milton, thanks for reaching out. 

I presume you're using the official GitHub repo for the book? If so, which installation instructions are you following? 

Thanks,
Jon

milton barbosa felix

unread,
Jul 27, 2020, 2:02:46 PM7/27/20
to deep-learning-illustrated
Thanks for reply.

I installed successfully tensorflow and Keras. But if you use 
  • pip install tensorflow
  • pip install keras
you get tensorflow 2.2, but Tensorflow 2.0 not work with the package tflearn.

If I tip:
(tensorflow-gpu) D:\Deep Learning Illustrated>pip install tensorflow==1.4

ERROR: Could not find a version that satisfies the requirement tensorflow==1.4 (from versions: 1.13.0rc1, 1.13.0rc2, 1.13.1, 1.13.2, 1.14.0rc0, 1.14.0rc1, 1.14.0, 1.15.0rc0, 1.15.0rc1, 1.15.0rc2, 1.15.0rc3, 1.15.0, 1.15.2, 1.15.3, 2.0.0a0, 2.0.0b0, 2.0.0b1, 2.0.0rc0, 2.0.0rc1, 2.0.0rc2, 2.0.0, 2.0.1, 2.0.2, 2.1.0rc0, 2.1.0rc1, 2.1.0rc2, 2.1.0, 2.1.1, 2.2.0rc0, 2.2.0rc1, 2.2.0rc2, 2.2.0rc3, 2.2.0rc4, 2.2.0, 2.3.0rc0, 2.3.0rc1, 2.3.0rc2)

ERROR: No matching distribution found for tensorflow==1.4







Jon Krohn

unread,
Jul 27, 2020, 2:40:35 PM7/27/20
to deep-learning-illustrated
Got it, so it sounds like you're using the Windows installation instructions (i.e., for Windows versions other than 64-bit Windows 10), which are provided here

I personally don't have access to a Windows machine so I'm unable to test properly, but if you would like to ensure you're using the exact same versions of the software libraries as we use in the book then consider installing the versions provided in the book repo's Dockerfile here; that might work. Unfortunately, the only way that I can be 100% sure that you'll be able to run every single example in the book without error is by using Docker, which is supported by Mac OS, Unix, Linux, and 64-bit Windows 10, but not other versions of Windows. 

milton barbosa felix

unread,
Aug 10, 2020, 8:06:38 AM8/10/20
to deep-learning-illustrated
Thanks. I get fix it. I installed tensorflow 1.8 and worked well.

Brett

unread,
Oct 14, 2020, 11:45:00 AM10/14/20
to deep-learning-illustrated
Hello Milton and Jon. 

Milton, I think I have the same problem you experience when I run the Shallow Network in Keras Notebook. 

However, the command pip install tensorflow==1.8  does not work at the windows command line....any suggestion? Am I typing it wrong? 
Thank you!

Jon Krohn

unread,
Oct 14, 2020, 12:37:23 PM10/14/20
to deep-learning-illustrated
Thanks, Brett. To help me help you as best as I can, could you please let me know if you're following a particular set of installation instructions from the book's GitHub repo

All my best,
Jon

Brett

unread,
Oct 14, 2020, 1:10:07 PM10/14/20
to deep-learning-illustrated
Hello Jon, Thanks for the quick reply. I think I figured it out :)  

1) I downloaded the TensorFlow version that Milton suggested using Anaconda and conda. The notebook now works. By the way, the book is really cool. I have read a bunch last night and learned a lot already.

2) Beginner question: I understand that Keras is an API that makes using Tensorflow more friendly and easier for beginners just like me. Does that mean that Keras must always be used in combination with TensorFlow (backend) while TensorFlow could be used without Keras? However, I don't see "import tensorflow" in the dependencies sections of the notebook....Why?

When I run the first part of the notebook, I see the following (see attached figure). The orange box says that Tensorflow is used as backend...That is not an error, just additional information...

Thank you!

Picture1.png

Jon Krohn

unread,
Oct 14, 2020, 1:46:15 PM10/14/20
to deep-learning-illustrated
I'm glad your demos are working now, Brett! Hopefully the installation instructions link I provided in my preceding post will be helpful if you run into issues again. 

Great beginner question. Keras must be combined with *something* (some lower-level "automatic differentiation" library) on the backend. Keras was originally designed for use with the Theano library, but is now primarily associated with TensorFlow. Although the Keras API can be used in conjunction with several other backend libraries (e.g., CNTK, PlaidML, R) TensorFlow is by far the most common (and best-supported) option so it comes by default with the Keras pip install. As of TensorFlow 2 (I provide info on this in Chapter 14), Keras also now comes by default as a module within TensorFlow though, as you suggest, you don't *need* Keras to use TensorFlow but it typically makes designing and training TensorFlow-based neural networks much easier. 

Glad you're enjoying the book so far! When you ready to dive into the intricacies of lower-level tensor manipulation (e.g., with TensorFlow), check out my ML Foundations series: github.com/jonkrohn/ML-foundations

All my best,
Jon
Reply all
Reply to author
Forward
0 new messages