I can't install keras on tensorflow environment - python

I am using python 3.8 and I installed Tensorflow-gpu on it via command prompt. Now I am going to install keras on it, but I can't. I am using
conda activate tensorflow
conda install -c keras-gpu
but it fails.
I also tried from anaconda navigator. But whenever I try to add keras-gpu, it doesn't show anything. No packages come on pop-up window. When I try keras, it says that my python version is 3.8. Keras can't be installed. What can I do now? If there is a offline process to install keras on tensorflow environment, it will be helpful for me. So can you please help me?

Related

Error importing tensorflow on windows with anaconda navigator

I'm trying to import tensorflow and I have already tried everything and in the cmd prompt, I succeeded to install tensorflow with PIP.
But when I'm trying to import tensorflow in Python, I get the following error:
Error importing tensorflow. Unless you are using bazel,
you should not try to import tensorflow from its source directory;
please exit the tensorflow source tree, and relaunch your python
interpreter
from there.
I have tried everything on the internet, but nothing seems to fix it. I have Python version 3.7.1
What is the problem and more important: how can I fix this??
First, if you have already installed tensorflow with pip, trying to install it again with conda is a bad idea. Before running the conda command, first uninstall the pip version.
pip uninstall tensorflow
That is an odd error you are seeing. Try to specify the channel you are installing from. It is available from both the anaconda and conda-forge channels
conda isntall tensorflow --channel anaconda

Installing Keras in new environment

In order to do several deep learning tasks in Python, I want to have TensorFlow, Theano en Keras installed on my computer.
As these are packages created for Python 3.5, I have created a new environment using:
conda create -n py35 python=3.5 anaconda
Then, after I have activated py35, I have installed Theano and TensorFlow:
conda install theano
conda install tensorflow
After I run Spyder at this point, it still launches. However, if I install Keras as well (code from: https://anaconda.org/conda-forge/keras):
conda install -c conda-forge keras
And try to run Spyder afterwards, I get the following error:
'Python has stopped working - A problem caused the program to stop working correctly. Please close the program.'
What can I do to install Keras in my environment and not get this error?

Not able to update the version of tensorflow

I am facing the below error while running the code for LinearClassifier in tensorflow.
AttributeError: module 'tensorflow.python.estimator.estimator_lib' has no attribute 'LinearRegressor'
My current version for tensorflow is 1.2.1. I tried to update the version of the package from ANACONDA environment, its not showing for an upgrade.
I tried to upgrade it from command prompt by using below command, it is successfully updating the package however it is not reflecting to the actual library when I am using it.
pip install --upgrade tensorflow==1.3.0
FYI, I am using Jupyter Notebook and have created a separate environment for tensorflow.
Please let me know if I have missed anything.
If your command pip install --upgrade tensorflowcompiles, then your version of tensorflow should be the newest. However you should restart your notebook. Also, as you said that you are using anaconda. You can also install and upgrade tensorflow as follows:
conda install -c conda-forge tensorflow # to install
conda upgrade -c conda-forge tensorflow # to upgrade
That should work. Check if you are using any environment but you are not updating the tensorflow version within the environment.
Also, please restart the notebook after saving it and run the cells and try. That should work.
Verify in the notebook : run - print(tf.__version__). Please mark the answer if it resolves.

Install keras in Anaconda3 Ubuntu

I was trying to install keras in in anaconda in Ubuntu. I followed instuction from this site. All my packages are installed properly. Also in pip list I can see keras. But when I'm trying to import keras it's saying "no module called keras".
Can anyone please help me?
first, you need switch conda env to your target_env
source activate target_env
second, use pip install keras
pip install keras
I simply use conda install keras and it works for me.

Installing a package in Conda environment, but only works in Python not iPython?

I am using an Ubuntu docker image. I've installed Anaconda on it with no issues. I'm not trying to install tensorflow, using the directions on the tensorflow website:
conda create --name tensorflow python=3.5
source activate tensorflow
<tensorflow> conda install -c conda-forge tensorflow
It installs with no errors. However, when I import in iPython, it tells me there is no module tensorflow. But if I import when in Python, it works fine.
What's going on and how do I fix it?
You have to install IPython in the conda environment
source activate tensorflow
conda install ipython
I went through the same thing. We are installing tensorflow in different conda environment. So It may not consist of all the packages. I needed to install jupyter notebook separately in order to work.

Categories