How to install Theano on Mac OS X with homebrew

Deep Learning, which is also introduced in here, is easy to write, but I was able to put it in homebrew, so I will write how to do it.

If you are using Scipy Superpack, it is better to delete it first.

If you enter Scipy from the repository of here, you can also enter theano. I put Python in homebrew.

brew tap samueljohn/python
brew install scipy
pip install Theano

In 0.6rc2, various errors occur when testing.

python -c 'import theano; theano.test()'
E00001	#include <Python.h>
00002	#include <iostream>
00003	#include <numpy/arrayobject.h>
00004	#include <math.h>
00005	#include <numpy/arrayscalars.h>
00006	//////////////////////
00007	////  Support Code
00008	//////////////////////
00009	
00010	
00011	    struct __struct_compiled_op_d294414d3fa581b0e3ab72b870c38ab1 {
00012	        PyObject* __ERROR;
00013	
00014	        PyObject* storage_V3;

(Omission)

Problem occurred during compilation with the command line below:
g++ -dynamiclib -g -O3 -Wno-write-strings -Wno-unused-label -Wno-unused-variable -fno-math-errno -D NPY_ARRAY_ENSURECOPY=NPY_ENSURECOPY -D NPY_ARRAY_ALIGNED=NPY_ALIGNED -D NPY_ARRAY_WRITEABLE=NPY_WRITEABLE -D NPY_ARRAY_UPDATE_ALL=NPY_UPDATE_ALL -D NPY_ARRAY_C_CONTIGUOUS=NPY_C_CONTIGUOUS -D NPY_ARRAY_F_CONTIGUOUS=NPY_F_CONTIGUOUS -fPIC -undefined dynamic_lookup -framework Python -m64 -I/usr/local/lib/python2.7/site-packages/numpy/core/include -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -o /Users/user/.theano/compiledir_Darwin-12.2.1-x86_64-i386-64bit-i386-2.7.3/tmpvvh7I_/d294414d3fa581b0e3ab72b870c38ab1.so /Users/user/.theano/compiledir_Darwin-12.2.1-x86_64-i386-64bit-i386-2.7.3/tmpvvh7I_/mod.cpp -L/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib

Perhaps you couldn't compile the dynamically generated C code.

Take a moment to upgrade to the development version of git.

pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git

Although there were some warnings, the test passed successfully.

Clone the code for the Deep Learning Tutorial (http://deeplearning.net/tutorial/intro.html). (A summary of the data used can be found in Getting Started)

git clone git://github.com/lisa-lab/DeepLearningTutorials.git

Let's move Logistic Regression Sample.

cd DeepLearningTutorials/code
python logistic_sgd.py

I got an output like this. The error numbers are about the same.

…
epoch 74, minibatch 83/83, validation error 7.479167 %
     epoch 74, minibatch 83/83, test error of best model 7.489583 %
Optimization complete with best validation score of 7.479167 %,with test performance 7.489583 %
The code run for 75 epochs, with 3.206806 epochs/sec

By the way, matplotlib did not come in this way. .. .. I was in trouble. </ Strike> → I just didn't reinstall Command Line Tools after updating XCode. .. .. It was too rudimentary. And Qiita doesn't support strikethrough. Spicy. .. ..

If you are in trouble, brew doctor is important.

Recommended Posts

How to install Theano on Mac OS X with homebrew
How to install Theano on Mac OS X 10.10 (using pyenv, anaconda)
How to install caffe on OS X with macports
Install PyQt5 with homebrew on Mac OS X Marvericks (10.9.2)
Very easy to install SciPy on Mac OS X
How to install mysql-connector-python on mac
How to install OpenCV on Mac
Install mitmproxy on Mac OS X
Install pgmagick on Mac OS X 10.9
How to install drobertadams / toggl-cli on Mac
How to erase Python 2.x on Mac.
Install lp_solve on Mac OS X and call it with python.
How to install OpenGM on OSX with macports
Install NumPy, SciPy, Matplotlib with Homebrew on OS X (as of November 2015)
How to cast with Theano
Preparing to use aws cli on Mac OS X
How to install Python2.7 python3.5 with pyenv (on RHEL5 CentOS5) (2016 Nov)
Steps to install matplotlib on Mac
Introducing OpenCV on Mac with homebrew
How to install python-pip with ubuntu20.04LTS
How to install graph-tool on macOS
Install Scipy on Mac OS Sierra
How to install VMware-Tools on Linux
How to use homebrew on Debian
How to install TensorFlow on CentOS 7
How to install mysql-connector with pip3
How to install Maven on CentOS
Steps to install python3 on mac
How to install Go on Ubuntu
How to install music 21 on windows
How to install Anaconda with pyenv
Get started with the Python framework Django on Mac OS X
How to run Jupyter and Spark on Mac with minimal settings
How to install pandas on EC2 (How to deal with MemoryError and PermissionError)
I tried to display GUI on Mac with X Window System
[Kivy] How to install Kivy on Windows [Python]
How to install DLIB with 2020 / CUDA enabled
Installed aws-cli On Mac OS X Lion
How to install packages on Alpine Linux
How to install Anisble on Amazon Linux 2
How to install richzhang / colorization on Windows 10
How to install Apache (httpd) on CentOS7
How to install php7.4 on Linux (Ubuntu)
"How to pass PATH" to learn with homebrew
How to install Eclipse GlassFish 5.1.0 on CentOS 7
How to install zsh (with .zshrc customization)
How to install NumPy on Raspberry Pi
How to install cx_Oracle on macOS Sierra
Run NASA CEA on Mac OS X
How to install python3 with docker centos
Steps to get KeePassX key on OS X with one command line
How to install Deep Learning framework Caffe on Mac in CPU mode
[2020 version] How to install Python3 on AWS EC2
Strategy on how to monetize with Python Java
How to install OpenCV on Jetson Nano Python
Preparing to run ImageMagick + im4java on Mac OS
I wanted to install Python 3.4.3 with Homebrew + pyenv
How to quickly install h5py on Windows 10 [Unofficial]
Run Zookeeper x python (kazoo) on Mac OS X
Put Python 2.7.x on Mac OSX 10.15.5 with pyenv
Install shogun with python modular (OS X Yosemite)