Problem with installing tensorflow on windows along with pytorch using conda environment - tensorflow

I am trying to install "Tensorflow" on windows using conda environment.
Please note that -
I am installing tensorflow along with pytorch in the same environment.
I am getting "Remove Error": 'setuptools' is a dependency of conda and cannot be removed from
conda's operating environment.
I getting this error with both of these commands
pip install tensorflow
conda install tensorflow
A snap of the error can be seen below.

I sorted this issue by fixing the installation of the "httptools".
I recently found that many of the conda supports of have been migrated to conda forge.
HENCE, BEFORE INSTALLING THE TENSORFLOW. I INSTALLED THE "httptool" using the following command in the anaconda prompt.
conda install -c conda-forge httptools
Now everything works really fine.

Related

Anaconda install keras-tuner in tensorflow environment

I am using Anaconda 3 and would like to install keras-tuner in the tensorflow environment.
I've tried
conda install -c conda-forge keras-tuner
in the Anaconda Prompt (see https://anaconda.org/conda-forge/keras-tuner) which worked fine. However, the package has been installed in the base environment (and not in the tensorflow environment).
How can I choose the environment in which I want to install keras-tuner?
I use tensorflow 2.1.0 on a Windows machine
There are multiple ways of doing it.
activating the target environment and running the same command.
You can install a conda package also without activating the environment. Just use
conda install -n <env_name> <package> or conda install -p <path/to/env> <package>

What's the minimal conda environment build for pandas?

I'm using Miniconda 3, and I'm trying to build a minimal Conda environment containing pandas. However, when I try to load the pandas module, Jupyter gives me the following error:
The kernel appears to have died. It will restart automatically.
When doing the same thing via Python in the Terminal, Python crashes.
I have created a minimal Conda environment, which can be reproduced via the code below.
conda create -n testenv
conda activate testenv
conda install python
conda install pandas
conda install jupyter
The problem doesn't occur anymore when I follow up with a full Anaconda install, via conda install anaconda.
Any ideas as to how this problem can be resolved without installing Anaconda?
I figured out what the problem was. What I should have mentioned is that I built a global channel list according to Bioconda recommendation, using
conda config --add channels defaults
conda config --add channels bioconda
conda config --add channels conda-forge
This makes conda-forge the highest-priority channel. For reasons I don't understand, conda-forge builds a dependency hell. (I noticed the guys at conda-forge: https://github.com/conda-forge/pandas-feedstock/issues/63).
For now, install using conda install -c defaults pandas.

How to install Keras with gpu support?

I installed Tensorflow for GPU using: pip install tensorflow-gpu
But when I tried the same for Keras pip install keras-gpu, it pulled me an error: could not find the version that satisfies the requirements.
Adding to the answer below which is the correct answer in terms of recommending to use Anaconda package manager, but out of date in that there is now a keras-gpu package on Anaconda Cloud.
So once you have Anaconda installed, you simply need to create a new environment where you want to install keras-gpu and execute the command:
conda install -c anaconda keras-gpu
This will install Keras along with both tensorflow and tensorflow-gpu libraries as the backend. (There is also no need to install separately the CUDA runtime and cudnn libraries as they are also included in the package - tested on Windows 10 and working).
There is not any keras-gpu package [UPDATE: now there is, see other answer above]; Keras is a wrapper around some backends, including Tensorflow, and these backends may come in different versions, such as tensorflow and tensorflow-gpu. But this does not hold for Keras itself, which should be installed simply with
pip install keras
independently of whatever backend is used (see the PyPi docs).
Additionally, and since you have tagged the question as anaconda, too, be informed that it is generally not advisable to mix your package managers (i.e pip with conda), and you may be better off installing Keras from the Anaconda cloud with
conda install -c conda-forge keras
Finally, you may be also interested to know that recent versions of Tensorflow include Keras as a subpackage, so you can use it without any additional installation; see https://www.tensorflow.org/guide/keras
For installing tensorflow-gpu from Anaconda cloud, you should use
conda install -c anaconda tensorflow-gpu
before installing Keras. Be sure you do it in a different virtual environment, or after having uninstalled other versions (i.e. pip-installed ones), as there have been reported problems otherwise.
Adding to the above two answers, ensure your TensorFlow/Keras environment is using Python 3.6. Keras/TensorFlow doesn't work very well with Python 3.7, as of May 10, 2019.
I tried to use Keras/TensorFlow with Python 3.7 and I ended up having to reinstall Anaconda, since it sort of broke my Anaconda Prompt.
To install tensorflow-gpu with particular cuda version 9.0, use:
conda install tensorflow-gpu cudatoolkit==9.0 -c anaconda
Similarly for keras-gpu

Anaconda prompt crashes as soon as I activate tensorflow env

I have just installed Anaconda 3.7 in Windows 10. Then I have created a new env for
tensorflow and installed it there. It got installed without any problem. Then I
used the command
conda install -c conda-forge keras
to install Keras. While Keras installation was running, Anaconda Prompt crashed suddenly. I restarted it and I tried to activate my tensorflow env; but as soon as I try to activate it, Anaconda Prompt crashes!! Please take a look at my screenshot. How can I fix this? Thank you very much for your support.
Ferari
Anaconda Prompt Crashes
The problem could be due to the version of tensorflow - tensorboard mismatch. When you give the command conda install -c conda-forge keras for installing keras, the tensorflow and tensorboard versions gets changed.
I tried the following steps and it worked fine for me.
conda create -n tf python=3.6
activate tf
conda install keras
Installing keras will automatically install tensorflow.
I just had an issue with the same symptom. Instead of printing the error message, the activation of the conda environment exited the console application.
The scripts that run on activation can be found in ./etc/conda/activate.d inside the environment. The path to the environments can be found using conda env list. Check these scripts for any 'exit' commands, commenting them out if necessary. This should let you at least see the error message.
In my case the issue was caused by packages requiring MSVC compiler, and Visual Studio studio was not installed.
I was also facing the same error and i have resolved it by re creating the conda environment. It is happening due to version mismatch between couple of packages. Just delete the conda environment and re-create the environment but this time do not add tensorflow GPU package instead just add keras-gpu, it will take care everything.
I did the following things:
deleted the same env
created the same environment using
conda create -n myEnv python==3.6
install keras gpu
conda install -c conda-forge keras-gpu
now it will install necessary packages and then you can activate the environment and use it
I encountered the same problem. Solved by creating a new env and using
conda install -c hesi_m keras
This will install the latest versions of Keras and Tensorflow.
Turns out you will most likely get an outdated version of keras if you installed it with conda install -c conda-forge keras.
Same problem here..
I just have installed tensorflow-gpu in tf-gpu environment using
conda install tensorflow-gpu
It has successfully installed and works perfectly. But after installation whenever I am going to use environment by this command
activate tf-gpu
it shows the followingenter image description here output and close the command prompt soon. I am using anaconda for python 3.6.
when you open Anaconda command prompt just press ctrl+c and press Y to avoid the crash for now and then start again with the task of setting the environment for tensorflow...
this worked for me..

TensorFlow: unsatisfiableError: the following specifications were found to be in conflict

I am trying to install tensorflow in anaconda with python 2.7 in Win10, by conda installation:
conda install -c conda-forge tensorflow=1.1.0
Then, I get the error message:
- python 2.7*
- tensorflow 1.1.0* -> python 3.5*
Use 'conda info <package>' to see the dependencies for each package.
Does the message mean I need to use python 3.5?
Yes.
TensorFlow only supports version 3.5.x of Python on Windows. Note that Python 3.5.x comes with the pip3 package manager, which is the program you'll use to install TensorFlow.
There are instructions for installing TF with Anaconda on Win10 on that page.