Back to Community
Import of run_pipeline not working.


I'm just getting started in implementing an algorithm I want to try and just want to log what data I import through my pipeline.
Anyhow, as tutorial shows I should just import the run_pipeline method,

from quantopian.research import run_pipeline  

but this generate the error :

Runtime exception: ImportError: No module named 'quantopian.research'  

Which makes me very confused.

Any help?

2 responses

From the error message it appears you are coding an algorithm in the IDE? The run_pipeline method, and actually the entire module quantopian.research, only applies to the notebook environment. You will get an error if you try to import it into an algorithm (as you noticed). To use pipeline in an algo one only needs the following import

    from quantopian.pipeline import Pipeline

That will get you the Pipeline class definition. The other two methods associated with pipelines that you will use in an algo are attach_pipeline and pipeline_output.

    from quantopian.algorithm import attach_pipeline, pipeline_output

    attach_pipeline(pipeline, 'pipeline')  
    pipeline_data  = pipeline_output('pipeline')  

One doesn't need to actually import these methods however. To make coding more concise these are 'pre-imported' behind the scenes. It's probably good practice though to explicitly do the import to make it a bit more clear where these come from.

Anyway, the issue is the method run_pipeline is only used in notebooks. The similar method pipeline_output is used in algorithms.

Hope that clears it up. If you haven't already check out the pipeline user guide in the docs.


The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Ahh I see! Thank you Dan!

Will continue with the documation here on and out!