Установить keras python windows

alecGraves / keras_setup_instructions.md

Python, Keras, and Tensorflow have made neural networks easy and accessable to everyone. I personally have had a lot of trouble finding a nice and easy guide detailing how to set up all three on a system. This guide contains simple, step-by-step instructions on how to install these three things.

Anaconda is a python package manager that does a lot of stuff for you. It contains many packages including pip, numpy, scipy, etc.

Step one is to install it. Do that by going here, downloading the package for your OS, and installing it.

This step may not be necessary in the future, but for now, it is required.

open powershell or terminal and run the following command:

3. GPU (if you want to use GPU)

Note, for your system to actually use the GPU, it nust have a Compute Capibility >= to 3.0

Go to this website and download CUDA for your OS.

You will need to make a NVIDIA developer account to get these files.

Go here, login, and download CUDNN for your OS

  • Extract the folder
  • Copy the files in the 3 folders to the same folders in C:\Program_Files\NVIDIA CUDA Toolkit (This requires admin permissions)
  • Extract the folder
  • run sudo nautilus to open the file manager as root
  • copy the files from the 2 extracted folers to the same-named folders in /usr/local/CUDA

This is the last step in system setup. Just open powershell or terminal and run one of the following commands.

pip install tensorflow-gpu keras 
pip install tensorflow keras 

Источник

How to install Keras and TensorFlow

How to install keras and tensorflow

Keras and TensorFlow are open source Python libraries for working with neural networks, creating machine learning models and performing deep learning. Because Keras is a high level API for TensorFlow, they are installed together.

In general, there are two ways to install Keras and TensorFlow:

  • Install a Python distribution that includes hundreds of popular packages (including Keras and TensorFlow) such as ActivePython .
  • Use pip to install TensorFlow, which will also install Keras at the same time.

Pip Install TensorFlow

Instead of pip installing each package separately, the recommended approach is to install Keras as part of the TensorFlow installation. When you install TensorFlow 2.0+, Keras will be automatically installed, as well.

The simplest way to install TensorFlow is to install the binary version using one of the official releases on the Python Package Index (PyPI).

TensorFlow can be run on three different processor platforms, with the main difference being the speed at which your neural network will be trained. Each platform has different hardware requirements and offers different performance:

  • CPU – any modern computer can run this version, but it offers the slowest training speeds.
  • TPU – only available currently on Google’s Colaboratory ( Colab ) platform, Tensor Processing Units (TPUs) offer the highest training speeds.
  • GPU – most high end computers feature a separate Graphics Processing Unit (GPU) from Nvidia or AMD that offer training speeds much faster than CPUs, but not as fast as TPUs.

TensorFlow Requirements

TensorFlow and Keras require Python 3.6+ (Python 3.8 requires TensorFlow 2.2+) , and the latest version of pip. You can determine the version of Python installed on your computer by running the following command:

Output should be similar to:

Run the following command to ensure that the latest version of pip is installed:

To install TensorFlow for CPU and GPU processors, run the following command:

If you’re fine with using the CPU to train your neural network, your installation is done. If you want to use your GPU to the training, you’ll need to do the following:

  • For AMD GPUs, refer to the article Install Tensorflow 2 for AMD GPUs
  • For Nvidia GPUs:
    1. Ensure you’re running a CUDA®-enabled card
    2. Install v11 or later of the CUDA® Toolkit
    3. If you’re working with Deep Neural Networks, you’ll should also install the latest version of the cuDNN library

The installation installs a slew of TensorFlow and Keras dependencies:

tensorflow ├── absl-py~=0.10 │ └── six ├── astunparse~=1.6.3 │ ├── six=1.6.1 │ └── wheel=0.23.0 ├── flatbuffers~=1.12.0 ├── gast==0.3.3 ├── google-pasta~=0.2 │ └── six ├── grpcio~=1.32.0 │ └── six>=1.5.2 ├── h5py~=2.10.0 │ ├── numpy>=1.7 │ └── six ├── keras-preprocessing~=1.1.2 │ ├── numpy>=1.9.1 │ └── six>=1.9.0 ├── numpy~=1.19.2 ├── opt-einsum~=3.3.0 │ └── numpy>=1.7 ├── protobuf>=3.9.2 │ └── six>=1.9 ├── six~=1.15.0 ├── tensorboard~=2.4 │ ├── absl-py>=0.4 │ │ └── six │ ├── google-auth-oauthlib=0.4.1 │ │ ├── google-auth>=1.0.0 │ │ │ ├── cachetools=2.0.0 │ │ │ ├── pyasn1-modules>=0.2.1 │ │ │ │ └── pyasn1=0.4.6 │ │ │ ├── rsa=3.1.4 │ │ │ │ └── pyasn1>=0.1.3 │ │ │ ├── setuptools>=40.3.0 │ │ │ └── six>=1.9.0 │ │ └── requests-oauthlib>=0.7.0 │ │ ├── oauthlib>=3.0.0 │ │ └── requests>=2.0.0 │ │ ├── certifi>=2017.4.17 │ │ ├── chardet=3.0.2 │ │ ├── idna=2.5 │ │ └── urllib3=1.21.1 │ ├── google-auth=1.6.3 │ │ ├── cachetools=2.0.0 │ │ ├── pyasn1-modules>=0.2.1 │ │ │ └── pyasn1=0.4.6 │ │ ├── rsa=3.1.4 │ │ │ └── pyasn1>=0.1.3 │ │ ├── setuptools>=40.3.0 │ │ └── six>=1.9.0 │ ├── grpcio>=1.24.3 │ │ └── six>=1.5.2 │ ├── markdown>=2.6.8 │ ├── numpy>=1.12.0 │ ├── protobuf>=3.6.0 │ │ └── six>=1.9 │ ├── requests=2.21.0 │ │ ├── certifi>=2017.4.17 │ │ ├── chardet=3.0.2 │ │ ├── idna=2.5 │ │ └── urllib3=1.21.1 │ ├── setuptools>=41.0.0 │ ├── six>=1.10.0 │ ├── tensorboard-plugin-wit>=1.6.0 │ ├── werkzeug>=0.11.15 │ └── wheel>=0.26 ├── tensorflow-estimator=2.4.0 ├── termcolor~=1.1.0 ├── typing-extensions~=3.7.4 ├── wheel~=0.35 └── wrapt~=1.12.1

Update Tensorflow and Keras Using Pip

If you already have TensorFlow and Keras installed, they can be updated by running the following command:

You can verify the TensorFlow installation with the following command:

python -m pip show tensorflow

Output should be similar to:

Name: tensorflow Version: 2.2.0 Summary: TensorFlow is an open source machine learning framework for everyone. Home-page: https://www.tensorflow.org/ Author: Google Inc. Author-email: packages@tensorflow.org License: Apache 2.0 Location: c:\python38\lib\site-packages Requires: google-pasta, gast, six, protobuf, tensorboard, h5py, termcolor, absl-py, opt-einsum, wrapt, grpcio, keras-preprocessing, tensorflow-estimator, numpy, astunparse, wheel, scipy Required-by:

If you intend to create plots based on TensorFlow and Keras data, then consider installing Matplotlib. For information about Matplotlib and how to install it, refer to What is Matplotlib in Python?

How to Import Keras and TensorFlow

Once TensorFlow and Keras are installed, you can start working with them.

# Begin a Keras script by importing the Keras library: import keras
from tensorflow import keras # Import TensorFlow: import tensorflow as tf

It’s not necessary to import all of the Keras and Tensorflow library functions. Instead, import just the function(s) you need for your project.

# Import the Sequential model class from Keras # to form the framework for a Sequential neural network: from keras.models import Sequential

For more information on working with Keras, refer to What is a Keras Model.

The following tutorials will provide you with step-by-step instructions on how to work with machine learning Python packages:

Get a version of Python, pre-compiled with Keras and other popular ML Packages

ActiveState Python is the trusted Python distribution for Windows, Linux and Mac, pre-bundled with top Python packages for machine learning – free for development use.

Machine Learning:

  • TensorFlow (deep learning with neural networks)*
  • scikit-learn (machine learning algorithms)
  • keras (high-level neural networks API)

Data Science:

  • pandas (data analysis)
  • NumPy (multidimensional arrays)
  • SciPy (algorithms to use with numpy)
  • HDF5 (store & manipulate data)
  • matplotlib (data visualization)

Why use ActiveState Python instead of open source Python?

While the open source distribution of Python may be satisfactory for an individual, it doesn’t always meet the support, security, or platform requirements of large organizations.

This is why organizations choose ActiveState Python for their data science, big data processing and statistical analysis needs.

Pre-bundled with the most important packages Data Scientists need, ActiveState Python is pre-compiled so you and your team don’t have to waste time configuring the open source distribution. You can focus on what’s important–spending more time building algorithms and predictive models against your big data sources, and less time on system configuration.

ActiveState Python is 100% compatible with the open source Python distribution and provides the security and commercial support that your organization requires.

With ActiveState Python you can explore and manipulate data, run statistical analysis, and deliver visualizations to share insights with your business users and executives sooner–no matter where your data lives.

Download ActiveState Python to get started or contact us to learn more about using ActiveState Python in your organization.

Источник

Читайте также:  Cpp count set std
Оцените статью