Hi,
Upgraded to spyder 3.1. and tried to import tensorflow and got these errors on the ipython console
import tensorflow
Traceback (most recent call last):
File "<ipython-input-1-a649b509054f>", line 1, in <module>
import tensorflow
File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 100, in <module>
from tensorflow.python.platform import app
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 23, in <module>
from tensorflow.python.platform import flags
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/flags.py", line 25, in <module>
_global_parser = _argparse.ArgumentParser()
File "/usr/lib/python2.7/argparse.py", line 1586, in __init__
prog = _os.path.basename(_sys.argv[0])
IndexError: list index out of range
It was working before in spyder3.0.2. tensorflow and ipython (5.1.0) versions have not changed. It also works on spyder's python console tab:
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
>>> tensorflow.__version__
'0.12.1'
OS is Ubuntu 16.04 64 bit
P.S same issue with spyder git master.
@andfoy, this one is for you because you changed that. sys.argv
has to be equal to ['']
but you left it equal to []
. This is a very simple change :-)
And please don't forget to do the PR against the 3.1.x
branch, not 3.x
.
@ccordoba12 Actually, the line that restarts the sys.argv
argument is defined as follows (As per PR #3918):
clear_argv = 'import sys;sys.argv = [''];del sys'
In that case, I don't know exactly where the reinitialization of arguments fails.
@ccordoba12 If I try the following setting, then the import will work, but it is correct to make this modification?
clear_argv = 'import sys;sys.argv = ["", ""];del sys'
I think the original problem is that you were using single quotes for the clear_argv
code and for the contents of sys.argv
itself, so this should work:
clear_argv = "import sys;sys.argv = [''];del sys"
(notice the double outside quotes :-)
So what's the solution in this error? I face the same problem actually.
@DolanDack we are releasing a new bugfix version tomorrow that should fix the issue
Has the bugfix been released? My latest spyder3.1.0 still has the same issue. (64bit windows 10)
edit: I just checked, the package is missing in current win-64 channels. Any idea when it will be released for win-64?
The bug fix has not yet been released, sorry. Some issues unexpectedly turned up during testing. Hopefully 3.1.1 will be released today, and then it typically takes a couple of days for the package to turn up in the anaconda channels.
Most helpful comment
The bug fix has not yet been released, sorry. Some issues unexpectedly turned up during testing. Hopefully 3.1.1 will be released today, and then it typically takes a couple of days for the package to turn up in the anaconda channels.