PyCUDA on Windows 8.1

After I had successfully installed Theano, about a week later (see my previous post), I went ahead and installed PyCUDA on my Windows 8.1 laptop.

To make this happen, I went to Christoph Gohlke’s “Unofficial Windows Binaries for Python Extension Packages” website.

Christoph noted that there are a few prerequisite Python packages for PyCUDA…however, all but two of these were already a part of the Anaconda distribution, so there were only 2 that I needed to download/install before installing PyCUDA:

  • appdirs-1.4.0-py2.py3-none-any.whl
  • pytools‑2015.1.1‑py2.py3‑none‑any.whl

…then I downloaded:

  • pycuda‑2015.1.2+cuda7028‑cp34‑none‑win_amd64.whl

[NOTE: very shortly after I did this, Gohlke updated his site and now (8/1) only lists “pytools” as the prerequisite Python package you will need to download…so whether or not I needed appdirs is an unknown!]

After downloading these three wheel files, I fired up a Windows Command Prompt, navigated to the Downloads folder, and installed all three sequentially via “pip install”:

  • pip install appdirs-1.4.0-py2.py3-none-any.whl
  • pip install pytools‑2015.1.1‑py2.py3‑none‑any.whl
  • pip install pycuda‑2015.1.2+cuda7028‑cp34‑none‑win_amd64.whl

After these three files were installed, I went to Will Landau’s excellent collection of PyCUDA code examples (which also has a nice accompanying video and slides) and downloaded them onto my machine. Of the dozen files, all but one worked (after making some minor Python3 tweaks here and there…). The only one that did not work was a file called “” which threw an import error telling me that I needed to install the Mako templating engine.

Outside of this very minor issue (which I may go ahead and correct here shortly by installing Mako), everything went pretty well.

NOTE: if you get an nvcc fatal error : cannot find compiler c1.exe in PATH, note the location of c1.exe in your Visual Studio installation (mine is 2013, so it lives in C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin). Just add this to your PATH variable, restart your machine and try again!!


Theano on Windows 8.1…GPU Computing here I come!

I just purchased an ASUS K501LX Windows 8.1 laptop, with an NVIDIA GeForce GTX 950M GPU. Now I can start looking at GPU computing in Python…notably with the Theano package!

First things first…I will say upfront that I had some trepidation going into this. In doing some preliminary research over the past couple of months, I had come across more than a few cases where people had extreme difficulty, if not outright failure, when trying to get Theano to work with their GPUs on their Windows machines. Luckily, a couple of weeks ago, I came across this helpful blog post which cleared away a lot of the conflicting and negative information I was getting out there.

I largely followed his instructions with a couple of modifications. Here is what I did to get it all up and running:

  1. Install Visual Studio 2013 Community Edition. Straightforward…but it took the longest (around half-an-hour) of all of these steps!
  2. Install the NVIDIA CUDA 7.0 Toolkit. Now let’s talk about this for a second, because this gave me a bit of a scare. Upon running the installation, I got the following message: “This graphics driver could not find compatible graphics hardware.” After checking the NVIDIA site however, I found out that all I needed to do is hit “Continue” and choose “Custom (Advanced)” installation, and uncheck the Graphics Driver (the GPU Deployment Kit also becomes unchecked!) All we really need is the CUDA Toolkit! After this, I chose the default installation locations and the CUDA Toolkit installed flawlessly.
  3. Install Git-SCM for Windows (this will be for downloading and installing Theano from its GitHub repository)
  4. Install Anaconda for Python 3.4
  5. Once Anaconda was installed and configured on my machine, I installed the mingw package by entering the following command at the Anaconda command prompt: conda install mingw libpython.
  6. Next I created a folder called “theano-download” off of my C drive. From the Windows Command Prompt, I navigated to this folder and entered the following commands:
    1. git clone git://
    2. cd Theano
    3. python develop
  7. This successfully installed Theano, but now comes the hard part: getting Theano to utilize my GPU! To do this, I created a file named .theanorc.txt (note the period in front of the file name!), saved it to my home directory (C:\Users\Brian) and entered the following text:


floatX = float32

device = gpu



compiler_bindir=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin

Before creating this, I verified that those two paths actually existed! It was a good thing I did because I realized that I needed to change the flags parameter to point to C:\Anaconda3\libs since I am running Python 3!

OK…so I took a deep breath as the moment of truth was upon me! Were my efforts in vain or were they successful?

I eagerly fired up IPython and typed in import theano to find out…


Great success! It’s using my GPU device!

The last step: run a test! From the Windows Command Prompt, I navigated to the C:\theano-download\Theano\theano\misc folder and typed in the following command to run a test of the Theano installation: 


Would it work? Importing was one thing…but testing it is quite another! Needless to say success was to be had! I got a message stating that 10 calls were executed to gemm with a and b matrices of shapes (2000,2000) and (2000,2000)…Total execution time: 0.25s on GPU.

Happy times! Now it’s time to start exploring Theano and deep learning!

Hello world! It’s time you and I had a talk!

This is my first post ever. Bear with me while I literally riff and see what happens!

Here goes…

I’ve been questioning all my life, never finding answers but more questions. I’ve never really settled on any one perspective, viewpoint, dogma, whatever you want to call it…but some, what I’d call “fundamentals” (notice I am avoiding the “T” word) have emerged in all this questioning over the years:

  1. Transhumanism makes the most sense regarding who we are and where we are going: technology has and will continue to improve our world and is now entering a period where it will be used to actually improve and modify our very own nature. We should embrace this, albeit doing so with much forethought, rather than running away from it due to fear and paranoia.
  2. Nature wants you dead! So quit worshipping nature as if “the natural” has some inviolate, sacrosanct status. We CAN and SHOULD overcome certain aspects of nature that need to be overcome, including things such as disease, aging, and even perhaps death. This to me is one of the most important tenets of transhumanism.
  3. On the other hand, let’s not trash the planet. We should do everything in our power to make the world around us a better place, and one aspect of this is to stop messing up the planet. We live here…let’s take care of our home.
  4. Abundant examples of Peter Diamandis’ “6 Ds” are all around us now and it nothing short of fascinating to watch unfold (digitization, deception, disruption, demonetization, dematerialization, democratization). Looking here at the iPad on the desk next to me: can you imagine showing this to my 1980s counterpart? Walkman, movie player, video camcorder, audio voice records, literally 1,000s of books at my disposal on the Kindle app, etc., all of which are now dematerialized onto this one single small device. Imagine similar wondrous things that my 2030s counterpart will witness!
  5. I love life…because of this, I want to extend it as much as the laws of physics will allow, which is why I am a big fan and supporter of life extension projects such as the Longevity Cookbook (list a few more).
  6. Because I love life, I also seek to try to protect and preserve the lives of others…and yes, this extends to non-human animals as much as possible. This is why I choose to be a vegetarian, and also explains my predilection for refusing to kill spiders, ants, and other pests that may wander into our house. I always seek to put them outside where they belong.
  7. We are our network. There is no true self awaiting self-actualization, realization, etc. Instead we are who we interact with. One of the many things that haunted me about humans in my younger days was how quickly people changed when they changed company. In my military days I remember former friends who, once they donned Sergeant stripes, became (from my perspective) completely different individuals, and many, unfortunately, downright nasty and brutish and quite unlike they were when they were of lower ranks. Then when I went off to college, took a few psychology classes, and saw this repeated even more frighteningly in Zimbardo’s Stanford Prison Experiment. But it wasn’t until very recently, after I realized that there is no true self and that we are who we interact with, that all of this made sense. All the more reason to:
  8. Watch the company you keep: stick with those who motivate you to higher heights and who are inspiring and motivating and exude positivity rather than its opposite. There are just too many negative people in the world today; this needs to change!
  9. I seek to continually self-improve every day, both mentally, physically, and emotionally. Therefore, every day I am engaged in various forms of auto-didactic activity, diet, and exercise, from studying machine learning, Python programming, GPU programming, to doing yoga and kettlebell workouts, to meditation and nootropics. I am in a state of “permanent beta”, constantly refining myself, with my motto being: keep going, keep growing.
  10. We humans tend to overestimate ourselves by deluding ourselves into thinking that, because we have “consciousness”, and consciousness is some spooky, mysterious thing, that we are somehow “special.” For the most part, we ARE meat machines, and the vast majority of us pretty much might as well be robots, since most people never even reflect upon what they are doing and why they do what they do…instead they just follow along and do what others are doing and telling them to do. Self-reflection is possible, but unfortunately it tends all too often to convince us that we are anything but robotic meat machines.
  11. However, self-reflection IS a great gift and I marvel at how we are the one species on this planet that CAN look out there on this vast and wondrous cosmos and simply contemplate it. Imagine that the vastness of the cosmos can be contemplated by this 3 pound block of grey-goo in our skulls. That IS amazing to think about. OK, so there is one sense in which we humans really are special! However, this does not somehow negate the fact that we are still meat machines and that all that circuitry in our brains is nothing more than that.

That’s all for now….until next time!

Keep going, keep growing!