fredy4
fredy4

Reputation: 75

importing tflearn - No module named 'tensorflow.contrib.framework'

then i type import tflearn i got the error below, i follow the guide here: https://www.youtube.com/watch?v=ViO56ASqeks

what can i use tflearn, or shall i use another code?

i got the error below.

import tflearn
  File "/usr/local/lib/python3.5/dist-packages/tflearn/__init__.py", line 4, in <module>
    from . import config
  File "/usr/local/lib/python3.5/dist-packages/tflearn/config.py", line 5, in <module>
    from .variables import variable
  File "/usr/local/lib/python3.5/dist-packages/tflearn/variables.py", line 7, in <module>
    from tensorflow.contrib.framework.python.ops import add_arg_scope as contrib_add_arg_scope
ImportError: No module named 'tensorflow.contrib.framework

can someone help me ?

20/08-2019: Edit 20.35 pip list:

tensorflow 2.0.0rc0

Upvotes: 1

Views: 9745

Answers (5)

BelinskyDEV
BelinskyDEV

Reputation: 28

If you use an conda environment (and not only, but I advise you to use it), then the solution will be to use a lower version of tensorflow pip uninstall tensorflow pip install tensorflow==1.14.0.

And it is possible to use the script to fix all errors(i used it before downgrade tf):

tf_upgrade_v2 \
  --intree my_project/ \
  --outtree my_project_v2/ \
  --reportfile report.txt

It works for me

Upvotes: 1

ParisaN
ParisaN

Reputation: 2092

You can use keras instead of tflearn.

tensorflow.contrib is being removed in version 2.0, you therefore need version <= 1.14 to operate tflearn (see here).

Upvotes: 0

Shashishekhar Hasabnis
Shashishekhar Hasabnis

Reputation: 1756

I had a similar problem and I solved it by:-

1) upgrading python to 3.6
2) pip uninstall tflearn
3) pip install git+https://github.com/tflearn/tflearn.git
4) As suggested in another solution tensorflow 2.0.0 does not support tflearn so I installed tensorflow==1.14.0

I found the solution here:- Issue Link/

Upvotes: 3

Mujeeb Ishaque
Mujeeb Ishaque

Reputation: 2711

The tutorial that you are watching uses tensorflow version 0.9 or something, current version is 2.0. The tutorial is 3 years old. You should watch updated video.

However, you can try.

pip install tensorflow==1.0
pip install tflearn

if you're using a virtual environment, make sure you have activated it.

Upvotes: 0

Alex
Alex

Reputation: 516

You need to have tensorflow installed before you can use tflearn. From the tflearn github page:

TensorFlow Installation
TFLearn requires Tensorflow (version 1.0+) to be installed.

To install tensorflow:

pip install tensorflow

Upvotes: 0

Related Questions