Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Installing Tensorflow
#1
Hi everyone,

I am trying to install tensorflow in Spyder with the code below:

$ pip3 install --upgrade tensorflow

I am getting error:

$ pip3 install --upgrade tensorflow
File "<ipython-input-17-b0ab32851392>", line 1
$ pip3 install --upgrade tensorflow
^
SyntaxError: invalid syntax

I've also tried without the $ sign as per Tensorflow website but still no luck. Does anyone have any advice on installing tensorflow or how to use pip install?

Thanks
Reply
#2
Are you doing this in the Python interpreter instead of the terminal?
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#3
Yes I think so. How do I open/do it in terminal? I use Spyder to make it all easier.
Reply
#4
On Windows, hit CTRL+R and type cmd into the text field then hit Enter.

On Linux, open the program menu, under the System category there is a Terminal application. Usually, there is a starter in the pannel too.

Mac OS, I don't know.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#5
When I push Ctrl+R in spyder it just gives me a search box. Do I need A program open when pushing ctrl+R?
Reply
#6
Ctrl+R did nothing for me either in Windows 8.1 or Window 10. This has nothing to do with Spyder, this is Windows specific.

To get the Windows command line prompt in Windows 10:
a. Right Click the Windows Icon at the Bottom Left of the Screen
b. Select 'Command Prompt' (or Powershell)

Lewis
To paraphrase: 'Throw out your dead' code. https://www.youtube.com/watch?v=grbSQ6O6kbs Forward to 1:00
Reply
#7
I am not talking about Spyder.
I am talking about Windows.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#8
I opened command prompt and type the following and got this error:

C:\Users\SGrah>$ pip3 install --upgrade tensorflow
'$' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\SGrah>pip3 install --upgrade tensorflow
'pip3' is not recognized as an internal or external command,
operable program or batch file.

Any ideas/help?

Thanks everyone
Reply
#9
In Windows the command prompt ends in >
In Linux and Mac it ends in $
So the dollar sign is part of the command prompt and is not part of the command you have to run
Type just pip3 install --upgrade tensorflow
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#10
@Scott from your previous post you use Anaconda.
Look at my tutorial here.
From start with cmd(as i don't like do use),i always use cmder.
Start cmd as admin
Microsoft Windows [Version 10.0.17134.48]
(c) 2018 Microsoft Corporation. Med enerett.

C:\WINDOWS\system32>g:

G:\>cd anaconda3\Scripts

G:\Anaconda3\Scripts>conda -V
conda 4.5.4

G:\Anaconda3\Scripts>pip -V
pip 9.0.1 from G:\Anaconda3\lib\site-packages (python 3.6)

G:\Anaconda3\Scripts>pip3 -V
pip 10.0.1 from c:\python36\lib\site-packages\pip (python 3.6)
So i have cd in into Scripts folder of Anaconda3.
Here i check version,so i have to use pip as pip3 point to my OS Python.
They advice to use pip for tensorflow.
Usually would use conda to install in to Anaconda eg conda install some_package.
G:\Anaconda3\Scripts>pip install --upgrade tensorflow
Collecting tensorflow
  Downloading https://files.pythonhosted.org/packages/f4/88/980d7032b7408fcca5b0b8d420fcd97919197a9e7acf280ab74fc7db6993/tensorflow-1.8.0-cp36-cp36m-win_amd64.whl (34.4MB)
    100% |████████████████████████████████| 34.4MB 37kB/s
Collecting termcolor>=1.1.0 (from tensorflow)
  Downloading https://files.pythonhosted.org/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz
Collecting tensorboard<1.9.0,>=1.8.0 (from tensorflow)
  Downloading https://files.pythonhosted.org/packages/59/a6/0ae6092b7542cfedba6b2a1c9b8dceaf278238c39484f3ba03b03f07803c/tensorboard-1.8.0-py3-none-any.whl (3.1MB)
    100% |████████████████████████████████| 3.1MB 378kB/s
Collecting numpy>=1.13.3 (from tensorflow)
  Downloading https://files.pythonhosted.org/packages/af/e4/7d7107bdfb5c33f6cf33cdafea8c27d1209cf0068a6e3e3d3342be6f3578/numpy-1.14.3-cp36-none-win_amd64.whl (13.4MB)
ect..............
Successfully installed absl-py-0.2.2 astor-0.6.2 gast-0.2.0 grpcio-1.12.0 html5lib-0.9999999 markdown-2.6.11 numpy-1.14.3 protobuf-3.5.2.post1 setuptools-39.2.0 tensorboard-1.8.0 tensorflow-1.8.0 termcolor-1.1.0 werkzeug-0.14.1 wheel-0.31.1
Test that it work:
Got error,so look like i need newer GPU or CUDA version.
As tensorflow can use GPU,you may need to look at what's supported.
I could downgrade to CPU version only tensoreflow==1.5,
but this was just a demo of install so will not use more time on it.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Installing tensorflow Blue Dog 7 5,056 Nov-10-2019, 11:54 PM
Last Post: snippsat
  Installing Tensorflow-GPU Help junzhi 1 3,229 Oct-04-2018, 12:40 PM
Last Post: Larz60+
  Installing Tensorflow-GPU junzhi 2 3,754 Sep-30-2018, 07:43 AM
Last Post: junzhi

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020