PyMC3 Install on Windows 10

Hey what’s up? Let’s not talk about the length of time since my last post.

I wanted to share before I forget the steps I endured to get PyMC3 installed and working on my Windows 10 laptop (its a Lenovo Thinkpad). PyMC3 is a tool for doing probabilistic programming in Python and looks super cool. However, it has been challenging for me to totally install both at home and work. I think I got it now so let me review what I have learned. Here are the steps I took (I have python3.6 installed):

1. pip install pymc3 <-gets pymc3, theano and necessary packages
2. During the pip install I get a few warnings: a) two additional packages were needed (I pip installed them too) b) a tool has been installed to my python scripts directory, but that is not included in my windows PATH. This latter is interesting because in fact the directory is included in my "User Variables" PATH but not my "System Variables" PATH. For those new to all this, you can change these variables by searching for "Env" and choosing Edit the System Environment Variables:
3. In the command prompt started a ipython/jupyter notebook: jupyter notebook
4. Then I began by importing pymc3 in the first cell in my notebook: import pymc3. Sadly, this yields an error saying “no g++ compiler detected”. Without a “found” compiler, pymc3 (theano) will be slow. In fact, I do have Visual Studio 2015 installed, but am not sure whether I selected to install Visual C++, so I’ll install one to be safe.
5. To install g++: At home I chose the Anaconda route…ultimately uninstalling python first to try to get the paths correct. Once you do that you can conda install mingw64-toolchain. At work today, I simply went with installing: mingw64. This is easy BUT CRITICALLY YOU MUST CHOOSE x86-64 AND NOT THE DEFAULT i686 architecture from the installation dropdow. This mistake cost me hours earlier.
6. Although it asked me a lot about whether to install stuff to the path, mingw64 did not seem to (may I need a reboot) so I manually added the bin directory to my path. for me that was:
7. I re-ran the first cell in my notebook and it didn’t complain. Good.
8. As a first test, I began entering the code in the example
9. All went well until it was time for the NUTS sampler (I found this at home too). When run with “cores=2″ or greater it stops with an error. Specifically an error with pickling.The single comment on that StackOverflow page seems to have fixed it for me. Unfortunately, first I had to…
10. Install Git. This went smoothly, except that I wanted Notepad++ as my editor so I installed that so I could choose it during install.
11. Now the command pip3 install -U git+ will uninstall the earlier version of pymc3 and grab the latest one from git. NOTE: I added https:// to the URL from the comment in StackOverflow.
12. Voila!
13. Now I can learn about this cool tool. Thanks to the internet and to people that take the time to explain how they fixed problems!

Leave a Reply

Powered by WP Hashcash