This guide provides a step-by-step process to install Theano on Ubuntu. It covers setting up Python, creating a virtual environment, and installing Theano with both CPU and GPU support. Theano is an efficient deep learning library ideal for building and training machine learning models.
10 min
Edited:12-10-2024
Theano is a powerful library for mathematical computations, often used for deep learning.
First, update and upgrade your system to ensure all packages are up to date:
1. sudo apt update && sudo apt upgrade -y
Ensure you have Python 3.x installed:
1. python3 --version
If Python is not installed, install it with:
1. sudo apt install python3 python3-pip python3-venv -y
Create a virtual environment to manage your Python packages in isolation:
1. python3 -m venv theano-env
2. source theano-env/bin/activate
Install Theano using pip:
1. pip install Theano
If you want to use Theano with GPU support, follow these steps:
1- Install NVIDIA drivers and the CUDA toolkit from the NVIDIA website.
2- Install libgpuarray and pygpu, which Theano uses to interact with the GPU:
1. sudo apt install libgpuarray-dev
2. pip install pygpu
3- Configure Theano to use the GPU by creating a .theanorc configuration file in your home directory:
1. nano ~/.theanorc
Add the following content to enable GPU support:
1. [global]
2. device = cuda
3. floatX = float32
4.
5. [dnn]
6. enabled = True
To confirm Theano is installed correctly, you can run a simple script:
1. import theano
2. import theano.tensor as T
3.
4. x = T.dscalar('x')
5. y = T.dscalar('y')
6. z = x + y
7. f = theano.function([x, y], z)
8. print(f(2, 3))
This script should output 5.0, indicating Theano is working properly.
If you've installed Theano with GPU support, you can test if Theano is utilizing the GPU by running:
1. import theano
2. print(theano.config.device)
If the output shows cuda, Theano is using the GPU correctly.
Now you have successfully installed Theano on your Ubuntu machine, with or without GPU support. You’re ready to build and train machine learning models using this efficient library!
14-10-2024
This article offers a detailed guide on installing and configuring IPTables on an Ubuntu VPS. IPTables is a powerful firewall tool that helps secure your server by controlling inbound and outbound traffic. Learn how to set up rules for traffic filtering, configure basic security policies, and apply custom rules to protect your VPS.
IPtables
security
12 min
This article offers a comprehensive guide on installing and configuring ModSecurity, a powerful web application firewall (WAF), on an Ubuntu VPS. Learn how to secure your server by filtering and monitoring HTTP requests, set up ModSecurity with Nginx or Apache, and apply rules to protect against common web attacks.
Modsecurity
security
10 min
14-10-2024
This article provides a comprehensive guide on installing and configuring PHP-FPM (FastCGI Process Manager) on an Ubuntu VPS. Learn how to optimize PHP performance for your web applications by configuring PHP-FPM with Nginx or Apache, managing pools, and fine-tuning settings for efficient processing of PHP scripts.
PHP-FPM
speed
optimise
12 min