Posts

How to run R code in Python

Image
R is freely available language and computational tool which is very popular among the statisticians and bioinformatics community. In this post I am going to list the steps to run R commands through python on Windows. On Linux it is much simple to setup but the steps are almost similar.
Requirements:R: https://cran.r-project.org/Python 2.7, 3.4, 3.5 or 3.6: https://www.continuum.io/downloadsrpy2 pip package (Windows only): http://www.lfd.uci.edu/~gohlke/pythonlibs/#rpy2 My configuration is R version 3.4.1 (https://cran.r-project.org/bin/windows/base/R-3.4.1-win.exe) and Python 3.5 Anaconda x64: https://repo.continuum.io/archive/Anaconda3-4.2.0-Windows-x86_64.exe
Installation Instructions:Install RInstall AnacondaEdit Environment Variables (Control Panel -> System -> Advanced system settings -> Environment Variables) Select Path -> Edit and add R installation path (default location is "C:\Program Files\R\R-3.4.1\bin\x64") to Path variable and press OKSelect New and …

How to run MATLAB code from Python

Image
Python is a free open source programming language and can be used to solve a number of problems from research purposes to web development and big data analysis. MATLAB provides a list of professionally developed specialized toolboxes for a number of problems. It is sometimes required to use MATLAB code in your python script. I have listed below a set of instructions to run MATLAB code in python.
NOTE: To run MATLAB code using this method you will still need MATLAB licence.
Requirements:Matlab version 2014b or above.Python 2.7, 3.4 or 3.5 My configuration is MATLAB 2017a and Python 3.5 Anaconda x64: https://repo.continuum.io/archive/Anaconda3-4.2.0-Windows-x86_64.exeInstallation Instructions:Run MATLAB and in command window enter the following command >> matlabroot ans = 'C:\Program Files\MATLAB\R2017a' C:\Program Files\MATLAB\R2017a' is the default matlabroot folder on Windows. This may be different on your system. Open Windows command window (or launch termi…

Compile MatConvNet on Windows

Image
Matconvnet is a convolutional neural network (CNN) toolbox for Matlab. Being integrated into Matlab it gives you the flexibility to use Matlab built in functions but it's execution time is slightly slower compared to C++ based caffe and other deep learning libraries. In addition, you need Matlab licence to run this library. Similar to other Matlab toolboxes it's relatively easier to compile compared to open source caffe and tensorflow. I have listed the set of instructions to compile MatConvNet on a Windows machine.
Requirements:Matlab version 2017aMatConvNet : http://www.vlfeat.org/matconvnet/, http://www.vlfeat.org/matconvnet/download/matconvnet-1.0-beta24.tar.gzVisual Studio 2015: https://www.visualstudio.com/downloads/, https://www.visualstudio.com/vs/older-downloads/CUDA 8.0: (For GPU Support only) https://developer.nvidia.com/cuda-downloadscuDNN v5.1 (For GPU support only): https://developer.nvidia.com/cudnnInstructions:Extract MatConvNet to a folder.Install Visual Studio…

Install Tensorflow on Windows

Image
The instructions below can be used to install precompiled version of tensorflow. To build tensorflow from source please follow the instructions in my previous post <http://www.shaneahmed.com/2017/07/build-tensorflow-on-windows.html>. After successful build you can follow the same instructions as for the precompiled version below. Make sure you use the correct path to tensorflow pip package .whl file. Requirements:Python 3.5 Anaconda x64: https://repo.continuum.io/archive/Anaconda3-4.2.0-Windows-x86_64.exeCUDA 8.0 (For GPU Support):  https://developer.nvidia.com/cuda-downloadscuDNN v5.1 (For GPU support) : https://developer.nvidia.com/cudnnInstallation instructions:Install Anaconda in "C:\tools\", make sure you select Register Anaconda as system path for Python 3.5.Open command window. (Win+R -> cmd -> Enter)Enter the following commands C:\> conda create -n tensorflowCPU python=3.5Enter 'y' if asked to continue.Activate conda virtual environment by enter…

Build TensorFlow on Windows

Image
Requirements:GIT for Windows: https://git-scm.com/download/winSWIG: https://sourceforge.net/projects/swig/files/swigwin/swigwin-3.0.10/Visual Studio 2015: https://www.visualstudio.com/downloads/, https://www.visualstudio.com/vs/older-downloads/CMake 3.4 or higher: https://cmake.org/download/Python 3.5 Anaconda x64: https://repo.continuum.io/archive/Anaconda3-4.2.0-Windows-x86_64.exeCUDA 8.0:  https://developer.nvidia.com/cuda-downloadscuDNN v5.1: https://developer.nvidia.com/cudnnInstructions:Install Cmake and add it to system path.Install CUDA v8.0 (For GPU support only)Extract cuDNN (For GPU Support only)copy all files from bin folder to 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin'similarly from include to 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include' and 'lib\x64' to  ''C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64'.Install Anaconda in "C:\tools\", make sure you select Register Anac…

Build caffe, pycaffe and matcaffe on Windows

Image
Requirements: Download and install the following software's: Git for Windows: https://git-scm.com/download/winVisual Studio 2015: https://www.visualstudio.com/downloads/. To download older versions of visual studio you can go to https://www.visualstudio.com/vs/older-downloads/Cmake 3.4 or higher https://cmake.org/download/Python 3.5 Anaconda x64 (Required to build pycaffe). https://repo.continuum.io/archive/Anaconda3-4.2.0-Windows-x86_64.exeCUDA 8.0 https://developer.nvidia.com/accelerated-computing-toolkitcuDNN v5.1 (optional) https://developer.nvidia.com/cudnnMatlab (Required to build matcaffe)  http://mathworks.comInstructions: Install Cmake and add it to system path.Install CUDA v8.0 (For GPU support only)Extract cuDNN (For GPU Support only)copy all files from bin folder to 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin'similarly from include to 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include' and 'lib/x64' to  ''C:…

How to compile caffe on Windows 10

Image
*UPDATE*: Updated instructions at this link < http://www.shaneahmed.com/2017/07/build-caffe-pycaffe-and-matcaffe-on.html > Requirements: Download and install the following software's: Visual Studio 2015 https://www.visualstudio.com/downloads/Make 3.4 or higher https://cmake.org/download/Python 3.5 Anaconda x64 (Required to build pycaffe). https://repo.continuum.io/archive/Anaconda3-4.2.0-Windows-x86_64.exeCUDA 8.0 https://developer.nvidia.com/accelerated-computing-toolkitcuDNN v5.1 (optional) https://developer.nvidia.com/cudnnMatlab (Required to build matcaffe)  http://mathworks.com Instructions:Install CUDA v8.0Extract cuDNN foldercopy all files from bin folder to 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin'similarly from include to 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include' and 'lib/x64' to  ''C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib/x64'. Install Anaconda, make sure you select Reg…