Sharthak Ghosh
Sharthak Ghosh

Reputation: 596

ImportError: No module named 'tflearn'

I have installed tensorflow following the guide at the website. Tensorflow code runs perfectly, I have also installed tflearn. Problem is whenever I am trying to import tflearn it says "ImportError: No module named 'tflearn'" but tflearn is there in the site-packages directory

I have an Anaconda installation and a Conda environment for running tensorflow code

Upvotes: 11

Views: 39515

Answers (5)

sabin shahi
sabin shahi

Reputation: 1

Nothing worked for me, but downgrading python from version from 3.12.6 to version 3.10.8 worked.

Upvotes: 0

Eyong Kevin Enowanyo
Eyong Kevin Enowanyo

Reputation: 1032

I also had the same problem when I did the following installations conda install scipy h5py pip install tensorflow pip install tflearn

I had a warning that a package needed Cython but it wasn't installed. So to solve the problem, I did: pip install cython pip install tensorflow conda install scipy h5py pip install tflearn

Upvotes: 0

Sundar Gsv
Sundar Gsv

Reputation: 647

This solution might look very long and wierd, but trust me it doesnt throw any errors/ exceptions. It works perfect.

You could also try doing by activating the virtual env,

For example in my case, I have different environment where I use to work around all ML, NLP code here.

Activate your virtual env first,

$ source activate myML-env

which will open new environment, like below

(myML-env)$

Now within this env, hit enter after this below command to install your tflearn package only within this environment.

(myML-env)$ pip install tflearn

Don't panic if tflearn works well even in python 3.X. (NOTE: Make sure you have tensorflow already installed in this Virtual environment, if not use the same command with the slight change [pip install tensorflow])

Now follow the below command to deactivate the current virtual env,

$ source deactivate myML-env

Now open your Anaconda >> Environments >> Select myML-env, now open your spyder application from this environment.

Upvotes: 1

caramelslice
caramelslice

Reputation: 369

Seems to be an Anaconda issue.

pip install tflearn 

was throwing parse errors. This worked for me: open Anaconda prompt

conda install pip
pip install tflearn

Upvotes: 10

Sharthak Ghosh
Sharthak Ghosh

Reputation: 596

Thanks a lot, it worked. I first uninstalled tflearn, then activated the tensorflow environment and simply did a pip install tflearn. Then installed h5py and scipy after that. It works perfectly now. Thanks to Zhongyu Kuang for pointing out the difference between the environments.

Upvotes: 4

Related Questions