ImportError: No module named 'theano'
Asked Answered
H

5

6

I have installed (/library/python/2.7/site-packages) theano on my mac and still get this error.

My code is

import theano
theano.test()

and the error

Traceback (most recent call last):
  File "/Users/mac/Downloads/n.py", line 1, in <module>
    import theano
ImportError: No module named 'theano'

I did install theano using pip install theano for python 2.7.

Any idea on why its throwing up the error.

Also I installed Anaconda and it throws the same error as working on idle.

Heman answered 4/9, 2016 at 9:5 Comment(9)
Which directory did the module install into?Pandemonium
/library/python/2.7/site-packagesHeman
Is that the only module in that directory? There are several ways around this. You can add that directory to the PYTHONPATH environment variable (usually in your .bash_profile or similar) or in the program you can append the directory name to sys.path.Pandemonium
theano is in that directory. you want a path in to theano in echo $path?Heman
Any chance you are running Python 3 when testing? How are you running your test code (relying on #! to load Python, or running python n.py)? What does python --version say?Mireielle
Running from terminal so its taking python -V Python 2.7.12Heman
Added numpy and theano to the path and it still throws up the no module for both numpy and theanoHeman
What does print sys.path say? Does it have site-packages?Idiomorphic
you mean echo $PATH? yes it has all the packagesHeman
H
5

I had the same problem trying to install pygame, i'm using python 3.4.1 so I'm not 100% sure this will work for you

Here is my folder: C:\Python34\Scriptsenter image description here

The problem: This will of course be different for you, but this is what I did anyway: I did pip install pygame and it seemed to work but when I tried import pygame I got the same error as you

My solution: instead of installing pygame with pip, I did pip3 install pygame and it worked! so for you, look at what files you have in this folder /library/python/2.7/site-packages and try all of them, try pip2 install theano, try pip2.7 install theano, try pip3 install theano, try everything!

Again I'm not certain this will work for python 2.7, but its worth a try :)

Heinie answered 4/9, 2016 at 12:59 Comment(2)
tried pip2.7 install numpy and scipy, it says already installed. Then tried pip3.6 installed numpy,theano and scipy and on compiling it says unable to import theano.. There is numpy & scipy installed in 2.7 but on compile it says "no module found". The path has been changed to to the respective directories. I am out of tricks now :/Heman
it works with me when i used: pip3 install theano , I'm suign python 3.5Buber
E
3
On windows 7, Python 3.6.0 - Anaconda 4.3.1 (64bits)  
>pip install theano   ¡thanks!

Used command view image clic

Elaterium answered 2/8, 2017 at 0:23 Comment(0)
S
0

I had similar issue, my problem was i messed up (i am very new with python) with python bins, so i had 3 versions : -- os level -- anaconda -- anaconda with virtual env

as being not aware some packegs/updates i was doing on one of above options, and theano was not working, finally realized all this mees i have created, and using virtual env version is wrokign for me

Streamer answered 13/2, 2017 at 16:19 Comment(0)
D
0

I had similiar problem, i fixed it with uninstalling all versions of Python (which were overshadowing each other), and then installing latest version 'Windows x86-64 executable installer' from here.

Dioxide answered 27/5, 2017 at 16:42 Comment(1)
I installed anaconda and use the anaconda prompt. Also use spyderHeman
T
0

I had similiar problem too,I tried serval methods,but not work. Last,this commond help me. you can try:

pip install -r https://raw.githubusercontent.com/Lasagne/Lasagne/v0.1/requirements.txt

pip install -r https://raw.githubusercontent.com/Lasagne/Lasagne/master/requirements.txt

pip install https://github.com/Lasagne/Lasagne/archive/master.zip

pip install -r https://raw.githubusercontent.com/dnouri/kfkd-tutorial/master/requirements.txt

Topnotch answered 7/7, 2017 at 2:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.