Hi,
I have tried succesfully to build and run a C# strategy. But when compiling (No errors) and running a Python Strategy QuantConnect.Lean.Launcher.exe exist with code error 1.
I think I have done all the steps indicated in github page but I miss something maybe.
My config is: VS2017 Community + Anaconda + python2.7 with panda package added (I put some capture . Any idea please??
Thanks
Mike Quails
Team
I spent 5 hours on this and leaned the following.
Step 1:
Follow these instructions from Alexandre post above Steps 1 to 4 above.
Steps 2: May give you some trouble if you are not used to playing wiht python like me.
2.5 Install pandas and its dependencies.
Simple go to your start menu and run the Anaconda promt.
Step 2:
Make sure the QuantConnect.Algorithm.PythonTools project is pointed to the right version of Python 2.7
VS2017 default is 3.6 not 2.7. So load both with the Visual Studio Installer...
Visual Studio Installer: Can be found on the menu at \Tools\Get Tools and Features
Under indivudal componnects click both Python2 and Python
To make sure you are running the correct version of Python...
Right click the Python Environment segment of the QuantConnect.Algorithm.PythonTools project.
Select add and Remove Python Environments, and select Python 2.6.
Spo this is what worked for me on a fresh install of VS2017.
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.
Jared Broad
Thank you for the detailed post Mike; If you're able please update the python readme with your findings and I'll give you a free live subscription =)
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.
Oscar Rojas Casanova
Hello Mike, So you used Anacondas installation? or why you run Anaconda Prompt?
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.
John Britt
The following is the command that you need to run
$ easy_install web.py
And according to the document for lpthw (which just uses a fork of web.py), you can run :
$ pip install lpthw.web
Then to run the application you will just need to do:
$ python app.py
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.
Alix Claire Erie
Hi, I am on a Mac, and I am also having problems with the python module... It seems also with the C# module when trying to load the first solution in installation "QuantConnect.Lean.sln".
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.
Alix Claire Erie
Here is (part of) an explanation: https://docs.microsoft.com/en-us/visualstudio/python/installing-python-support-in-visual-studio#visual-studio-2017
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.
Alix Claire Erie
I've spend about 6 hours working on this and I am pretty much back where I started....
In any case, although after a lot of manual installing of extensions in Visual Studio Code, I am able to run the QuantConnect.Lean.sln without a problem with the two project files mentioned above (QuantConnect.Algorithm.PythonTools.pyproj and QuantConnect.VisualStudio17Plugin.csproj), but I get an error about reference assemblies.
After installing mono (and realizing I needed to install C# on my new computer) I tried Visual Studio for Mac again...
After deleting the two aforementioned projects from QuantConnect.Lean.sln (meaning the lines of code that begin/end with "Project/End Project") the .sln file runs and returns the following error:
Note: I modified the QuantConnect.Lean.Launcher.csproj file <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> to reflect my version of .Net. (Current .Net Core for Mac is v2.1.4).
There is reference to a similar issue with the Linux/Ubuntu installation in the readme.md file, so I tried that and this is what I got:
ALIXs-iMac:~ alixerie$ echo "deb http://download.mono-project.com/repo/ubuntu xenial main" | sudo tee /etc/apt/sources.list.d/mono-official.list Password: tee: /etc/apt/sources.list.d/mono-official.list: No such file or directory deb http://download.mono-project.com/repo/ubuntu xenial main ALIXs-iMac:~ alixerie$
FINALLY... when I completely DELETE the version, the solution runs with no errors and I get all of the files built (except for the F# and the Python folders). Meaning now in QuantConnect.Lean.Launcher.csproj I have <TargetFrameworkVersion></TargetFrameworkVersion>. There is no target framework specified....
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.
Alix Claire Erie
And so, finally I have STATISTICS OUTPUT running the Algorithm.CSharp/BasicTemplateAlgorithm.cs.
I think the things to note for Visual Studio for Mac is make sure to:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew install scriptcs
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "QuantConnect.Algorithm.PythonTools", "Algorithm.Python\QuantConnect.Algorithm.PythonTools.pyproj", "{4A5DED1F-3E34-40E2-B1F2-9A8A02195508}" EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuantConnect.VisualStudioPlugin", "VisualStudioPlugin\QuantConnect.VisualStudio17Plugin.csproj", "{5326A9FB-0270-4647-8C43-20C5607DB529}" EndProject
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
to
<TargetFrameworkVersion></TargetFrameworkVersion>
Not sure how stable these last changes are... and I think they have gone outside of the scope of this thread... perhaps it should be moved/copied to a new thread for Mac Installation.
Thanks!
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.
Alix Claire Erie
Finally, it seems that the Project for the VisualStudioPlugin cannot be loaded because the project tries to import a file that does not exist, namely on Line 3 of VisualStudioPlugin/QuantConnect.VisualStudio17Plugin.csproj:
<Import Project="..\packages\Microsoft.VSSDK.BuildTools.15.1.192\build\Microsoft.VSSDK.BuildTools.props" Condition="Exists('..\packages\Microsoft.VSSDK.BuildTools.15.1.192\build\Microsoft.VSSDK.BuildTools.props')" />
I did a thorough search in the terminal and the file doesn't exist anywhere:
ALIXs-iMac:~ alixerie$ sudo find / -name Microsoft.VSSDK.BuildTools.props Password: find: /dev/fd/alixerie: No such file or directory find: /dev/fd/alixerie: No such file or directory ALIXs-iMac:~ alixerie$
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.
Jared Broad
Thanks Alix Claire Erie -- good investigating! In future please post LEAN questions/issues/tutorials like this to the google group where it will benefit most people: https://groups.google.com/forum/#!forum/lean-engine
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.
Marc Lucci
I was having a similar issue where VS would reconize Python but I was still getting an error that Lean could not find the .dll. I tried the above and reinstalled everything with no luck. Howerver, I was able to get it to work by going to Tools > NuGet Package Manager > Manage NuGet Packages for Solution then updated the packages and reinstalled QuantConnect.pythonnet to the entire project. I was able to build it and run a debug with no further issues. I spent many hours trying to figure this out and hope I can save someone else the time and headache!
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.
Azhar Mustafa
I want to run a python script from within IntelliJ IDEA passing a file list as a parameter. I'm using menu Run->Edit Configurations->Script Parameters to define a file list using wildcards like:
"../examples/*.jpg"
Inside the code I'm iterating the file list using a for loop like
for f in sys.argv[1:]:
Although the script executes fine from terminal, IDEA throws a file not found exception:
No such file or directory: '../examples/*.jpg'
I suppose this makes sense (my theory) since there is no shell involved to expand the command line argument into a file list prior passing it to the script.
There is an answer in a similar question here: Pycharm and sys.argv arguments The relevant answer using wildcards is https://stackoverflow.com/a/41003295/7521854 but it is not working. (If I had enough rep I'd commented on this answer, sorry)
Any suggestion will make me happy!
PS: running OSX 10.11.6 (El Capitan)
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.
Li li
@Alix Claire Erie, I have installed visual studio code for MAC, and installed extensions support for Python, .Net core tools and C#, and installed .Net SDK. When I opened QuantConnect.Lean.sln file, click Debug - start without debuging, select envirement as .Net core, there was no any feedback. How can I run Lean in Visual Studio Code for MAC for Python?
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.
Alix Claire Erie
li li In the end I did not set up the local version of QC. Lean was a bigger project than I was able to join. I continued by using the online version of QuantConnect, in C#.
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.
Stephen Hyer
For anyone still struggling to get the Python GUI to work correctly, I was able to solve the problem after a few hours. Here's what I did:
1) Follow the config.json steps as shown in the tutorial.
2) Download Python 3.6.8. I also have 3.7 and anacondas, but to my best knowledge LEAN only works with 3.6 for now.
- Make sure you include the location in PATH, but also take the python.exe, pythonw.exe and python36.dll and copy them to your System32 folder.
- Unblock C:\Program Files (x86)\LEAN\Lean-master\UserInterface\QuantConnect.Views by right clicking the file and going to properties
3) In Visual Studios at the top go to Tools -> Python -> Python Environments (Ctrl+K).
- Set Python 3.6 as your default
- Open the Powershell window and run pip install for numpy, pandas, seaborn and any other libraries you need to import.
You should now be able to build and run the python basic template. This is as far as I've gotten personally. I know I need to download some data files for my other algorithms, but hopefully this saves others some time.
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.
Link Liang
Hi Shyer,
Thanks for sharing your experience! Just want to add:
1. Here is how you install a specific version of python with anaconda (i.e. 3.6.6):
conda install -y python=3.6.6
Currently we only support Python 3.6, so if you are using python 3.7 please make sure to downgrade to 3.6 or install python 3.6 separately.
2. For mac users, please read our instruction of running Lean with python algorithms.
Thanks for your support.
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.
Omid Rad
Setting up QuantConnect Lean for Python
Algorithm.Python/readme.md has instructions for running Python algorithms with QuantConnect locally. But if that didn't work for you, try the following (Windows only):
Note: As of May 2020 QuantConnect supports Python 3.6, and is not compatible with Python 3.7 or later.
Install Visual Studio Community Edition
Install Anaconda (it is a distribution of the Python and R programming languages for data science, and includes Jupiter Notebooks and many other packages)
From the Start menu run Anaconda Prompt
Create a new environment. You need to do this only once.
conda create -y --name QuantConnect python=3.6 anaconda
conda activate QuantConnect
Check the QuantConnect environment is activated
conda env list
Now every time you wanted to open QuantConnect project do this:
From start Menu open Anaconda Powershell Prompt (QuantConnect)
Set PYTHONHOME environment variable
$env:PYTHONHOME="$env:USERPROFILE\anaconda3\envs\QuantConnect"
Open QuantConnect solution in Visual Studio
cd C:\repos\Lean
start .\QuantConnect.Lean.sln
Modify Launcher\config.json to have the following settings:
"environment": "backtesting",
"algorithm-type-name": "BasicTemplateAlgorithm",
"algorithm-language": "Python",
"algorithm-location": "../../../Algorithm.Python/BasicTemplateAlgorithm.py",
Run the project with F5
The above should work, but I could not find how to persist the environment so we can run the solution file by double-clicking on it. Setting
PYTHONHOME
in user env vars did not work.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.
John Addae
I have followed all instructions and steps to implement LEAN in Python wth VS but keep facing many errors when building the project file in VS, Errors screenshot attached in below link:
https://drive.google.com/file/d/17a59ULDmdRuymL4r6EIx8WvJh3_0AS7U/view?usp=sharing
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.
Alexandre Catarino
Hi John Addae ,
I have answered your question in this thread:
Using Lean with Visual Studio 2017 and Anaconda3 #4174
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.
Mike Quails
Team
I spent 5 hours on this and leaned the following.
Step 1:
Follow these instructions from Alexandre post above Steps 1 to 4 above.
Steps 2: May give you some trouble if you are not used to playing wiht python like me.
2.5 Install pandas and its dependencies.
Simple go to your start menu and run the Anaconda promt.
Step 2:
Make sure the QuantConnect.Algorithm.PythonTools project is pointed to the right version of Python 2.7
VS2017 default is 3.6 not 2.7. So load both with the Visual Studio Installer...
Visual Studio Installer: Can be found on the menu at \Tools\Get Tools and Features
Under indivudal componnects click both Python2 and Python
To make sure you are running the correct version of Python...
Right click the Python Environment segment of the QuantConnect.Algorithm.PythonTools project.
Select add and Remove Python Environments, and select Python 2.6.
Spo this is what worked for me on a fresh install of VS2017.
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.
Jared Broad
Thank you for the detailed post Mike; If you're able please update the python readme with your findings and I'll give you a free live subscription =)
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.
Oscar Rojas Casanova
Hello Mike, So you used Anacondas installation? or why you run Anaconda Prompt?
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.
John Britt
The following is the command that you need to run
$ easy_install web.py
And according to the document for lpthw (which just uses a fork of web.py), you can run :
$ pip install lpthw.web
Then to run the application you will just need to do:
$ python app.py
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.
Alix Claire Erie
Hi, I am on a Mac, and I am also having problems with the python module... It seems also with the C# module when trying to load the first solution in installation "QuantConnect.Lean.sln".
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.
Alix Claire Erie
Here is (part of) an explanation: https://docs.microsoft.com/en-us/visualstudio/python/installing-python-support-in-visual-studio#visual-studio-2017
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.
Alix Claire Erie
I've spend about 6 hours working on this and I am pretty much back where I started....
In any case, although after a lot of manual installing of extensions in Visual Studio Code, I am able to run the QuantConnect.Lean.sln without a problem with the two project files mentioned above (QuantConnect.Algorithm.PythonTools.pyproj and QuantConnect.VisualStudio17Plugin.csproj), but I get an error about reference assemblies.
After installing mono (and realizing I needed to install C# on my new computer) I tried Visual Studio for Mac again...
After deleting the two aforementioned projects from QuantConnect.Lean.sln (meaning the lines of code that begin/end with "Project/End Project") the .sln file runs and returns the following error:
Note: I modified the QuantConnect.Lean.Launcher.csproj file <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> to reflect my version of .Net. (Current .Net Core for Mac is v2.1.4).
There is reference to a similar issue with the Linux/Ubuntu installation in the readme.md file, so I tried that and this is what I got:
ALIXs-iMac:~ alixerie$ echo "deb http://download.mono-project.com/repo/ubuntu xenial main" | sudo tee /etc/apt/sources.list.d/mono-official.list Password: tee: /etc/apt/sources.list.d/mono-official.list: No such file or directory deb http://download.mono-project.com/repo/ubuntu xenial main ALIXs-iMac:~ alixerie$
FINALLY... when I completely DELETE the version, the solution runs with no errors and I get all of the files built (except for the F# and the Python folders). Meaning now in QuantConnect.Lean.Launcher.csproj I have <TargetFrameworkVersion></TargetFrameworkVersion>. There is no target framework specified....
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.
Alix Claire Erie
And so, finally I have STATISTICS OUTPUT running the Algorithm.CSharp/BasicTemplateAlgorithm.cs.
I think the things to note for Visual Studio for Mac is make sure to:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew install scriptcs
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "QuantConnect.Algorithm.PythonTools", "Algorithm.Python\QuantConnect.Algorithm.PythonTools.pyproj", "{4A5DED1F-3E34-40E2-B1F2-9A8A02195508}" EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuantConnect.VisualStudioPlugin", "VisualStudioPlugin\QuantConnect.VisualStudio17Plugin.csproj", "{5326A9FB-0270-4647-8C43-20C5607DB529}" EndProject
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
to
<TargetFrameworkVersion></TargetFrameworkVersion>
Not sure how stable these last changes are... and I think they have gone outside of the scope of this thread... perhaps it should be moved/copied to a new thread for Mac Installation.
Thanks!
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.
Alix Claire Erie
Finally, it seems that the Project for the VisualStudioPlugin cannot be loaded because the project tries to import a file that does not exist, namely on Line 3 of VisualStudioPlugin/QuantConnect.VisualStudio17Plugin.csproj:
<Import Project="..\packages\Microsoft.VSSDK.BuildTools.15.1.192\build\Microsoft.VSSDK.BuildTools.props" Condition="Exists('..\packages\Microsoft.VSSDK.BuildTools.15.1.192\build\Microsoft.VSSDK.BuildTools.props')" />
I did a thorough search in the terminal and the file doesn't exist anywhere:
ALIXs-iMac:~ alixerie$ sudo find / -name Microsoft.VSSDK.BuildTools.props Password: find: /dev/fd/alixerie: No such file or directory find: /dev/fd/alixerie: No such file or directory ALIXs-iMac:~ alixerie$
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.
Jared Broad
Thanks Alix Claire Erie -- good investigating! In future please post LEAN questions/issues/tutorials like this to the google group where it will benefit most people: https://groups.google.com/forum/#!forum/lean-engine
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.
Marc Lucci
I was having a similar issue where VS would reconize Python but I was still getting an error that Lean could not find the .dll. I tried the above and reinstalled everything with no luck. Howerver, I was able to get it to work by going to Tools > NuGet Package Manager > Manage NuGet Packages for Solution then updated the packages and reinstalled QuantConnect.pythonnet to the entire project. I was able to build it and run a debug with no further issues. I spent many hours trying to figure this out and hope I can save someone else the time and headache!
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.
Azhar Mustafa
I want to run a python script from within IntelliJ IDEA passing a file list as a parameter. I'm using menu Run->Edit Configurations->Script Parameters to define a file list using wildcards like:
"../examples/*.jpg"
Inside the code I'm iterating the file list using a for loop like
for f in sys.argv[1:]:
Although the script executes fine from terminal, IDEA throws a file not found exception:
No such file or directory: '../examples/*.jpg'
I suppose this makes sense (my theory) since there is no shell involved to expand the command line argument into a file list prior passing it to the script.
There is an answer in a similar question here: Pycharm and sys.argv arguments The relevant answer using wildcards is https://stackoverflow.com/a/41003295/7521854 but it is not working. (If I had enough rep I'd commented on this answer, sorry)
Any suggestion will make me happy!
PS: running OSX 10.11.6 (El Capitan)
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.
Li li
@Alix Claire Erie, I have installed visual studio code for MAC, and installed extensions support for Python, .Net core tools and C#, and installed .Net SDK. When I opened QuantConnect.Lean.sln file, click Debug - start without debuging, select envirement as .Net core, there was no any feedback. How can I run Lean in Visual Studio Code for MAC for Python?
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.
Alix Claire Erie
li li In the end I did not set up the local version of QC. Lean was a bigger project than I was able to join. I continued by using the online version of QuantConnect, in C#.
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.
Stephen Hyer
For anyone still struggling to get the Python GUI to work correctly, I was able to solve the problem after a few hours. Here's what I did:
1) Follow the config.json steps as shown in the tutorial.
2) Download Python 3.6.8. I also have 3.7 and anacondas, but to my best knowledge LEAN only works with 3.6 for now.
- Make sure you include the location in PATH, but also take the python.exe, pythonw.exe and python36.dll and copy them to your System32 folder.
- Unblock C:\Program Files (x86)\LEAN\Lean-master\UserInterface\QuantConnect.Views by right clicking the file and going to properties
3) In Visual Studios at the top go to Tools -> Python -> Python Environments (Ctrl+K).
- Set Python 3.6 as your default
- Open the Powershell window and run pip install for numpy, pandas, seaborn and any other libraries you need to import.
You should now be able to build and run the python basic template. This is as far as I've gotten personally. I know I need to download some data files for my other algorithms, but hopefully this saves others some time.
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.
Link Liang
Hi Shyer,
Thanks for sharing your experience! Just want to add:
1. Here is how you install a specific version of python with anaconda (i.e. 3.6.6):
conda install -y python=3.6.6
Currently we only support Python 3.6, so if you are using python 3.7 please make sure to downgrade to 3.6 or install python 3.6 separately.
2. For mac users, please read our instruction of running Lean with python algorithms.
Thanks for your support.
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.
Omid Rad
Setting up QuantConnect Lean for Python
Algorithm.Python/readme.md has instructions for running Python algorithms with QuantConnect locally. But if that didn't work for you, try the following (Windows only):
Note: As of May 2020 QuantConnect supports Python 3.6, and is not compatible with Python 3.7 or later.
Install Visual Studio Community Edition
Install Anaconda (it is a distribution of the Python and R programming languages for data science, and includes Jupiter Notebooks and many other packages)
From the Start menu run Anaconda Prompt
Create a new environment. You need to do this only once.
conda create -y --name QuantConnect python=3.6 anaconda
conda activate QuantConnect
Check the QuantConnect environment is activated
conda env list
Now every time you wanted to open QuantConnect project do this:
From start Menu open Anaconda Powershell Prompt (QuantConnect)
Set PYTHONHOME environment variable
$env:PYTHONHOME="$env:USERPROFILE\anaconda3\envs\QuantConnect"
Open QuantConnect solution in Visual Studio
cd C:\repos\Lean
start .\QuantConnect.Lean.sln
Modify Launcher\config.json to have the following settings:
"environment": "backtesting",
"algorithm-type-name": "BasicTemplateAlgorithm",
"algorithm-language": "Python",
"algorithm-location": "../../../Algorithm.Python/BasicTemplateAlgorithm.py",
Run the project with F5
The above should work, but I could not find how to persist the environment so we can run the solution file by double-clicking on it. Setting
PYTHONHOME
in user env vars did not work.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.
John Addae
I have followed all instructions and steps to implement LEAN in Python wth VS but keep facing many errors when building the project file in VS, Errors screenshot attached in below link:
https://drive.google.com/file/d/17a59ULDmdRuymL4r6EIx8WvJh3_0AS7U/view?usp=sharing
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.
Alexandre Catarino
Hi John Addae ,
I have answered your question in this thread:
Using Lean with Visual Studio 2017 and Anaconda3 #4174
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.
Mike Quails
Team
I spent 5 hours on this and leaned the following.
Step 1:
Follow these instructions from Alexandre post above Steps 1 to 4 above.
Steps 2: May give you some trouble if you are not used to playing wiht python like me.
2.5 Install pandas and its dependencies.
Simple go to your start menu and run the Anaconda promt.
Step 2:
Make sure the QuantConnect.Algorithm.PythonTools project is pointed to the right version of Python 2.7
VS2017 default is 3.6 not 2.7. So load both with the Visual Studio Installer...
Visual Studio Installer: Can be found on the menu at \Tools\Get Tools and Features
Under indivudal componnects click both Python2 and Python
To make sure you are running the correct version of Python...
Right click the Python Environment segment of the QuantConnect.Algorithm.PythonTools project.
Select add and Remove Python Environments, and select Python 2.6.
Spo this is what worked for me on a fresh install of VS2017.
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.
Jared Broad
Thank you for the detailed post Mike; If you're able please update the python readme with your findings and I'll give you a free live subscription =)
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.
Oscar Rojas Casanova
Hello Mike, So you used Anacondas installation? or why you run Anaconda Prompt?
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.
John Britt
The following is the command that you need to run
$ easy_install web.py
And according to the document for lpthw (which just uses a fork of web.py), you can run :
$ pip install lpthw.web
Then to run the application you will just need to do:
$ python app.py
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.
Alix Claire Erie
Hi, I am on a Mac, and I am also having problems with the python module... It seems also with the C# module when trying to load the first solution in installation "QuantConnect.Lean.sln".
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.
Alix Claire Erie
Here is (part of) an explanation: https://docs.microsoft.com/en-us/visualstudio/python/installing-python-support-in-visual-studio#visual-studio-2017
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.
Alix Claire Erie
I've spend about 6 hours working on this and I am pretty much back where I started....
In any case, although after a lot of manual installing of extensions in Visual Studio Code, I am able to run the QuantConnect.Lean.sln without a problem with the two project files mentioned above (QuantConnect.Algorithm.PythonTools.pyproj and QuantConnect.VisualStudio17Plugin.csproj), but I get an error about reference assemblies.
After installing mono (and realizing I needed to install C# on my new computer) I tried Visual Studio for Mac again...
After deleting the two aforementioned projects from QuantConnect.Lean.sln (meaning the lines of code that begin/end with "Project/End Project") the .sln file runs and returns the following error:
Note: I modified the QuantConnect.Lean.Launcher.csproj file <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> to reflect my version of .Net. (Current .Net Core for Mac is v2.1.4).
There is reference to a similar issue with the Linux/Ubuntu installation in the readme.md file, so I tried that and this is what I got:
ALIXs-iMac:~ alixerie$ echo "deb http://download.mono-project.com/repo/ubuntu xenial main" | sudo tee /etc/apt/sources.list.d/mono-official.list Password: tee: /etc/apt/sources.list.d/mono-official.list: No such file or directory deb http://download.mono-project.com/repo/ubuntu xenial main ALIXs-iMac:~ alixerie$
FINALLY... when I completely DELETE the version, the solution runs with no errors and I get all of the files built (except for the F# and the Python folders). Meaning now in QuantConnect.Lean.Launcher.csproj I have <TargetFrameworkVersion></TargetFrameworkVersion>. There is no target framework specified....
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.
Alix Claire Erie
And so, finally I have STATISTICS OUTPUT running the Algorithm.CSharp/BasicTemplateAlgorithm.cs.
I think the things to note for Visual Studio for Mac is make sure to:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew install scriptcs
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "QuantConnect.Algorithm.PythonTools", "Algorithm.Python\QuantConnect.Algorithm.PythonTools.pyproj", "{4A5DED1F-3E34-40E2-B1F2-9A8A02195508}" EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuantConnect.VisualStudioPlugin", "VisualStudioPlugin\QuantConnect.VisualStudio17Plugin.csproj", "{5326A9FB-0270-4647-8C43-20C5607DB529}" EndProject
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
to
<TargetFrameworkVersion></TargetFrameworkVersion>
Not sure how stable these last changes are... and I think they have gone outside of the scope of this thread... perhaps it should be moved/copied to a new thread for Mac Installation.
Thanks!
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.
Alix Claire Erie
Finally, it seems that the Project for the VisualStudioPlugin cannot be loaded because the project tries to import a file that does not exist, namely on Line 3 of VisualStudioPlugin/QuantConnect.VisualStudio17Plugin.csproj:
<Import Project="..\packages\Microsoft.VSSDK.BuildTools.15.1.192\build\Microsoft.VSSDK.BuildTools.props" Condition="Exists('..\packages\Microsoft.VSSDK.BuildTools.15.1.192\build\Microsoft.VSSDK.BuildTools.props')" />
I did a thorough search in the terminal and the file doesn't exist anywhere:
ALIXs-iMac:~ alixerie$ sudo find / -name Microsoft.VSSDK.BuildTools.props Password: find: /dev/fd/alixerie: No such file or directory find: /dev/fd/alixerie: No such file or directory ALIXs-iMac:~ alixerie$
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.
Jared Broad
Thanks Alix Claire Erie -- good investigating! In future please post LEAN questions/issues/tutorials like this to the google group where it will benefit most people: https://groups.google.com/forum/#!forum/lean-engine
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.
Marc Lucci
I was having a similar issue where VS would reconize Python but I was still getting an error that Lean could not find the .dll. I tried the above and reinstalled everything with no luck. Howerver, I was able to get it to work by going to Tools > NuGet Package Manager > Manage NuGet Packages for Solution then updated the packages and reinstalled QuantConnect.pythonnet to the entire project. I was able to build it and run a debug with no further issues. I spent many hours trying to figure this out and hope I can save someone else the time and headache!
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.
Azhar Mustafa
I want to run a python script from within IntelliJ IDEA passing a file list as a parameter. I'm using menu Run->Edit Configurations->Script Parameters to define a file list using wildcards like:
"../examples/*.jpg"
Inside the code I'm iterating the file list using a for loop like
for f in sys.argv[1:]:
Although the script executes fine from terminal, IDEA throws a file not found exception:
No such file or directory: '../examples/*.jpg'
I suppose this makes sense (my theory) since there is no shell involved to expand the command line argument into a file list prior passing it to the script.
There is an answer in a similar question here: Pycharm and sys.argv arguments The relevant answer using wildcards is https://stackoverflow.com/a/41003295/7521854 but it is not working. (If I had enough rep I'd commented on this answer, sorry)
Any suggestion will make me happy!
PS: running OSX 10.11.6 (El Capitan)
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.
Li li
@Alix Claire Erie, I have installed visual studio code for MAC, and installed extensions support for Python, .Net core tools and C#, and installed .Net SDK. When I opened QuantConnect.Lean.sln file, click Debug - start without debuging, select envirement as .Net core, there was no any feedback. How can I run Lean in Visual Studio Code for MAC for Python?
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.
Alix Claire Erie
li li In the end I did not set up the local version of QC. Lean was a bigger project than I was able to join. I continued by using the online version of QuantConnect, in C#.
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.
Stephen Hyer
For anyone still struggling to get the Python GUI to work correctly, I was able to solve the problem after a few hours. Here's what I did:
1) Follow the config.json steps as shown in the tutorial.
2) Download Python 3.6.8. I also have 3.7 and anacondas, but to my best knowledge LEAN only works with 3.6 for now.
- Make sure you include the location in PATH, but also take the python.exe, pythonw.exe and python36.dll and copy them to your System32 folder.
- Unblock C:\Program Files (x86)\LEAN\Lean-master\UserInterface\QuantConnect.Views by right clicking the file and going to properties
3) In Visual Studios at the top go to Tools -> Python -> Python Environments (Ctrl+K).
- Set Python 3.6 as your default
- Open the Powershell window and run pip install for numpy, pandas, seaborn and any other libraries you need to import.
You should now be able to build and run the python basic template. This is as far as I've gotten personally. I know I need to download some data files for my other algorithms, but hopefully this saves others some time.
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.
Link Liang
Hi Shyer,
Thanks for sharing your experience! Just want to add:
1. Here is how you install a specific version of python with anaconda (i.e. 3.6.6):
conda install -y python=3.6.6
Currently we only support Python 3.6, so if you are using python 3.7 please make sure to downgrade to 3.6 or install python 3.6 separately.
2. For mac users, please read our instruction of running Lean with python algorithms.
Thanks for your support.
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.
Omid Rad
Setting up QuantConnect Lean for Python
Algorithm.Python/readme.md has instructions for running Python algorithms with QuantConnect locally. But if that didn't work for you, try the following (Windows only):
Note: As of May 2020 QuantConnect supports Python 3.6, and is not compatible with Python 3.7 or later.
Install Visual Studio Community Edition
Install Anaconda (it is a distribution of the Python and R programming languages for data science, and includes Jupiter Notebooks and many other packages)
From the Start menu run Anaconda Prompt
Create a new environment. You need to do this only once.
conda create -y --name QuantConnect python=3.6 anaconda
conda activate QuantConnect
Check the QuantConnect environment is activated
conda env list
Now every time you wanted to open QuantConnect project do this:
From start Menu open Anaconda Powershell Prompt (QuantConnect)
Set PYTHONHOME environment variable
$env:PYTHONHOME="$env:USERPROFILE\anaconda3\envs\QuantConnect"
Open QuantConnect solution in Visual Studio
cd C:\repos\Lean
start .\QuantConnect.Lean.sln
Modify Launcher\config.json to have the following settings:
"environment": "backtesting",
"algorithm-type-name": "BasicTemplateAlgorithm",
"algorithm-language": "Python",
"algorithm-location": "../../../Algorithm.Python/BasicTemplateAlgorithm.py",
Run the project with F5
The above should work, but I could not find how to persist the environment so we can run the solution file by double-clicking on it. Setting
PYTHONHOME
in user env vars did not work.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.
John Addae
I have followed all instructions and steps to implement LEAN in Python wth VS but keep facing many errors when building the project file in VS, Errors screenshot attached in below link:
https://drive.google.com/file/d/17a59ULDmdRuymL4r6EIx8WvJh3_0AS7U/view?usp=sharing
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.
Alexandre Catarino
Hi John Addae ,
I have answered your question in this thread:
Using Lean with Visual Studio 2017 and Anaconda3 #4174
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.
Mike Quails
Team
I spent 5 hours on this and leaned the following.
Step 1:
Follow these instructions from Alexandre post above Steps 1 to 4 above.
Steps 2: May give you some trouble if you are not used to playing wiht python like me.
2.5 Install pandas and its dependencies.
Simple go to your start menu and run the Anaconda promt.
Step 2:
Make sure the QuantConnect.Algorithm.PythonTools project is pointed to the right version of Python 2.7
VS2017 default is 3.6 not 2.7. So load both with the Visual Studio Installer...
Visual Studio Installer: Can be found on the menu at \Tools\Get Tools and Features
Under indivudal componnects click both Python2 and Python
To make sure you are running the correct version of Python...
Right click the Python Environment segment of the QuantConnect.Algorithm.PythonTools project.
Select add and Remove Python Environments, and select Python 2.6.
Spo this is what worked for me on a fresh install of VS2017.
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.
Jared Broad
Thank you for the detailed post Mike; If you're able please update the python readme with your findings and I'll give you a free live subscription =)
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.
Oscar Rojas Casanova
Hello Mike, So you used Anacondas installation? or why you run Anaconda Prompt?
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.
John Britt
The following is the command that you need to run
$ easy_install web.py
And according to the document for lpthw (which just uses a fork of web.py), you can run :
$ pip install lpthw.web
Then to run the application you will just need to do:
$ python app.py
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.
Alix Claire Erie
Hi, I am on a Mac, and I am also having problems with the python module... It seems also with the C# module when trying to load the first solution in installation "QuantConnect.Lean.sln".
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.
Alix Claire Erie
Here is (part of) an explanation: https://docs.microsoft.com/en-us/visualstudio/python/installing-python-support-in-visual-studio#visual-studio-2017
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.
Alix Claire Erie
I've spend about 6 hours working on this and I am pretty much back where I started....
In any case, although after a lot of manual installing of extensions in Visual Studio Code, I am able to run the QuantConnect.Lean.sln without a problem with the two project files mentioned above (QuantConnect.Algorithm.PythonTools.pyproj and QuantConnect.VisualStudio17Plugin.csproj), but I get an error about reference assemblies.
After installing mono (and realizing I needed to install C# on my new computer) I tried Visual Studio for Mac again...
After deleting the two aforementioned projects from QuantConnect.Lean.sln (meaning the lines of code that begin/end with "Project/End Project") the .sln file runs and returns the following error:
Note: I modified the QuantConnect.Lean.Launcher.csproj file <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> to reflect my version of .Net. (Current .Net Core for Mac is v2.1.4).
There is reference to a similar issue with the Linux/Ubuntu installation in the readme.md file, so I tried that and this is what I got:
ALIXs-iMac:~ alixerie$ echo "deb http://download.mono-project.com/repo/ubuntu xenial main" | sudo tee /etc/apt/sources.list.d/mono-official.list Password: tee: /etc/apt/sources.list.d/mono-official.list: No such file or directory deb http://download.mono-project.com/repo/ubuntu xenial main ALIXs-iMac:~ alixerie$
FINALLY... when I completely DELETE the version, the solution runs with no errors and I get all of the files built (except for the F# and the Python folders). Meaning now in QuantConnect.Lean.Launcher.csproj I have <TargetFrameworkVersion></TargetFrameworkVersion>. There is no target framework specified....
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.
Alix Claire Erie
And so, finally I have STATISTICS OUTPUT running the Algorithm.CSharp/BasicTemplateAlgorithm.cs.
I think the things to note for Visual Studio for Mac is make sure to:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew install scriptcs
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "QuantConnect.Algorithm.PythonTools", "Algorithm.Python\QuantConnect.Algorithm.PythonTools.pyproj", "{4A5DED1F-3E34-40E2-B1F2-9A8A02195508}" EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuantConnect.VisualStudioPlugin", "VisualStudioPlugin\QuantConnect.VisualStudio17Plugin.csproj", "{5326A9FB-0270-4647-8C43-20C5607DB529}" EndProject
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
to
<TargetFrameworkVersion></TargetFrameworkVersion>
Not sure how stable these last changes are... and I think they have gone outside of the scope of this thread... perhaps it should be moved/copied to a new thread for Mac Installation.
Thanks!
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.
Alix Claire Erie
Finally, it seems that the Project for the VisualStudioPlugin cannot be loaded because the project tries to import a file that does not exist, namely on Line 3 of VisualStudioPlugin/QuantConnect.VisualStudio17Plugin.csproj:
<Import Project="..\packages\Microsoft.VSSDK.BuildTools.15.1.192\build\Microsoft.VSSDK.BuildTools.props" Condition="Exists('..\packages\Microsoft.VSSDK.BuildTools.15.1.192\build\Microsoft.VSSDK.BuildTools.props')" />
I did a thorough search in the terminal and the file doesn't exist anywhere:
ALIXs-iMac:~ alixerie$ sudo find / -name Microsoft.VSSDK.BuildTools.props Password: find: /dev/fd/alixerie: No such file or directory find: /dev/fd/alixerie: No such file or directory ALIXs-iMac:~ alixerie$
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.
Jared Broad
Thanks Alix Claire Erie -- good investigating! In future please post LEAN questions/issues/tutorials like this to the google group where it will benefit most people: https://groups.google.com/forum/#!forum/lean-engine
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.
Marc Lucci
I was having a similar issue where VS would reconize Python but I was still getting an error that Lean could not find the .dll. I tried the above and reinstalled everything with no luck. Howerver, I was able to get it to work by going to Tools > NuGet Package Manager > Manage NuGet Packages for Solution then updated the packages and reinstalled QuantConnect.pythonnet to the entire project. I was able to build it and run a debug with no further issues. I spent many hours trying to figure this out and hope I can save someone else the time and headache!
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.
Azhar Mustafa
I want to run a python script from within IntelliJ IDEA passing a file list as a parameter. I'm using menu Run->Edit Configurations->Script Parameters to define a file list using wildcards like:
"../examples/*.jpg"
Inside the code I'm iterating the file list using a for loop like
for f in sys.argv[1:]:
Although the script executes fine from terminal, IDEA throws a file not found exception:
No such file or directory: '../examples/*.jpg'
I suppose this makes sense (my theory) since there is no shell involved to expand the command line argument into a file list prior passing it to the script.
There is an answer in a similar question here: Pycharm and sys.argv arguments The relevant answer using wildcards is https://stackoverflow.com/a/41003295/7521854 but it is not working. (If I had enough rep I'd commented on this answer, sorry)
Any suggestion will make me happy!
PS: running OSX 10.11.6 (El Capitan)
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.
Li li
@Alix Claire Erie, I have installed visual studio code for MAC, and installed extensions support for Python, .Net core tools and C#, and installed .Net SDK. When I opened QuantConnect.Lean.sln file, click Debug - start without debuging, select envirement as .Net core, there was no any feedback. How can I run Lean in Visual Studio Code for MAC for Python?
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.
Alix Claire Erie
li li In the end I did not set up the local version of QC. Lean was a bigger project than I was able to join. I continued by using the online version of QuantConnect, in C#.
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.
Stephen Hyer
For anyone still struggling to get the Python GUI to work correctly, I was able to solve the problem after a few hours. Here's what I did:
1) Follow the config.json steps as shown in the tutorial.
2) Download Python 3.6.8. I also have 3.7 and anacondas, but to my best knowledge LEAN only works with 3.6 for now.
- Make sure you include the location in PATH, but also take the python.exe, pythonw.exe and python36.dll and copy them to your System32 folder.
- Unblock C:\Program Files (x86)\LEAN\Lean-master\UserInterface\QuantConnect.Views by right clicking the file and going to properties
3) In Visual Studios at the top go to Tools -> Python -> Python Environments (Ctrl+K).
- Set Python 3.6 as your default
- Open the Powershell window and run pip install for numpy, pandas, seaborn and any other libraries you need to import.
You should now be able to build and run the python basic template. This is as far as I've gotten personally. I know I need to download some data files for my other algorithms, but hopefully this saves others some time.
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.
Link Liang
Hi Shyer,
Thanks for sharing your experience! Just want to add:
1. Here is how you install a specific version of python with anaconda (i.e. 3.6.6):
conda install -y python=3.6.6
Currently we only support Python 3.6, so if you are using python 3.7 please make sure to downgrade to 3.6 or install python 3.6 separately.
2. For mac users, please read our instruction of running Lean with python algorithms.
Thanks for your support.
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.
Omid Rad
Setting up QuantConnect Lean for Python
Algorithm.Python/readme.md has instructions for running Python algorithms with QuantConnect locally. But if that didn't work for you, try the following (Windows only):
Note: As of May 2020 QuantConnect supports Python 3.6, and is not compatible with Python 3.7 or later.
Install Visual Studio Community Edition
Install Anaconda (it is a distribution of the Python and R programming languages for data science, and includes Jupiter Notebooks and many other packages)
From the Start menu run Anaconda Prompt
Create a new environment. You need to do this only once.
conda create -y --name QuantConnect python=3.6 anaconda
conda activate QuantConnect
Check the QuantConnect environment is activated
conda env list
Now every time you wanted to open QuantConnect project do this:
From start Menu open Anaconda Powershell Prompt (QuantConnect)
Set PYTHONHOME environment variable
$env:PYTHONHOME="$env:USERPROFILE\anaconda3\envs\QuantConnect"
Open QuantConnect solution in Visual Studio
cd C:\repos\Lean
start .\QuantConnect.Lean.sln
Modify Launcher\config.json to have the following settings:
"environment": "backtesting",
"algorithm-type-name": "BasicTemplateAlgorithm",
"algorithm-language": "Python",
"algorithm-location": "../../../Algorithm.Python/BasicTemplateAlgorithm.py",
Run the project with F5
The above should work, but I could not find how to persist the environment so we can run the solution file by double-clicking on it. Setting
PYTHONHOME
in user env vars did not work.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.
John Addae
I have followed all instructions and steps to implement LEAN in Python wth VS but keep facing many errors when building the project file in VS, Errors screenshot attached in below link:
https://drive.google.com/file/d/17a59ULDmdRuymL4r6EIx8WvJh3_0AS7U/view?usp=sharing
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.
Alexandre Catarino
Hi John Addae ,
I have answered your question in this thread:
Using Lean with Visual Studio 2017 and Anaconda3 #4174
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!