Tensorflow 2.0 version clash with scikit-learn 0.21 with conda - tensorflow

In order to install Tensorflow 2.0, I updated all my packages in conda using conda update --all. I later realised that although I got TF2.0, my scikit-learn module was not there. While trying to install it manually, I got a message that TF2.0 will be downgraded to 1.15(Downgrade message). Is there any way I can keep TF2.0 and scikit-learn together?
My python version is 3.6.9
I have all of them in the base environment. Will installing everything again in another environment resolve the issue?

Related

Why does conda want to install the wrong version of gast with Tensorflow?

I'm getting gast errors when running Tensorflow 2.4.1 with gast 0.4.0. This is the way conda installed it. When I asked the TF people about it,
https://github.com/tensorflow/tensorflow/issues/48889
I was told to use gast 0.3.3. However, conda will not allow this and wants to downgrade to TF 2.2. Where is the disconnect? Are the TF devs responsible for proving conda dependencies, or do the conda people somehow do that themselves? My guess is the former.

Python 3.8.3 incompatible with tensorflow

I recently installed python with the version 3.8.3 and upgraded pip to 20.1.1. According to enter link description here, conda install -c conda-forge tensorflow should work. However, I get this result
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: -
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:
Specifications:
- tensorflow -> python[version='3.5.*|3.6.*|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|3.7.*']
Your python: python=3.8
If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.
since I use
(base) C:\Users\ivan>python --version
Python 3.8.3
(base) C:\Users\ivan>pip --version
pip 20.1.1 from C:\Users\ivan\anaconda3\lib\site-packages\pip (python 3.8)
I wonder if it is possible to solve this issue without downgrading. For users of anaconda 2020.07, python 3.8 is used by default. Downgrading it will break anaconda.
People have reported problems using tensorflow with python 3.8, it is best to use 3.7. You are incorrect about breaking Anaconda. Here is what to do.
In Anaconda home page click on environments. At the bottom left of the page click on create. A window will appear. Give the new environment a name (say python3.7). In the drop down menu select 3.7. Now a new environment is created using python 3.7. Now in the conda terminal type conda activate python3.7. Then use conda to install tensorflow. It will install version 2.1.1, the cuda toolkit version 10.1.243 and cudnn version 7.6.5. Note conda can only install tensorflow up to version 2.1.1. If you want tensorflow 2.2 install it with pip using pip install tensorflow ==2.2.0. after you have installed 2.1. The cuda toolkit and cudnn work with version 2.2. Now use pip or conda to install any other packages you need in your python3.7 environment and you should be good to go!

Still getting Tensorflow 2.0.0 behavior after installing Tensorflow 1.15.0

I installed Tensorflow 1.15.0 on one of the conda environment named tensorflow1 but still print(tf.__version__) is printing 2.0.0.
Also, tf.InterativeSession() is not present in tensorflow 2.0. FYI, I activated the conda environment and I am working in PyCharm for my project.
Please help.
Check where your pip is pointing to.
In conda environment pip should point on
/userName/.conda/envs/env_name(tensorflow1 )/bin/pip this path is local to your environment.
and inside environment don't use --user while installing packages.

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

install latest tensorflow version on Anaconda

I installed Anaconda today and added the tensorflow package. On Anaconda, the tensorflow version is 1.1.0. The current tensorflow version on tensorflow.org is 1.8.0. So I followed the installation guideline found here: https://www.tensorflow.org/install/install_mac#installing_with_anaconda
It seemed to went well and I got a successful install message as shown below:
Successfully installed absl-py-0.2.0 astor-0.6.2 bleach-1.5.0 gast-0.2.0 grpcio-1.11.0 html5lib-0.9999999 markdown-2.6.11 numpy-1.14.3 protobuf-3.5.2.post1 setuptools-39.1.0 six-1.11.0 tensorboard-1.8.0 tensorflow-1.8.0 termcolor-1.1.0 werkzeug-0.14.1 wheel-0.31.0
However, on Anaconda, it still shows tensorflow version as 1.1.0. How do I update it to 1.8.0 for tensorflow?
Maybe try the anaconda cloud?
https://anaconda.org/aaronzs/tensorflow-gpu