3

I am using minconda and have python 3.7 installed on a Windows 7 machine. I was instructed to use the following commands at the Anaconda prompt:

conda create --name=IntroToTensorFlow python=3 anaconda
source activate IntroToTensorFlow

Windows did not recognize the word source, but did accept the command when I removed the word source

conda install -c conda-forge tensorflow

the system responds to the last command:

(IntroToTensorFlow) C:\>conda install -c conda-forge tensorflow

Solving environment: done

==> WARNING: A newer version of conda exists. <==

current version: 4.5.11

latest version: 4.5.12

Please update conda by running

$ conda update -n base -c defaults conda

I updated conda using the above command. There is a hello world program that is suggested to run in a jupyter notebook:

import tensorflow as tf
# Create TensorFlow object called tensor
hello_constant = tf.constant('Hello World!')
with tf.Session() as sess:
# Run the tf.constant operation in the session
output = sess.run(hello_constant)
print(output)

The error is as follows:

ModuleNotFoundError Traceback (most recent call last) in ----> 1 import tensorflow as tf 2 3 # Create TensorFlow object called tensor 4 hello_constant = tf.constant('Hello World!') 5 ModuleNotFoundError: No module named 'tensorflow'

When I enter at Anaconda prompt:

conda list 

TensorFlow shows up on the list

I have read something that Python is not supported yet and should roll back to a previous version of Python 3.6.5 with something called brew. Is this still true? The post is 6 months old

https://apple.stackexchange.com/questions/329187/homebrew-rollback-from-python-3-7-to-python-3-6-5-x

brew info python 'brew' is not recognized as an internal or external command, operable program or batch file. 

What is brew and how do I run it? Is there a Windows 7 alternative? It looks like an Apple system command.

1

What is brew and how do I run it? Is there a Windows 7 alternative? It looks like an Apple system command.

brew is part of the macOS Homebrew package manager and isn't applicable to Windows 7.

Tensorflow Python Version Support

Regarding Python version support, this Tensorflow GitHub issues thread seems to indicate that support for Python 3.7.x (the default Python 3 for current versions of Anaconda, as I understand it) may only be available if you compile Tensorflow yourself (i.e. not through Anaconda).

Creating A Python 3.6 Environment In Anaconda

According to the official Anaconda documentation, you may wish to try:

conda create -n IntroToTensorFlow python=3.6 anaconda

To create a new environment with Python 3.6 (rather than simply python=3). Once the environment is activated with e.g.:

activate IntroToTensorFlow

you should be able to confirm your Python version with:

python --version

Note that you may need to deactivate your existing environment (and remove it as necessary) with e.g.:

deactivate
conda remove --name IntroToTensorFlow --all

You can verify the availability of a specific environment with:

conda info --envs

(Taken from the Anaconda documentation on Managing Environments).

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.