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
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.
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:
Creating a environment for Tensorflow
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.
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
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.
Try to install Spyder within the Anaconda environment in which you want to use tensorflow. This resolved the issue for me.
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.
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.
Related
its my fist time im working with python on an apple product and outside of the anaconda ide....
I followed the instructions of
"18 Steps to install tensorflow_macos on the M1 MacBook (2020)" and it worked. It was working fine.
Later I tried to install Jupyter Notebook which did not work. I tried a lot and probably did a lot wrong.
I got some "killed" msg in the Terminal
Now Conda (Miniforge3) is installed but the commands are not executed, just ignored.
kleimie#Air-von-Andreas ~ % conda list
kleimie#Air-von-Andreas ~ % conda help
kleimie#Air-von-Andreas ~ % conda --version
conda 4.9.2
I also can not activate the set environment
Does this PATH make sense? PATH=/Users/kleimie/miniforge3/bin:/Users/kleimie/miniforge3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Steps to install Tensorflow on Mac OS using conda environment
#download and install anaconda
https://www.anaconda.com/products/individual#macos
#Create virtual environment
conda create --name tf python=3.8
#Activate environment
source activate tf
#install Tensorflow
conda install tensorflow
I am trying to install a plugin for the Spyder ide called spyder-unittest (description here).
I am using:
MacOS X Version 10.14.6
Anaconda Navigator 1.9.7
Spyder 3.3.6
Python 3.7
After a first attempt using the command
conda install -c spyder-ide spyder-unittest
the plugin did not work (i.e. the additional command Run unit tests was not available under the Run menu).
I also tried, without success:
conda install -c conda-forge spyder-unittest
I then uninstalled and installed once again Anaconda navigator, and tried conda install -c spyder-ide spyder-unittest. This time, I got a very lengthy output, indicating conflicts (please see image):
Now, I do not know what to do. Could someone please offer any help?
I also tried to install after going, through the Terminal, to the directory where I thought the Spyder plugins were installed. Same output as above.
Thank you very much in advance.
Cheers,
Orlando
I managed to install spyder-unittest without any errors on my computer.
I suggest creating a new environment to avoid any conflicts with other packages when installing.
First create a new environment using:
conda create --name env python=3.7
After creating the environment, activate it using conda activate env
Then install spyder-unittest using conda install -c conda-forge spyder-unittest
I want to install Anaconda with Python Version 3.6.5. If I install Anaconda3-5.2.0, It install Python 3.5.1. Where to download the Anaconda with Python 3.6.5. The Big Data Scripts work only with Anaconda Python 3.6.5.
Anaconda Downloads
The Anaconda distribution with Python 3.6.5 was version 5.2.0.1 You can download this from the Anaconda distribution archive. If you do install from this, then make sure to update Conda immediately after installation:
conda update conda
However, I strongly recommend the following alternate solution as better practice.
Miniconda + Anaconda environment
Reasoning
What is installed in the base environment is relatively fixed once installed. Ultimately, you don't want to mess with your base environment, so best practice is to have the latest version there. Fortunately, you don't have to install a full Anaconda distribution, but rather can use a lightweight Miniconda (or Miniforge) distribution and create a secondary environment for the purpose of having an Anaconda Python 3.6.5 distribution. In the long run this will give you better stability.
Steps
Download and install Miniconda or a Miniforge variant. Once that is working...
Create your Anaconda env:
conda create --name my_env -c anaconda python=3.6.5 anaconda=5.2.0
Use your new isolated env:
conda activate my_env
[1] I determined this by running conda create -n foo --dry-run -c anaconda python=3.6.5 anaconda and then examining the version of the anaconda package that Conda ended up with in the solve.
Also try
conda install python=3.6.5
but you may encounter some incompatibility issues with other packages.
Alternatively, you may want to try creating a new environment. From the anaconda prompt, create a custom environment and specify the repository channel to find the version
conda create --name py365 python=3.6.5 --channel conda-forge
Activate the new environment
conda activate py365
However, the activation will not be permanent, and you will need to activate each time you start the anaconda prompt.
In your anaconda prompt, you can manually update your python to the latest version with :
conda update python
In case you are not familiar with it, anaconda prompt is installed to your computer when you install anaconda. Just make a search for it on your computer.
You can refer to this post : How do I upgrade to Python 3.6 with conda?
I'm currently using Windows 10, and installed Pycharm and Anaconda on it in order to run Tensorflow. Everything is working well, I can select conda interpreter and then use the following command to install and run tensorflow.
pip.main(['install', 'tensorflow'])
My only problem is, everytime I create a new project in pycharm, I need to do this installation command again. Is there a more permanent method to do the installation in my case?
Thanks.
EDIT:I installed the package inside Pycharm as shown in this video
Install Video
First you need to build a TensorFlow virtual environment in Anaconda Navigator in the anaconda3 directory.As shown in the figure:anaconda navigator,environment about tensorflow.You can create a Tensorflow environment on the command line and install pycharm as a pip in this environment. This will allow you to use Tensorflow in pycharm.The code is as follows:
conda create -n tensorflow python=3.5
activate tensorflow
pip install --ignore-installed --upgrade tensorflow-gpu
This is a Chinese version of the installation instructions for TensorFlow + pycharm.installation instructions
I just started to learn how to use Anaconda to manage packages. I am trying to install tensorflow in conda environment. So first of all, I create an environment by:
conda create -n tensorflow
Then, I source it by:
source activate tensorflow
I can see my prompt changed so I think it is going right.
I notice that it seems that the tensorflow environment is copying from ~/anaconda2/lib/ where I do have my root version python2.7 and tensorflow0.12.0
I installed a new version Python in tensorflow environment by:
conda install python=3.5
Then, I follow the steps to install tensorflow by:
pip install --ignore-installed --upgrade TF_PYTHON_URL
However, when I do conda list, I can only see Python3.5 but not tensorflow1.0. I also failed to import tensorflow when I am in Python.
So I have two questions that really confuse me.
Why does the pip installed tensorflow not show up when I do conda list?
Although I conda install python=3.5 and I can see it from conda list, I am not using python 3.5 when I enter Python directly. It seems still using Python2.7, which comes from my root environment.
I appreciate any tutorial on how anaconda works.
I think your pip install is installing into the global environment instead of
tensorflow. Why don't you try installing by specifying the path? For example pip install --target $HOME/anaconda3/tensorflow tensorflow(Where the first tensorflow is your environment and the second is the actual package).
I just saw the last two questions. So you actually see the tensorflow you installed with pip? I am confused now. Type which pip to see if it is running from the tensorflow environment or the global. You could also try source deactivate before source activate tensorflow just to make sure that you are not using a different environment, then run which python. It should show your new environment.
If you want to create an environment using a specific version of Python (rather than the system default), you can do for example:
conda create --name myCoolEnv python=3.5
and then activate with
source activate myCoolEnv
You can read more about Anaconda environments here.