Keras - Guidelines on installation
In the previous article about Keras, we have discovered the introduction and some benefits of Keras. Now, let’s talk more about Keras installation. We will try to help you install it on Windows, Linux and macOS.
Python
You will need to install Python version 3.5 or higher on your machine before setting up Keras, because Keras is a neural network library based on Python. Go to python.org to download the latest version for your OS, and install it.
If you have already installed Python, then open your terminal and type python, you could see the response similar as specified below:
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18)
[MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Basic required installations
Now we move to the installation of some basic requirements like virtual environment and python libraries. You should follow the steps below:
Step 1: Create virtual environment
We will need to create a virtual environment – Virtualenv – to manage python packages for different projects while developing applications. This will help to avoid breaking the packages in the other environments.
There will be 2 commands for Linux/macOS and for Windows.
If you are a Linux or mac OS user, go to your project root directory and type the below command to create virtual environment,
python3 -m venv kerasenv
After executing the above command, “kerasenv” directory is created with bin,lib and include folders in your installation location.
If you are a Windows user, use the below command:
py -m venv keras
Step 2: Activate the environment
In this step, we will configure python and pip executables in your shell path. We also have 2 cases for different OS.
If you are a Linux/ macOS user, move to the folder and type below command (as we have created a virtual environment name “kerasvenv” in the step 1):
$ cd kerasvenv kerasvenv $ source bin/activate
If you are a Windows user, move inside the “kerasenv” folder and type the below command,
.\env\Scripts\activate
Step 3: Python libraries
If you have installed these below libraries, you can skip this step. If you haven’t, please install one by one using commands we provide:
numpy
pip install numpy
pandas
pip install pandas
matplotlib
pip install matplotlib
scipy
pip install scipy
scikit-learn
pip install -U scikit-learn
Scikit-learn is an open source machine learning library and have some requirements:
-
-
-
- Python version 3.5 or higher
- NumPy version 1.11.0 or higher
- SciPy version 0.17.0 or higher
- joblib 0.11 or higher.
-
-
So make sure you have all of them
Seaborn
pip install seaborn
Seaborn is a library used to visualize your data.
Keras Installation Using Python
We have completed all the basic requirements. Now, let’s install Keras using the below command:
pip install keras
Quit virtual environment
You can run this command to quit the environment if you have finished all your changes in your project.
deactivate
Keras installation using Conda
You can also install Keras using Conda. First, just come to www.anaconda.com/distribution and download the version of anaconda based on your OS.
Create a new conda environment
You should launch anaconda prompt, then type the below command in your conda terminal:
conda create --name PythonCPU
This is the CPU instructions. You can also create and install modules using GPU if you want.
Activate conda environment
To activate the environment, use the below command:
activate PythonCPU
Install spyder
Spyder is an IDE for executing python applications. You can install this IDE in the conda environment using the below command:
conda install spyder
Install python libraries
Above we have introduced and instructed you to python libraries needed for keras like numpy, pandas, matplotlib, etc. You can install them using conda, just follow the syntax:
conda install -c anaconda <module-name>
For example, you want to install pandas
conda install -c anaconda pandas
Install Keras
Now, you can start keras installation using the below command:
conda install -c anaconda keras
Launch spyder
Finally, you can launch spyder in your conda terminal using the below command
spyder
To ensure everything was installed correctly, import all the modules, it will add everything and if anything went wrong, you will get module not found error message.
iRender - Best cloud computing for Keras
We hope that we have delivered some ways to install Keras to you, like using python, using conda. You can follow it on your own computer, or on our remote machine.
At iRender, we provide multiple GPUs for renting with state-of-the-art RTX3090. Our remote machines are Optimized for Scientific Computing, Machine Learning, Deep Learning.
We support many programming languages, libraries, frameworks or API like Keras. You are free to install any of them on our remote servers, add your license (if required) and start your project.
This is our packages tailored for AI/ Deep Learning:
You can also read our article about how RTX3090 be the best choice for AI/ Deep Learning (Is RTX3090 the best GPU for Deep Learning).
Moreover than that, we provide other features like NVLink if you need more VRAM, iRender Drive to transfer and sync files faster, Fixed Rental feature to save credits from 10-20% compared to hourly rental (10% for daily rental, 20% for weekly and monthly rental).
You can register an account today to experience our service and enjoy 20% bonus. Or contact us via WhatsApp: (+84) 916806116 for advice and support.
Thank you & Happy Training!
Source: tutorialspoint.com
Related Posts
The latest creative news from Cloud Computing for AI,