Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Theano on Anaconda Python 2.7 x64 on Windows?

I wonder how to install Theano on Anaconda Python 2.7 x64 on Windows 7 x64. The Theano website provides some instructions but is not clear as to what is specific to Anaconda.

like image 510
Franck Dernoncourt Avatar asked Nov 13 '15 06:11

Franck Dernoncourt


People also ask

How do I import libraries in anaconda prompt?

Go to Environments tab just below the Home tab and from there we can check what all packages are installed and what is not. It is very easy to install any package through anaconda navigator, simply search the required package, select package and click on apply to install it.


2 Answers

I'm not 100% certain but this may be a minimal set of instructions, but only if you don't want to use a GPU. Getting Theano to use a GPU on Windows is quite a bit more difficult.

  1. Install TDM GCC x64.
  2. Install Anaconda x64.
  3. run conda update conda.
  4. run conda update --all.
  5. run conda install mingw libpython.
  6. Install Theano (how you do this depends on whether you want to interact with the Theano source code or not, and whether you want the "bleeding edge" version, or are happy with the last, but out-of-date major release).
    1. Older version: e.g. pip install Theano.
    2. Bleeding edge version: e.g. pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git (see linked documentation for more options)

If you want multithreading support via OpenMP then things get more complicated.

If you want GPU support things get much more complicated.

The Windows installation instructions in the Theano documentation are fragmented at best, and terribly out of date at worst. If you need more than the basics working on Windows, you'll need to pick your way through to find an approach that works for you.

like image 136
Daniel Renshaw Avatar answered Oct 08 '22 22:10

Daniel Renshaw


The trick is that YOU NEED TO CREATE AN ENVIRONMENT/WORKSPACE FOR PYTHON. This solution should work for Python 2.7 but at the time of writing keras can run on python 3.5, especially if you have the latest anaconda installed (this took me awhile to figure out so I'll outline the steps I took to install KERAS in python 3.5):

-- CREATE ENVIRONMENT/WORKSPACE FOR PYTHON 3.5:

  1. C:\conda create --name neuralnets python=3.5
  2. C:\activate neuralnets

-- INSTALL EVERYTHING (notice the neuralnets workspace in parenthesis on each line). ACCEPT ANY DEPENDENCIES EACH OF THOSE STEPS WANTS TO INSTALL:

  1. (neuralnets) C:\conda install theano
  2. (neuralnets) C:\conda install mingw libpython
  3. (neuralnets) C:\pip install tensorflow
  4. (neuralnets) C:\pip install keras

-- TEST IT OUT:

(neuralnets) C:\python -c "from keras import backend; print(backend._BACKEND)"

Just remember, if you want to work in the workspace you always have to do:

C:\activate neuralnets

so you can launch Jypiter for example (assuming you also have jypiter installed in this environment/workspace) as:

C:\activate neuralnets
(neuralnets) jypiter notebook

You can read more about managing and creating conda environments/workspaces at the follwing URL: https://conda.io/docs/using/envs.html

like image 33
Denis Avatar answered Oct 08 '22 21:10

Denis