Zipline beginner help

780 views
Skip to first unread message

cja...@stern.nyu.edu

unread,
Nov 18, 2014, 3:09:33 PM11/18/14
to zip...@googlegroups.com
So I've installed Zipline via conda and now I am trying to implement the example strategy from Quantopian but I am getting the error message, 

----> 1 from zipline.api import price

ImportError: No module named api


I'm writing my code using Spyder via Anaconda 2.7, and I'm lost on how to set up my coding environment to start using Zipline. Could anyone help me with detailed instruction on how to set up my python environment (using Spyder) so I can start using Zipline outside of the Quantopian IDE? I understand how to install zipline via conda, but are there any other steps I have to take to start using the functions of Zipline? Pretty much I have Zipline "installed" but I can't use it. Can anyone show me the way? Thanks!!




Thomas Wiecki

unread,
Nov 19, 2014, 5:14:19 AM11/19/14
to cja...@stern.nyu.edu, zipline
Can you try to first "import zipline" and then "from zipline.api import price"? `import zipline` first has to register some functions in api (which we should probably fix).



--
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/d/optout.

Thomas Wiecki

unread,
Nov 21, 2014, 8:40:10 AM11/21/14
to Curtis James, zipline
This is very confusing indeed as it does indeed look like everything was correctly installed.

One idea is that maybe you have an old version that gets imported. Can you provide the output of:

import zipline
print zipline.__version__
print zipline.__file__

Also, is this python 2 or 3?

On Wed, Nov 19, 2014 at 7:12 PM, Curtis James <cja...@stern.nyu.edu> wrote:
Here is a picture of the installation success, can you please help me with the configuration needed to start using Zipline?

On Wed, Nov 19, 2014 at 10:20 AM, Curtis James <cja...@stern.nyu.edu> wrote:
Thanks for your response Thomas,

I have tried that and I am getting the message:

import zipline

from zipline.api import price
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-5-0fb9877edb87> in <module>()
----> 1 from zipline.api import price

ImportError: No module named api


I am still very confused, are there any steps between installing zipline and importing it that I should take? I don't get why it is still not working.
Thanks for your help.

willip

unread,
May 8, 2015, 5:30:33 AM5/8/15
to zip...@googlegroups.com
Hi, I'm having same issue on a Mac:

conda install -c Quantopian zipline

Fetching package metadata: ......

Solving package specifications: .....................

# All requested packages already installed.

# packages in environment at /Users/Username/anaconda:

#

zipline                   0.7.0                np18py27_0

   

$ python

Python 2.7.8 (default, Jul 13 2014, 17:11:32) 

[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

>>> import zipline

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

ImportError: No module named zipline

>>> 


Please help!

Thomas Wiecki

unread,
May 8, 2015, 6:11:39 AM5/8/15
to willip, zipline
I think you're not using the correct Python. You're using the system one but should be using the anaconda one. After installing anaconda it should ask you to add a path to your .bashrc and then restart the terminal. Have you done that?

Thomas

willip

unread,
May 8, 2015, 9:17:26 AM5/8/15
to zip...@googlegroups.com, wil...@willip.com
Thomas! You're a Genius! Thank you! I was working with ...

which python

/opt/local/bin/python

Reply all
Reply to author
Forward
0 new messages