Figuring out what dependencies are needed

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed Dec 11 14:27:07 CET 2013


On Wed, 11 Dec 2013 04:44:53 -0800, sal wrote:

> Now I'd like to use the backtesting package from zipline (zipline.io),

".io" is not normally a file extension for Python files. Are you sure 
that's Python code?


> but while running the test script in iPython, I receive the following
> error:
> 
> AssertionError                            Traceback (most recent call
> last) 
> <ipython-input-6-f921351f78e2> in <module>()
> ----> 1 data = load_from_yahoo()
>       2 dma = DualMovingAverage()
>       3 results = dma.run(data)

I think you may be missing one or more lines? Perhaps something like 
"AssertionError: blah blah blah" appearing after that?


For those unfamiliar with iPython, rather than a standard Traceback, that 
appears to suggest that dma.run(data) is raising AssertionError, but we 
can't see what (if any) error message is given by that assert, or how it 
fails.

Can you explain what precise command you are running? Please copy and 
paste the exact command line you used that gives that error.

Also, whenever you get unexpected errors while running from an IDE or non-
standard environment like IDLE or iPython, your first step should be to 
run the same script from the command line using the vanilla Python 
interpreter and see if the error goes away. Do you need assistance with 
doing that? Feel free to ask for additional instructions.


> 1)  I assume that I'm missing some packages that aren't included in
> Anaconda, but how do I know which ones to upload?

Why do you make that assumption? I would expect missing packages to give 
an ImportError, not an AssertionError.


> 2)  Often I'll just unzip a library file and put the main folder in the
> iPython folder, but I notice there's usually a setup.py file in the main
> library folder.  I've been ignoring this.  Should I be using it?

Absolutely! You'll probably see a READ ME file in the unzipped folder, 
you should read that for instructions.

It may be that sometimes the setup.py file will do nothing more than copy 
the main folder into your site-packages folder, but it may do a lot more. 
Also, if you just dump random packages into iPython's private library 
area, you may even break iPython.


-- 
Steven



More information about the Python-list mailing list