Reputation: 95
I am trying to access tensorflow from two ways, both of which are failing:
Installed Anaconda (Windows 32 bit Python 3.6). Then, created a conda environment with Python 3.6 (also tried with 3.5) and Tensorflow. Then, I opened Spyder desktop app. In this Spyder, the tensorflow is not working (e.g. 'import tensorflow as tf' is not working).
From Anaconda Navigator, created an environment (using the GUI), with Python 3.6. Then, I filtered the "Not installed" packages, and searched for "tensorflow". I couldn't find any relevant tensorflor package. All I could find is "r-tensorflow" which is not relevant for me.
The attached image describes the 2nd problem.
Can someone help?
Screenshot of the step 2 above
Upvotes: 4
Views: 35456
Reputation: 1
I read all the solutions and they all are from people who knows much more than me and they all are grate but I resolved this problem just entering in the prompt of anaconda, selecting my enviroment in use and changing the comand 'conda install tensorflow' for pip install tensorflow
and it worked like magic jajajaja.
You can search for more information on youtube, there i find the solution to my problem
Upvotes: 0
Reputation: 1
In my case I used pip
instead of conda
and it installed without any issue. In my opinion pip installation is much faster than conda installation.
Use
pip install tensorflow
and its done.
Upvotes: 0
Reputation: 13582
Let's break it down in a couple of steps:
If you don't have, download and install Anaconda.
Access Anaconda Command Prompt
for the environment that you want to install TensorFlow
. If you don't have an environment created, access the Anaconda Prompt.
Assuming that you don't have an environment created, choose the name of your TensorFlow environment, such as "tensor
" and install TensorFlow
as following
conda create -n tensor tensorflow
conda activate tensor
If you want to install the GPU TensorFlow (Linux or Windows), in the environment "tensor-gpu
", use the following
conda create -n tensor-gpu tensorflow-gpu
conda activate tensor-gpu
TensorFlow is now installed. For more information access their documentation.
Upvotes: 1
Reputation: 820
I had been stuck on the exact same problem for the past 4 days. I could see 'r - tensorflow' and a few other packages but not the 'tensorflow' package. Apparently, i was using the 32 - bit version of Anaconda. I searched it up and found out that Tensorflow is not supported on 32 - bit platforms. So i uninstalled the 32 - bit version and installed the 64 - bit version. I followed the same steps as before and i was able to find the 'tensorflow' package in the 'not installed' tab.
Upvotes: 0
Reputation: 411
Open Terminal, then enter:
conda update conda
After installing done, enter:
conda install tensorflow
It will take some time based on your internet speed.
After installing, open Anaconda -> Spyder/Jupyter
import tensorflow as ts
Upvotes: 3
Reputation: 3096
tensorflow can be installed simply by running following commands
On mac/Windows use following command:
conda install -c conda-forge tensorflow
This will install the latest Tensorflow on your system. if you wish to upgrade it to newer verion then you can use the following command
conda update -f -c conda-forge tensorflow
However if you have the virtual environment created from anaconda then before doing these steps you have to activate the environment first and then run the command. With this trensorflow will get installed on your specific command
Please refer the example below for more details:
conda create -n “myEnv” python=3.6 anaconda
This will create virtual environment along with anaconda packages. Once this is done, Activate the Environment by :
source activate myEnv #(for mac)
conda activate myEnv #(for windows)
you will see the following.
Once the Environment is active. you can now install the packages you need as follows: I am showing you the packages which i work upon on virtual environment and this will take care of most of your dependencies
conda update conda
conda upgrade conda
conda upgrade anaconda
conda install pip
conda install -c conda-forge opencv
conda install -c conda-forge tensorflow
conda install -c conda-forge keras
Hope this will solve your problem.
Upvotes: 5
Reputation: 3974
Try to install Spyder within the Anaconda environment in which you want to use tensorflow. This resolved the issue for me.
Upvotes: 0
Reputation: 274
Open an anaconda prompt, and create an environment with tensorflow like this:
conda create -n tf tensorflow
activate tf
# Verify that it works
python -c "import tensorflow"
Then, you probably have to specify that environment from within Spyder. Open Preferences
->Console
->Advanced Settings
and set the python path to <anaconda_install>/envs/tf/bin/python
.
Upvotes: 5