ImportError: cannot import name gof
versions:
Theano (0.6.0)
Python 2.7.9 :: Anaconda 2.1.0 (x86_64)
in Mac OSX 10.10.1 Yosemite in case it matters.
pip 1.5.6 from /Users/skywalkerhunter/anaconda/lib/python2.7/site-packages (python 2.7)
This will need more details since we don't get such an obvious error routinely.
What is the exact command you ran? What does your python file looks like (especially the imports section)?
Also, what is your current directory when you try to import theano?
Hey I was running
(in Spyder Python 2.7, Anaconda 2.1.0 (x86_64))
in Mac OSX 10.10.1 Yosemite in case it matters.
the scripts below:
import theano
Traceback (most recent call last):
File "<ipython-input-19-3397704bd624>", line 1, in <module>
import theano
File "/Users/skywalkerhunter/anaconda/lib/python2.7/site-packages/theano/__init__.py", line 55, in <module>
from theano.compile import
File "/Users/skywalkerhunter/anaconda/lib/python2.7/site-packages/theano/compile/__init__.py", line 6, in <module>
from theano.compile.function_module import *
File "/Users/skywalkerhunter/anaconda/lib/python2.7/site-packages/theano/compile/function_module.py", line 16, in <module>
from theano import gof
ImportError: cannot import name gof
Can you update Theano to the development verion? In case it help
http://deeplearning.net/software/theano/install.html#bleeding-edge-install-instructions
On Thu, Jan 15, 2015 at 5:19 PM, oliverwreath [email protected]
wrote:
Hey I was running the scripts below:
import theano
Traceback (most recent call last):File "", line 1, in
import theanoFile "/Users/skywalkerhunter/anaconda/lib/python2.7/site-packages/theano/
_init_.py", line 55, in
from theano.compile import
File
"/Users/skywalkerhunter/anaconda/lib/python2.7/site-packages/theano/compile/
_init_.py", line 6, in
from theano.compile.function_module import *File
"/Users/skywalkerhunter/anaconda/lib/python2.7/site-packages/theano/compile/function_module.py",
line 16, in
from theano import gofImportError: cannot import name gof
—
Reply to this email directly or view it on GitHub
https://github.com/Theano/Theano/issues/2406#issuecomment-70193962.
@oliverwreath What is the result of import os; print os.getcwd() in the same environment?
| Command | Outcome |
| --- | --- |
| import os | NOTHING_PRINT |
| print os.getcwd() | /Users/my_local_user_name/Downloads |
I have the same problem. Installed Theano via git/pip, every time I get
ImportError Traceback (most recent call last)
<ipython-input-2-3397704bd624> in <module>()
----> 1 import theano
C:\Programs\Anaconda\lib\site-packages\theano-0.6.0-py2.7.egg\theano\__init__.py in <module>()
53 object2, utils
54
---> 55 from theano.compile import \
56 SymbolicInput, In, \
57 SymbolicOutput, Out, \
C:\Programs\Anaconda\lib\site-packages\theano-0.6.0-py2.7.egg\theano\compile\__init__.py in <module>()
13 from theano.compile.io import *
14
---> 15 from theano.compile.module import *
16
17 from theano.compile.debugmode import DebugMode
C:\Programs\Anaconda\lib\site-packages\theano-0.6.0-py2.7.egg\theano\compile\module.py in <module>()
9 from itertools import chain
10
---> 11 from theano import gof
12 from theano.printing import pprint
13 from theano.compile import io
ImportError: cannot import name gof
I'm using Windows 8.1 x64 with Anaconda 3.7.4 running 32-bit Python 2.7.8
Hi,
You must use Theano development version, not the last release. I'm not sure
which version of Theano you use from your email:
http://deeplearning.net/software/theano/install.html#bleeding-edge-install-instructions
Fred
On Sat, Jan 31, 2015 at 10:09 AM, lwasyl [email protected] wrote:
I have the same problem. Installed Theano via git/pip, every time I get
ImportError Traceback (most recent call last)
in ()
----> 1 import theanoC:\Programs\Anaconda\lib\site-packages\theano-0.6.0-py2.7.egg\theano__init__.py in
()
53 object2, utils
54
---> 55 from theano.compile import \
56 SymbolicInput, In, \
57 SymbolicOutput, Out, \C:\Programs\Anaconda\lib\site-packages\theano-0.6.0-py2.7.egg\theano\compile__init__.py in
()
13 from theano.compile.io import *
14
---> 15 from theano.compile.module import *
16
17 from theano.compile.debugmode import DebugModeC:\Programs\Anaconda\lib\site-packages\theano-0.6.0-py2.7.egg\theano\compile\module.py in
()
9 from itertools import chain
10
---> 11 from theano import gof
12 from theano.printing import pprint
13 from theano.compile import ioImportError: cannot import name gof
I'm using Windows 8.1 x64 with Anaconda 3.7.4 running 32-bit Python 2.7.8
—
Reply to this email directly or view it on GitHub
https://github.com/Theano/Theano/issues/2406#issuecomment-72321265.
I was using bleeding edge - pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git.
Hi, thanks - I had this problem too (Mac OS with Anaconda), and using pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git solved it.
Same bug and error.
Tried installing Theano from pip, and the bleeding edge (from Git [pip install --upgrade git+git://github.com/Theano/Theano.git]), neither helped, still getting the error and can't import.
Windows 7.1 , 64 Bit, anaconda.
Does it print any compiler error messages?
While I try import theano in python(CentOs and Python2.7.3), a lot of code jumped out from console window,then a error showed below:
Problem occurred during compilation with the command line below:
/usr/bin/g++ -shared -g -march=core2 -mcx16 -msahf -maes -mpclmul -mpopcnt -mavx
--param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=15
360 -mtune=generic -D NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -I/ho
me/gaoqi/ENV/lib/python2.7/site-packages/numpy/core/include -I/usr/local/python2
7/include/python2.7 -o /home/gaoqi/.theano/compiledir_Linux-2.6-el6.x86_64-x86_6
4-with-centos-6.6-Final-x86_64-2.7.3-64/lazylinker_ext/lazylinker_ext.so /home/g
aoqi/.theano/compiledir_Linux-2.6-el6.x86_64-x86_64-with-centos-6.6-Final-x86_64
-2.7.3-64/lazylinker_ext/mod.cpp -L/usr/local/python27/lib -lpython2.7
/usr/bin/ld: /usr/local/python27/lib/libpython2.7.a(abstract.o): relocation R_X8
6_64_32 against `.rodata.str1.8' can not be used when making a shared object; re
compile with -fPIC
/usr/local/python27/lib/libpython2.7.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
And after this , I try to import theano again ,
ImportError: cannot import name gof
came out
On Mon, May 11, 2015, JourneyGo wrote:
/usr/local/python27/lib/libpython2.7.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
The problem appears to be that the compilation is trying to link with
the static library libpython2.7.a, instead of the dynamic version of the
library (which should be something like libpython2.7.so).
Do you have it installed?
Also, please use the theano-users mailing list for requesting support,
not the github tickets.
Pascal
Hey,thanks for your reply, I did remake python and do altinstall ,solved this problem.
And also thank for reminding about mailing list.
I also had this error after first installing Theano, and in my case (which I'll describe), it was fixed by simply restarting my python process.
My situation was: I started with a new machine without Theano installed. I was using Mac OS 10.9.5 and a fresh install of Anaconda 2.3.0, 64 bit, python 2.7.10. I opened an ipython console, tried import theano, and got an ImportError because Theano wasn't installed. _Without_ closing my ipython console / kernel, I pip installed theano in a separate terminal window. (This was probably bad practice - I should have closed all python sessions before installing a new package. But alas.) With theano installed, I tried importing theano again. And that's when I got the error. Next, I tore down the ipython session and opened a new one, and the error was fixed.
I'm not sure exactly why closing & opening a new ipython kernel fixed it, but it did.
In case this helps someone,
grisaitis
@grisaitis Closing and opening up a new kernel helped me too. Thanks!
Hi!
I have the same problem, as describet above and here is what it is saying:
01065
Problem occurred during compilation with the command line below:
C:\Rtools\gcc-4.6.3\bin\g++.exe -shared -g -march=corei7 -mcx16 -msahf -mmovbe -maes -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mno-tbm -mavx -msse4.2 -msse4.1 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=4096 -mtune=generic -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -IC:\Users\user\Anaconda2\lib\site-packages\numpy\core\include -IC:\Users\user\Anaconda2\include -IC:\Users\user\Anaconda2\lib\site-packages\theano\gof -o C:\Users\user\AppData\Local\Theano\compiledir_Windows-10-10.0.10586-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-2.7.11-64\lazylinker_ext\lazylinker_ext.pyd C:\Users\user\AppData\Local\Theano\compiledir_Windows-10-10.0.10586-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-2.7.11-64\lazylinker_ext\mod.cpp -LC:\Users\user\Anaconda2\libs -LC:\Users\user\Anaconda2 -lpython27
First number - this is code line and I have more than 1000 lines above. I could paste them, if they are needed
Please use the theano-users mailing list for support requests, or StackOverflow.
Just do sudo python instead of python to open the python console. Then import theano. Works like a charm.
For historical reasons, I will note this here. In my case @theaverageguy suggestion had solved issue.
But in general, there was problem with .theano folder permissions:
sudo chown -R myuser:mygroup ~/.theano
Fixed the root of problem.
@grisaitis stressed it rightly. Closing all the python session and then doing the pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git , worked fro me. Else it was failing
static library libpython2.7.a
How could I uninstall the static library?
Most helpful comment
I also had this error after first installing Theano, and in my case (which I'll describe), it was fixed by simply restarting my python process.
My situation was: I started with a new machine without Theano installed. I was using Mac OS 10.9.5 and a fresh install of Anaconda 2.3.0, 64 bit, python 2.7.10. I opened an ipython console, tried
import theano, and got anImportErrorbecause Theano wasn't installed. _Without_ closing my ipython console / kernel, Ipip installed theano in a separate terminal window. (This was probably bad practice - I should have closed all python sessions before installing a new package. But alas.) With theano installed, I tried importing theano again. And that's when I got the error. Next, I tore down the ipython session and opened a new one, and the error was fixed.I'm not sure exactly why closing & opening a new ipython kernel fixed it, but it did.
In case this helps someone,
grisaitis