These are chat archives for spyder-ide/public

1st
Feb 2019
paulgureghian
@paulgureghian_gitlab
Feb 01 03:40
Untitled.png
It seems to import and use tensorflow in the script, but the ipython console says tensorflow is not installed.
CAM Gerlach
@CAM-Gerlach
Feb 01 03:43
Please read and follow our guide to managing packages and environments with Spyder. Also, try opening a jupyter qtconsole (type that in Anaconda prompt) in the same environment you are running Spyder in, and see if you can import tensorflow there.
paulgureghian
@paulgureghian_gitlab
Feb 01 03:43
it works in the script though
is the console message accurate ?
CAM Gerlach
@CAM-Gerlach
Feb 01 03:44
You mean if you run the whole script as a file (F5 by default) it works, but if you run import tensorflow directly in the IPython console, it doesn't?
Again, please try in a jupyter qtconsole instance opened in the same environment and see if it works there.
paulgureghian
@paulgureghian_gitlab
Feb 01 03:45
its working isnt it ?
CAM Gerlach
@CAM-Gerlach
Feb 01 03:46
I don't know; that's why I was asking you.
paulgureghian
@paulgureghian_gitlab
Feb 01 03:46
im only using it in the app
CAM Gerlach
@CAM-Gerlach
Feb 01 03:46
?
What app?
paulgureghian
@paulgureghian_gitlab
Feb 01 03:46
the script
i know sometimes things only work in the script and/ or the console
CAM Gerlach
@CAM-Gerlach
Feb 01 03:47
So, to confirm, if you run the script via Run File (F5 by default), no error appears. However, if you type import tensorflow in the IPython console, it fails to import. Is this correct? Does the order of these two matter? Again, does it work in jupyter qtconsole)?

i know sometimes things only work in the script and/ or the console

IPython magics only work in the console (as intended), but other than that this shouldn't really be the case other than things that behave that way in normal a normal interactive python session vs. a Python script run via the IPython interpreter directly.

paulgureghian
@paulgureghian_gitlab
Feb 01 03:49
in this case im only using it in the script. why is it giving an error in the console though ? just disregard it ?
CAM Gerlach
@CAM-Gerlach
Feb 01 03:49
...
So, if you run the script, it does give you the error shown in the screenshot?
paulgureghian
@paulgureghian_gitlab
Feb 01 03:49
yes
CAM Gerlach
@CAM-Gerlach
Feb 01 03:51
So why did you say the script works then?
paulgureghian
@paulgureghian_gitlab
Feb 01 03:51
it seems to work , but then the error says it didnt find tensorflow
im able to use the tf alias
CAM Gerlach
@CAM-Gerlach
Feb 01 03:52
I'm not sure how I understand how it "seem to work" when it stops on the very first line of the script with a fatal error?
paulgureghian
@paulgureghian_gitlab
Feb 01 03:53
i guess you are right. guess i misunderstood the whole thing
since i was able to use the tensorflow alias i thought it worked
CAM Gerlach
@CAM-Gerlach
Feb 01 03:53
Be able to use how?
Did you try running it again? If you restart the console and run the script once, does it work? Again, can you try what I'm asking you to and try importing tensorflow in jupyter qtconsole and see if you get the same error? If so, its not related to Spyder assuming you installed it in the correct environment (as discussed in the guide I link).
paulgureghian
@paulgureghian_gitlab
Feb 01 03:54
like call tf.get-default_graph()
ill have to try the qt fix tomorrow
CAM Gerlach
@CAM-Gerlach
Feb 01 03:55
Okay. Again, can you please try all the things I've asked you to and report the results?
Qt fix?
paulgureghian
@paulgureghian_gitlab
Feb 01 03:55
yes. ill try it tomorrow
CAM Gerlach
@CAM-Gerlach
Feb 01 03:55
Its not a fix. Its just a test to see if it occurs outside of Spyder.
paulgureghian
@paulgureghian_gitlab
Feb 01 03:56
ok. lets see tomorrow
CAM Gerlach
@CAM-Gerlach
Feb 01 03:56
Okay, thanks. Let us know and best of luck!
paulgureghian
@paulgureghian_gitlab
Feb 01 19:12
the qt console app ?
CAM Gerlach
@CAM-Gerlach
Feb 01 19:13
Jupyter QtConsole. You can open it from Anaconda Navigator or by typing jupyter qtconsole in the Anaconda prompt. The frontend of Spyder's IPython Console is directly based on it and we maintain it.
paulgureghian
@paulgureghian_gitlab
Feb 01 19:15
can i just open the env in a terminal from within navigator ?
CAM Gerlach
@CAM-Gerlach
Feb 01 19:15
Just open Anaconda prompt directly, then type activate name-of-environment.
Make sure this is the same environment you have your interpreter set to in Spyder's Preferences > Python Interpreter. If that setting is set to default, (Same environment as Spyder), then its whatever environment you opened Spyder in. If you open it from the shortcut, or from the Anaconda prompt without activating a specific environment, that's base, the default environment, so you don't have to activate anything. If any of this confuses you, please read the guide I linked above that I've asked you to read that explains how all this works more clearly.
paulgureghian
@paulgureghian_gitlab
Feb 01 19:19
Untitled.png
CAM Gerlach
@CAM-Gerlach
Feb 01 19:22
Either there is a problem with your Tensorflow install, or you are running your Consoles in the wrong environment. If you read and follow the instructions in the guide I linked, you should be able to fix the latter, and know how to use different environments with Spyder. If its the former, then Spyder has no control over it.
Best of luck!