zipline on windows?

1,163 views
Skip to first unread message

minsky

unread,
Apr 2, 2013, 10:39:32 AM4/2/13
to zip...@googlegroups.com
Can anyone walk through the install process on windows? 

Eddie Hebert

unread,
Apr 2, 2013, 7:00:23 PM4/2/13
to minsky, zip...@googlegroups.com
minsky:

(Take this Windows advice with a grain of salt, since I do not have
much experience running Python on Windows. Someone else might be able
to provide more Windows specific instructions.)

Since Zipline leverages many scientific Python libraries, I believe the
best way to get these libraries on to a Windows machine is with the
Enthought distribution, http://www.enthought.com/products/epd.php

Once that is installed, I you should be able to install Zipline by
running `enpkg zipline`

(Alternatively you can install pip with `enpkg pip` and then run
run `pip install zipline`)

The documentation for installation onto Windows (and in general) is
not where it could be. When you do get it working, could you share
the steps you took to get Zipline working on Windows?

Hope that helps!

- Eddie

minsky <mmre...@gmail.com> writes:

> Can anyone walk through the install process on windows?
>
> --
> You received this message because you are subscribed to the Google Groups "Zipline Python Opensource Backtester" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to zipline+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Fabian Kostadinov

unread,
Jan 23, 2014, 7:03:30 AM1/23/14
to zip...@googlegroups.com
I am giving up. Maybe someone else is more successful than me. I really, really tried to install zipline on Windows 7 plus PyDev for Eclipse, but I did not succeed getting it to run. Here is an incomplete list of problems encountered:

1. I first tried to install Python 64 bit as provided from python.org. Bad idea. turns out, the current numpy version has problems with running in 64 bit.
2. I reinstalled Python in 32 bit as distributed from python.org. Bad idea again. easy_install/pip were not able to install numpy. Problem is, there is no compiler for C++/Fortran code.
3. Thus I tried to install MinGW from mingw.org. Installation was easy, but the exact same error persisted when trying to install numpy. Be aware that you have to mingle around not only with System paths, but also with making python/pip/easy_install to understand what compiler you want to use. Whatever the correct colution, I could not find it.
4. I undid my changes in my attempt to use the MinGW compiler, and instead downloaded and installed Visual Studio 2008 the freeware edition. There are also compilers for C++/Fortran. Still no success, numpy could not be installed/compiled properly.
5. Instead, I found out there are some pre-compiled 32 bit numpy versions on the web that can be installed through an MSI. Tried some of them. Installation went smooth.
6. Next I tried to install matjplotlib. After endless trying out with easy_install/pip, which did not work, I found a pre-compiled 32 bit version that I used.
7. Turns out, the pre-compiled version also does not work. Two different folders are generated, and I had to delete one ending in something like matplotlib-xxx-egg-info.
8. When I thought I had everything installed, I tried some simple example in PyDev/Eclipse. For some reason, the import of matplotlib did not work, and I did not succeed in making it work.
9. After a lot of frustration, I decided to delete all and everything and start with Enthought Canopy's python. Installation was really easy, and it basically contains most modules you will need (including numpy and matplotlib).
10. I used easy_install to install zipline. This seemingly went fine.
11. But still I could not get it running in PyDev with Eclipse. Apparently, imports are totally screwed up in PyDev. When running my sample code, I persistently received error messages telling me that one or another module cannot be found, no matter what I do.
12. Of course I could now try to get the sys.path or however it's called right, but I won't give it a try.

This has now cost me a full working day (10h of work), and I still could not get any result. So, I'm giving up. I really enjoy the work done on quantopian.com, and I am very positive this will grow into something big. But trying to get to run zipline on my local Windows-machine computer was a total pain. To be honest, after having worked with Java, Scala and Clojure (which were all easy to install and run) I don't understand why anyone tries to turn back the wheel of time and fiddle around with libraries written in Fortran, no matter how speedy Fortran might or might not be for certain problems.

Fabian Kostadinov

unread,
Jan 23, 2014, 7:17:42 AM1/23/14
to zip...@googlegroups.com
By the way, this might be of help too if you really attempt to run zipline on your Windows-machine:

Thomas Wiecki

unread,
Jan 23, 2014, 7:18:08 AM1/23/14
to Fabian Kostadinov, zipline
Hi Fabian,

Thanks for alerting us to the installation difficulties of zipline under windows. I too spent way too much time dealing with Python packaging. Especially windows can be very painful.

I think the best solution will be to create conda installers so that you can install a binary version and get your Python from anaconda which comes prepackaged with a lot of the scientific libraries required.

Thomas


--

Quant Trader

unread,
Feb 9, 2014, 11:14:40 AM2/9/14
to zip...@googlegroups.com
Hi,

I have a Microsoft C# development background with Visual Studio. Installing Python and how it is organized with so many different versions and files is a pain. I agree. I succeeded and I hope you will too with my instructions. The only thing I did not look into is getting zipline running similar as on quantopian.com. I used Python xy since its installer is working properly and contains the main packages used for trading.

J.

==

Setup Development Python on a Windows 8 64 bit machine

Install Visual Studio 2013

Install VSTS https://pytools.codeplex.com/wikipage?title=PTVS%20Installation

Install Python x,y http://code.google.com/p/pythonxy

This distribution contains a good installer on Windows and helps you install most packages. I installed the normal 32-bit version. It is not distributing the latest Python version, but will not give you headaches with all packages not matching with each other. Do make sure no other version of Python is installed.

After installation of Python x,y (take notice you can select which packages you want to include, the only scikit-learn is not present).

On Windows Power shell [right click and Run as Administrator]

  1. pip –list shows all installations in distribution

  2. easy_install -U scikit-learn

  3. easy_install ipython[all]

  4. easy_install --upgrade pip

  5. easy_install pyparsing

  6. ipython notebook --pylab=inline

  7. ipython qtconsole –pylab=inline

  8. Now run an example:

Import pandas as np
x
=np.array([1,2,3])
plot(x)

  1. pip install zipline

Ready to go now….build in VS the library of commands for intellisense.

Run intellisense for Python version

To improve performance, a lot of our IntelliSense features depend on a completion database. This database is automatically generated in the background for each version of Python you have, and contains all the information about its standard library and any other installed packages. You can see the current state of the database in the Python Enviroments list (Ctrl+K, ` - Control + K, backtick) [` = key below ESC on QWERTY keyboard].

Quant Trader

unread,
Feb 9, 2014, 12:02:45 PM2/9/14
to zip...@googlegroups.com
Hi,

If you like to use intellisense of Visual Studio as I am used to in C#.

Then from Visual Studio New Project. Select Templates --> Python --> From Existing Code. Then select the zipline folder. I choose Algorithm.py as startup file. It runs on command prompt all oke. It also stops on the break point def run(self...)

However, I have no idea how to connect a working algorithm and how to have this algorithm receive data. I guess I need to changes something to point it to a sample test algorithm. But how? Maybe look further for some documenation / help on doing that...

J.

# TODO: make a new subclass, e.g. BatchAlgorithm, and move 
# the run method to the subclass, and refactor to put the 
# generator creation logic into get_generator. 
def run(self, source, sim_params=None, benchmark_return_source=None): 
"""Run the algorithm.

Quant Trader

unread,
Feb 9, 2014, 12:15:13 PM2/9/14
to zip...@googlegroups.com
I create new MyAlgorithm.py file and copy-pasted the sample at the GitHub. Then set this as start project. It collects automatically data from Yahoo..and then at gov. something..then finally it got back with simulation results...Not the question is how to hook the plotting into the Python box which opens by default. Running it in iPyhton would be great. 

So I would say, it works...now the details.

AAPL
data files aren't distributed with source.
Fetching data from Yahoo Finance.
data files aren't distributed with source.
Fetching data from data.treasury.gov
[2014-02-09 17:12] INFO: Performance: Simulated 3028 trading days out of 3028.
[2014-02-09 17:12] INFO: Performance: first open: 1990-01-02 14:31:00+00:00
[2014-02-09 17:12] INFO: Performance: last close: 2001-12-31 21:00:00+00:00

Peter Cawthron

unread,
Feb 9, 2014, 12:18:48 PM2/9/14
to zip...@googlegroups.com
Hello QT,

Have you seen this on using IPython in PTVS?

https://pytools.codeplex.com/wikipage?title=Using%20IPython%20with%20PTVS

P.

Quant Trader

unread,
Feb 9, 2014, 4:24:59 PM2/9/14
to zip...@googlegroups.com
Hi,
Yes, I have that running. However, I am not able to run IPython from F5 - start debugging - I created this post: https://pytools.codeplex.com/discussions/530958 .
J.




Quant Trader

unread,
Feb 11, 2014, 4:24:48 PM2/11/14
to zip...@googlegroups.com
Hi,
Now it runs well in PVTS. Now I am wondering if the graphs with results of quantopian.com which you also see in the forum posts can also be run offline. I suspect it are SVG graphs, but maybe from some library in Python as well.
J.

Quant Trader

unread,
Feb 11, 2014, 4:25:57 PM2/11/14
to zip...@googlegroups.com
By the way. On PVTS forum of Microsoft there are also instructions on how to set up a Python environment on Windows.

Suminda Dharmasena

unread,
Mar 20, 2014, 8:46:00 AM3/20/14
to zip...@googlegroups.com
How do I get the Zipline from the latest source on Github working on windows?

Michael Bennett

unread,
Mar 20, 2014, 9:18:25 AM3/20/14
to zip...@googlegroups.com
follow the instructions for setting up canopy or the enthought distributions and your done. They have most of the stuff there and you just pip install the zipline package at the end.

use spyder to test the simple MA example on the github site and that will tell you what is working or not.

Took me 20minutes including download time.

Michael Bennett

unread,
Mar 20, 2014, 11:09:48 AM3/20/14
to zip...@googlegroups.com
Ok I would say if you want the latest code you would need to package it up and push it into your packages via pip.

1. build and package
2. install from local package via pip (you probably want to uninstall any previous versions you have)

Stackoverflow has an example here:


Hopefully this is more help than my last post.

Thanks

Michael
Reply all
Reply to author
Forward
0 new messages