Can anyone explain to me how I should install Tensorflow and Keras on Ubuntu? Preferably in combination with python 3.6? The pip installation suggested at the TensorFlow website offers no solution (python cannot find the package when I try to import TensorFlow). Apart from the Tensorflow website, I can find only very limited supplementary documentation.

  • If package cannot be found, maybe wrong python version is used or a firewall is blocking something (e.g. if you are in a company network) – Mr.Michael.Schulze Jul 24 '19 at 8:18

To install keras using command line : pip3 install keras

To install tensorflow using command line : python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl

| improve this answer | |

I prefer to use Miniconda and always create an own virtual environment for my projects, here called myenv (should be a usefull name). Everything done via command line. If you are not familar with command line, please consider to use Anaconda instead.

1) Download Miniconda https://docs.conda.io/en/latest/miniconda.html

2) Install Miniconda (from you download folder)

bash Miniconda3-latest-Linux-x86_64.sh

3) Update Conda

conda update conda

4) Create virtual environment (myenv) for actual project with certain Python version

conda create -n myenv python=3.6

5) Install necessary packages into virtual environment

If you will use CPU

conda install -n myenv tensorflow keras

If you will use GPU

conda install -n myenv tensorflow-gpu keras

maybe you will need further packages, depends on your situation (hdf5, h5py, graphiz, pydot, cudnn)

6) Activate virtual environment (for running your tensorflow environment)

conda activate myenv

7) Deactivate virtual environment (if you would like to go back to base)

conda deactivate


conda activate base
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.