Installing Keras package with conda install - python

I have installed Anaconda package on a server as a user account, then I installed keras by conda install keras,but after installation, when I run import keras, it raised no module names keras,anyone can help? thanks very much!

One solution could be creating a conda environment:
conda create -n keras python=3.5
Now activate it:
conda activate keras
and install keras:
(keras)$ conda install keras
Try if it works:
(keras)$ python
>>> import keras

Once creating the Conda environment, use the command below to list available environment:
conda info -e
Once activate your conda environment, you can try to install Keras by
pip install keras==version_your_desired.
Then use
pip freeze
to check the version.

Related

How to install Tensorflow via conda for Python 3.10.*?

I am using miniconda, v4.13.0, I can install Tensorflow using conda install tensorflow to my conda environment if its Python version 3.9.* However I would like to use Python 3.10.*
If the Python version is 3.10.* in my conda environment then command conda install tensorflow gives the specification incompatibility error:
tensorflow -> python[version='3.5.|3.6.|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|3.8.|3.7.|3.9.*']
Question
Is there any way to install Tensorflow via conda where the Python version is 3.10.*?
You can use the below command to install TensorFlow using python 3.10:
conda create --name tf python=3.10
conda activate tf
conda install tensorflow
Please check this link for reference.
You can find here tensorflow github PR
https://github.com/tensorflow/addons/pull/2635

Install Tensorflow to Existing Anaconda Environment?

Due to some write permission on my new computer, I can only install to the base(root) environment. How can I add tensorflow to the root environment? Everything I have seen for install has been to create a new environment?
conda activate base
conda install -c anaconda pip
pip install tensorflow
After that, you can clone from base to create new environments.

error while installing tensorflow in conda environment (CondaError: Cannot link a source that does not exist.)

trying to install tensorflow using conda package manager
using following command
conda install -c conda-forge tensorflow
but it gives following error while executing transaction
CondaError: Cannot link a source that does not exist.
C:\ProgramData\Anaconda3\Scripts\conda.exe
I faced the same issue and
conda update -n root conda
Solved the problem. The env name "root" is for conda <= 4.3, otherwise use:
conda update -n base conda
I hope this helps.
Try to run conda clean --all --yes and conda update anaconda.
Do you have a conda.exe file in the following folder C:\ProgramData\Anaconda3\Scripts\?
Do you use the latest Conda?
Another solution could be to create a conda environments conda create -n name_environment pip python=3.5 and using pip to install tensorflow pip install tensorflow inside the new environment
after having activated it (activate name_environment).
P.S. I can not write a comment because I do not have enough reputation.
EDIT - Now i can!

I get the following error whenever I try to run conda install tensorflow

This is the error :
Solving environment: failed
UnsatisfiableError: The following specifications were found to be in conflict:
- numba -> numpy[version='>=1.14,<1.15.0a0']
- tensorflow
Use "conda info " to see the dependencies for each package.
You have to run the conda info tensorflow and conda info numba to see each dependencies for each package and then you have to install those package like conda install package=version to fix the problem.
First create a conda environment if you would like using
conda create -n my_env python=3.6
Here "my_env" is the name of my environment
Then activate your environment using
source activate my_env #(for mac)
conda activate my_env #(for windows)
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 update numpy
conda install tensorflow
Hope this will solve your problem or else try to upgrade numpy using pip:
pip install --upgrade numpy

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