Back

Getting started with python in visual studio

I'm pretty sure I've got LEAN running C# algorithms in my machine... and now I'm at the part in the directions that read:

Run python algorithm

  1. Update the config to run the python algorithm:

"algorithm-type-name": "BasicTemplateAlgorithm",
"algorithm-language": "Python",
"algorithm-location": "../../../Algorithm.Python/BasicTemplateAlgorithm.py",

This seems easy enough, I'm just wondering where is "the config?"

Thanks,Jon

Update Backtest







0

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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


nm...found it, edited, saved , build exited with code

    9009.    QuantConnect.Algorithm.Python      

 

   
 

0

oops - nope...that was my fault...

now it's built correctly and running results in:

The program '[49476] QuantConnect.Lean.Launcher.exe' has exited with code -1073740791 (0xc0000409)

0

lPython error: Py_Initialize: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'

0

Hi John,

The quickest suggestion I can provide you with is to exit VS and then re-open and build the solution -- sometimes this is required before rebuilding the solution. Aside from this, can you provide step-by-step documentation of how you're moving from the initial VS solution to building it in Python? Following the instructions for installing LEAN and using it with Python should work as long as you've completed each step, but if you're still encountering issues then giving us thorough documentation of the steps you're taking to make the change will allow us to better help debug the issue.

0

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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Thanks Jack.  I appreciate your response. Originally I was having issues with the directions, but then figured that out - I couldn't figure out how to delete my post, however.  I believe I've followed all the steps correctly but may be having an issue with my python install - hence the Ipython error.  

0

If you're still having that issue, can you confirm what version of Python / Anaconda you're running? We've updated PythonNet recently so there shouldn't be an issue with that, but if there is one then any documentation of bugs/issues that you're encountering is extremely helpful.

0

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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


No problem - originally that's why I posted the errors, but I have a feeling it's just me - I had some issues with my python install that I have yet to fully sort out.

I'm running:

 conda 4.6.4

python 3.6.8 

I think anaconda version is 5.2.0 ... it now reports as "custom"

 

If I ever fix the problem, I'll comment what I did.

0

Ok, definitely try uninstalling both Anaconda and Python and re-downloading Anaconda 5.2 with Python 3.6. I'm running those in my Python environment in Visual Studio and this should work for you as well. If not, please let us know and we'll do our best to help get LEAN working for you!

1

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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Hi I am facing a similar issue . I already had Anaconda installed and VS installed (separate installations as I use C++ and python for my other work. Anconda version 3.6.7. VS 2017. I compiled and ran the C# version. Then made changes to config.json file. When I run the Python version, I get the error:

51903_1551573694.jpg

0

Anaconda Python 3 is already in path,

0

Hi Sundar,

Just to confirm, are you running Anaconda 3.6 or are you running a version of Anaconda that runs Python 3.6? Additionally, did you re-build the solution before attempting to run the Python algorithm? It seems like your algorithm might be using a package that isn't a default package in LEAN. If it isn't one of the demonstration algorithms we provide, can you attach a backtest or the code that you're running? This is will better help us isolate the issue and provide you with a solution.

0

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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed