Skip to main content

SETTING UP THE ENVIRONMENT

SETTING UP THE ENVIRONMENT


The following instructions are for Linux(Ubuntu) Operating System only.

The most popular distribution among data scientists is Anaconda. Anaconda is a distribution of packages like python, Jupyter Notebook,  IDE Spyder for python etc. In anaconda, you can create virtual environments to install required packages for a specific project. This way you can avoid dependency collisions between projects.You can download anaconda from the website. After downloading the file execute the command to start the installer.
 ./file.sh 
Anaconda asks if Path should be added to path variable at end of the installation. If you have answered no to that anaconda-navigator command won't work in the terminal. We should give entire path when executing the command. To add path open .profile file using vi .bashrc from home. To check if the file exists use ls -a command which displays hidden files. Add the following line at the end of the file. If you get an overwrite error while saving the file, close it and open it as superuser.
export PATH="/home/abhi/anaconda3/bin:$PATH" to end of the file.
To create a new environment use the following command from the terminal.
 conda create --name envname python=3.6
This creates the environment with python version 3.6. You can create the environment with another package by just using the package name. To activate the environment envname use
 source activate envname
The rest of the packages can be installed in the environment using pip or conda install 

The best way to export the environment is using yml files. We can then use these yml files to install the same environment with all the packages with single command. Activate the environment and execute the following command
conda env export > environment.yml
To install using the environment from yml file use the command
conda env create -f environment.yml
Installing Cuda
To see current Nvidia driver version and gcc version
 cat /proc/driver/nvidia/version
Adding the repository to ubuntu change the version number according to requirement: The following adds the Cuda 9.0 version
wget 'https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda_9.0.176_384.81_linux-run' -O cuda-run

sudo sh cuda-run
If latest nvidea driver is already installed answer no the question


Check /usr/local for cuda and cuda 9.0 folders to know if the installation is a success or not.

Adding cuda to the path: After adding this the user should either logout or restart the system.
# add cuda tools to command path
 export PATH=/usr/local/cuda/bin:${PATH}
 export MANPATH=/usr/local/cuda/man:${MANPATH}
 # add cuda libraries to library path
 if [[ "${LD_LIBRARY_PATH}" != "" ]]
    then
       export LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH}
    else
       export LD_LIBRARY_PATH=/usr/local/cuda/lib64
 fi
Current version of Tensorflow(1.5) needs cuda 9.0 and Cudnn 7.5 to work. Cuda 9.1 is not supported in Tensorflow. Check Tensorflow website for other compitable versions.

Comments

Popular posts from this blog

Installing Oracle 12c in Ubuntu

This process has been tested on Ubuntu desktop 16.04 and 16.04.4. It should work for other versions too, but it is not guaranteed. SO first thing in this installation process is to download the Oracle 12c zip file from its website Oracle . This file will be around 3 GB so it's going to take some time. The next thing would be to download the mandela.sh file(courtesy of Howard Rogers). This file will create a new user in your system, download all necessary packages and change settings so that Oracle can run. It will take more than an hour for this to complete the execution so be patient. Give the name of the user you want to run Oracle on and his password(remember these). When this is done restart and login to the new user. The new user is not sudo user. We will give the user root privileges when installation is done. Now extract the installation file which we have downloaded at starting of the process. cd database/runInstaller The above command will start the installation of...