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
LukeI
I couldn't get python working on desktop lean either, It wouldn't recognize that I had python2.7 installedbut I followed all the directions I could find. I wonder if they could do a quick video showing how to start from scratch and run a python backtest on desktop lean like the video they have for 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.
Jared Broad
Can you please paste the an error message? From the screen shots I am guessing its because you have installed anaconda-python; I think it needs plain 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.
Alexandre Catarino
Could you please give us more details?
What is the runtime error message?
made a related question today:
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.
LukeI
I think I found my problem, I haven't figured out how to fix it yet, although I'm close. I keep getting this message:
I figured out that I didn't follow the python readme.md as close as I thought. First I created a system path variable to my python 2.7 install location because I had forgotten to do that. Then I read this instruction closer:
Rename Leanpacka≥sQuantCo∩ect.pytho∩et.versionbuildPython.Runtime.w∈ to Leanpacka≥sQuantCo∩ect.pytho∩et.versionlibPython.Runtime.dll. I didn't realise that by rename it also meant that I had to move it to the lib folder. Then I made sure that python was working in visual studio by reading some stuff here and making python 2.7 the default python environment. I tested the python interactive prompt in visual studio to confirm that it worked.
THEN I redownloaded and used a fresh version of lean. Still got the error.
Now I did a little more digging into what I think is the true cause:
Unable to find an entry point named 'PyUnicodeUCS4_FromUnicode' in DLL 'python27'.
I just checked and my python is UCS-2. I just installed it from the python website so I had no idea that I had to specify for it to install encoded a certain way. But I'm going to try and resintall python 2.7with --enable-unicode=ucs4 somewhow and see if that works. I will report back later.
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.
LukeI
Hmm nope, can't get it
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
and the windows dll is needed for it. Alex will reply in a few hours when
he's awake =)
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.
LukeI
OK so I got it working. I uninstalled everything, including visual studio and python and reinstalled it. I also made SURE to copy over the .dll to the right spot and deleted the DLL that was there initially. Part of the reason I think it was giving me problems was because I am on 64bit windows and I had installed multiple versions of python installed, for both 64bit and 32bit. This time I let Visual basic install python 2.7 64 bit during the installation instead of doing it myself. It installed it to a folder at C:\Python27amd64. I had to point the path in my system to C:\Python27amd64, not C:\Python27 like the readme says (which is the 32bit version by default).
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.
Chris Alteras
Hi ,
thanks you everybody for your help.
logs and screenshot : https://groups.google.com/forum/#!topic/lean-engine/mQeSrNsZ6
My install: python integration option checked during VS2017 community installation.
I didn't install python 2.7 in first intention because ananconda was already install and managing packages is very easy (pandas and dependencies in one click!)
PS: I have also an another problem with environment": "backtesting-desktop" that I have fixed.
https://groups.google.com/forum/#!topic/lean-engine/vnE-tXRMKo0
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.
Chris Alteras
I haven't tested my python2.7 anaconda environnement VS integration (https://docs.microsoft.com/en-us/visualstudio/python/python-environments)... It could be the problem
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
I am glad you made it.
Like Jared said, that runtime error tells us that you were using the wrong dll (unfortunatelly we need a dll for each OS).
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
Chris Alteras a user in the slack channel manage to get it working with Anacondas:
But i've managed to work around it by installing pythonnet : * brew install pkg-config * brew install glib --universal * brew install mono * export PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/pkgconfig * cd /Users/sl624/anaconda/lib * ln -s /Library/Frameworks/Mono.framework/Versions/Current/lib/mono * export DYLD_LIBRARY_PATH=/Library/Frameworks/Mono.framework/Versions/Current/lib * USE_OSX_FRAMEWORKS=0 ARCHFLAGS="-arch x86_64" pip install git+https://github.com/pythonnet/pythonnet
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.
Chris Alteras
Jared: slack channel infos are for linux user (mono install and linux command like ln -s ...)
finally I did it.
My steps:
- install python x64
(don't forget path add option )
- open console (cmd) and install panda: py -2.7 -m pip install pandas
- download lean from github
- open with VS2017 , select solution, click right and select restore nuget package
- open python environment and select Python2.7 x64 (maybe not mandatory)
- follow github instruction carefully( rename .win to .dll and paste in lib folder , etc...)
- run ...
- If you want GUI: * click solution, properties, project dependencies and click on Quanconnect.Views
* in config.json : "environment": "backtesting-desktop"
* AND replace in config.json ..../Debug/QuantConnect.Views.exe by .../Release/QuantConnect.Views.exe
you should have:
"desktop-http-port": "1234",
"desktop-exe": "../../../UserInterface/bin/Release/QuantConnect.Views.exe"
- don't forget user id ( see quantconnect , MyAccount)
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.
Lucas
Hi Guys, After reading all above I still cant get it. Could anyone provide some info on what I am doing wrong here? The following text is coming up red when i run the lean launcher
20170904 13:11:35 Error:: Loader.TryCreatePythonAlgorithm(): System.DllNotFoundException: Unable to load DLL 'python27': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at Python.Runtime.Runtime.Py_IsInitialized()
at Python.Runtime.Runtime.Initialize()
at Python.Runtime.PythonEngine.Initialize(IEnumerable`1 args, Boolean setSysArgv)
at Python.Runtime.PythonEngine.Initialize()
at QuantConnect.AlgorithmFactory.Loader.TryCreatePythonAlgorithm(String assemblyPath, IAlgorithm& algorithmInstance, String& errorMessage) in C:\QC_lean\Lean-master\AlgorithmFactory\Loader.cs:line 164
20170904 13:11:36 Error:: Engine.Run(): System.Exception: Loader.TryCreatePythonAlgorithm(): Unable to import python module ../../../Algorithm.Python/BasicTemplateAlgorithm.py. Unable to load DLL 'python27': The specified module could not be found. (Exception from HRESULT: 0x8007007E): try re-building algorithm.
at QuantConnect.Lean.Engine.Setup.ConsoleSetupHandler.CreateAlgorithmInstance(AlgorithmNodePacket algorithmNodePacket, String assemblyPath) in C:\QC_lean\Lean-master\Engine\Setup\ConsoleSetupHandler.cs:line 94
at QuantConnect.Lean.Engine.Engine.Run(AlgorithmNodePacket job, AlgorithmManager manager, String assemblyPath) in C:\QC_lean\Lean-master\Engine\Engine.cs:line 111
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.
Chris Alteras
Lucas: check in c:\python27 if you have python27.dll
If not try to copy C:\Windows\System32\ python27.dll (or C:\Windows\SysWOW64) into c:\python27
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.
Lucas
Chris you are a champion. That fixed that problem, cheers!
Now I am up to the error (this pops up in the gui, but there is red in the cmd too)
2017-09-05T07:27:12.1211034Z Error Algorithm.Initialize() Error: Loader.TryCreatePythonAlgorithm(): Unable to import python module ../../../Algorithm.Python/BasicTemplateAlgorithm.py. An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B): try re-building algorithm. Stack Trace: at QuantConnect.Lean.Engine.Setup.ConsoleSetupHandler.CreateAlgorithmInstance(AlgorithmNodePacket algorithmNodePacket, String assemblyPath) in C:\QC_lean\Lean-master\Engine\Setup\ConsoleSetupHandler.cs:line 94
at QuantConnect.Lean.Engine.Engine.Run(AlgorithmNodePacket job, AlgorithmManager manager, String assemblyPath) in C:\QC_lean\Lean-master\Engine\Engine.cs:line 111
at QuantConnect.Lean.Engine.Setup.ConsoleSetupHandler.CreateAlgorithmInstance(AlgorithmNodePacket algorithmNodePacket, String assemblyPath) in C:\QC_lean\Lean-master\Engine\Setup\ConsoleSetupHandler.cs:line 94
at QuantConnect.Lean.Engine.Engine.Run(AlgorithmNodePacket job, AlgorithmManager manager, String assemblyPath) in C:\QC_lean\Lean-master\Engine\Engine.cs:line 111
The first few lines in my config.json looks like:
"environment": "backtesting-desktop",// "live-paper", "backtesting", "live-interactive", "live-interactive-iqfeed"
// algorithm class selector
"algorithm-type-name": "BasicTemplateAlgorithm",
// Algorithm language selector - options CSharp, FSharp, VisualBasic, Python, Java
//"algorithm-language": "CSharp",
"algorithm-language": "Python",
//Physical DLL location
//"algorithm-location": "QuantConnect.Algorithm.CSharp.dll",
"algorithm-location": "../../../Algorithm.Python/BasicTemplateAlgorithm.py",
//"algorithm-location": "QuantConnect.Algorithm.FSharp.dll",
//"algorithm-location": "QuantConnect.Algorithm.VisualBasic.dll",
//"algorithm-location": "QuantConnect.Algorithm.Java.dll",
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.
Chris Alteras
sorry lucas, i was quite busy these day.
step1:check project depencies: select solution level, click right, select properties
check if Views is included
step2: correct Debug with Release in config.json (read carefully my previous post)
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.
Lucas
Hi Chris, Thanks for getting back to me.
I started on a fresh pc. Running win 10 with MSVS 2017 community and python x64 2.7 that comes preinstalled with visual studio. I am still failing dismally.
The error is the same as the original post: Unable to import python module ../../../Algorithm.Python/BasicTemplateAlgorithm.py. Unable to find an entry point named 'PyUnicodeUCS4_FromUnicode' in DLL 'python27'.
Attached is a screenshot of my path location
You mentioned python.dll in syswow or system32. I have one python.dll in each (not sure if that even matters, I have tried C:\Python27amd64\python.dll (with both and with none, I still get the same error)
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
Lucas that error probably means you've copied the wrong DLL in place. UCS2 is the mac/linux version of the DLL -- UCS4 is the window one which it needs too work. I guess you didn't *precisely* copy the file: (note the paths)
Rename Lean\packages\QuantConnect.pythonnet._version_\build\Python.Runtime.win to Lean\packages\QuantConnect.pythonnet._version_\lib\Python.Runtime.dll
The version is 1.0.4.4 at the moment:
del Lean\packages\QuantConnect.pythonnet.1.0.4.4\lib\Python.Runtime.dll copy Lean\packages\QuantConnect.pythonnet.1.0.4.4\build\Python.Runtime.win Lean\packages\QuantConnect.pythonnet.1.0.4.4\lib\Python.Runtime.dll
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.
Lucas
I am pretty sure I have done that part correctly (I have read the instructions and attempted about 10 installs now).
Maybe I am not installing python properly?
.
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
Sorry Lucas Alex tells me he can't get it going on Windows either (fine on Mac/Linux). We'll figure it out it today and update the install readme.
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
1. Install Visual Studio Community: (if you don't have it already).
1.1 Visual Studio 2017 Community edition which can be downloaded free from: https://www.visualstudio.com. Visual Studio comes with Python (if you install Python Tools for Visual Studio) but it doesn't seem to add Python to the system path. We'll need to reinstall python manually. If you already have VS installed you should be able to skip this step.
2. Install Python:
2.1 Use the Windows x86-64 MSI installer from https://www.python.org/downloads/release/python-2713/
2.2 When asked to select the features to be installed, make sure you select "Add python.exe to Path"
2.3 Once installed confirm the python27.dll is in place in C:\Windows\System32.
2.4 Add python27.dll to the system path
2.4.1 Right mouse button on My Computer. Click Properties.
2.4.2 Click Advanced System Settings -> Environment Variables -> System Variables
2.4.3 On the "Path" section click New and enter the python27.dll path, in our example this was "C:\Windows\System32"
2.5 Install pandas and its dependencies.
3. Setup LEAN:
3.1 Download LEAN github clone, or downloading the zip. If downloading the zip - unzip to a local pathway.
3.2 Prepare Python.Runtime DLL. This is needed to run LEAN with Python.
3.2.1 Delete the existing files in \Lean\packages\QuantConnect.pythonnet.1.0.4.4\lib
3.2.2 Using windows you'll need to copy the\Lean\packages\QuantConnect.pythonnet.1.0.4.4\build\*Python.Runtime.win* file into the ..\lib\ directory with the name: Python.Runtime.dll
4 Run LEAN:
4.1 Run with a basic C# algorithm first to make sure it works (using the default credentials, just press F5).
4.1.1 You should see this exit successfully with a list of the algorithm statistics and 1 trade.
4.2 Update the config to run the python algorithm:
"algorithm-type-name": "BasicTemplateAlgorithm",
"algorithm-language": "Python",
"algorithm-location": "../../../Algorithm.Python/BasicTemplateAlgorithm.py",
4.2.1 You should see the same result of 4.1.1.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Chris Alteras
There are steps that i follow Lucas. So it should work. I hope for you.
Test first backtesting in console mode. after that reread my post for gui backtesting.
Maybe Alexandre can explain us a better way than fixing path in config.json (ie how to compile the missing debug version of QuantConnectView.exe).
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
We need to change the solution "Property Pages":
Right click the solution in the Solution explorer, then select Properties.
Change Release for Debug and click the Ok button.
Rebuild the solution and run.
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.
Lucas
Great thank you guys, I got it running
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.
Atish Sawant
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.
Robert Putnam
Hi,
Another Quantopian refugee here... I have limited experience with VS and building on Windows, so please be gentle :). I've been following the instructions in this thread and elsewhere, but am unable to get past the 'Unable to load DLL python2.7' problem (details below). Note that I did not touch the windows system PATH environment variable, because c:\windows\system32 was already listed there. I also tried copying python27.dll from c:\windows\system32 into c:\python27, but this did not fix the problem. Thanks.
Robert
Backtrace:
20170920 09:11:30 Trace:: JOB HANDLERS:
20170920 09:11:30 Trace:: DataFeed: QuantConnect.Lean.Engine.DataFeeds.FileSystemDataFeed
20170920 09:11:30 Trace:: Setup: QuantConnect.Lean.Engine.Setup.ConsoleSetupHandler
20170920 09:11:30 Trace:: RealTime: QuantConnect.Lean.Engine.RealTime.BacktestingRealTimeHandler
20170920 09:11:30 Trace:: Results: QuantConnect.Lean.Engine.Results.BacktestingResultHandler
20170920 09:11:30 Trace:: Transactions: QuantConnect.Lean.Engine.TransactionHandlers.BacktestingTransactionHandler
20170920 09:11:30 Trace:: Config.GetValue(): send-via-api - Using default value: False
20170920 09:11:30 ERROR:: Algorithm.Initialize() Error: Loader.TryCreatePythonAlgorithm(): Unable to import python module ../../../Algorithm.Python/BasicTemplateAlgorithm.py. Unable to load DLL 'python2.7': The specified module could not be found. (Exception from HRESULT: 0x8007007E): try re-building algorithm. Stack Trace: at QuantConnect.Lean.Engine.Setup.ConsoleSetupHandler.CreateAlgorithmInstance(AlgorithmNodePacket algorithmNodePacket, String assemblyPath) in C:\Lean-master\Engine\Setup\ConsoleSetupHandler.cs:line 94
at QuantConnect.Lean.Engine.Engine.Run(AlgorithmNodePacket job, AlgorithmManager manager, String assemblyPath) in C:\Lean-master\Engine\Engine.cs:line 111
at QuantConnect.Lean.Engine.Setup.ConsoleSetupHandler.CreateAlgorithmInstance(AlgorithmNodePacket algorithmNodePacket, String assemblyPath) in C:\Lean-master\Engine\Setup\ConsoleSetupHandler.cs:line 94
at QuantConnect.Lean.Engine.Engine.Run(AlgorithmNodePacket job, AlgorithmManager manager, String assemblyPath) in C:\Lean-master\Engine\Engine.cs:line 111
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.
Atish Sawant
I had this same problem. I managed to fix it by looking at what environment my actual VS was in. I found out that even though my path was python 2.7, my VS was running Python 3.5 which was causing the problem. By setting the development environment in VS to 2.7 it fixed the problems.
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.
Robert Putnam
Thanks, Atish. Interesting, it looks like my VS Community 2017 edition doesn't include Python. Is that others' observation?
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.
Atish Sawant
Go Tools-->Python-->Python Environment. That was where I found my issue. I also inlucded the python install when I installed VS Community 2017, so not sure what happens if you don't select that option.
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.
Robert Putnam
Okay, looks like there's possibility of adding it after the fact. Trying now...
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.
Robert Putnam
I did Tools-->Choose Toolbox Items... and was able to install Python 2.7 (64-bit), which is now listed as my default environment under Tools-->Python-->Python Environments. Unfortunately, I continue to have the same error (unable to find DLL python2.7).
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.
Atish Sawant
Click on configure environment to make sure that it is pointing to the correct files. I would do a quick google search to look into how to configure python environments in VS, because that is literally what I did to get it to work, so I only sorta knew what I was doing.
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.
Robert Putnam
Okay, 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.
Oscar Rojas Casanova
Noob question, what does "Prepare Python.Runtime DLL. This is needed to run LEAN with Python." means?
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
"Prepare Python.Runtime DLL. This is needed to run LEAN with Python." is the subsection.
It means you have to follow the instructions below. :-)
- Delete the existing files in \Lean\packages\QuantConnect.pythonnet.1.0.4.4\lib
- Using windows you'll need to copy the\Lean\packages\QuantConnect.pythonnet.1.0.4.4\build\*Python.Runtime.win* file into the ..\lib\ directory with the name: Python.Runtime.dll
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.
Jacky ng
any managed to get it to work? i read and tested all the different one yet still get the same error.
2017-11-16T07:23:15.5399263Z Error Algorithm.Initialize() Error: Loader.TryCreatePythonAlgorithm(): Unable to import python module ../../../Algorithm.Python/BasicTemplateAlgorithm.py. Unable to load DLL 'python2.7': The specified module could not be found. (Exception from HRESULT: 0x8007007E): try re-building algorithm. Stack Trace: at QuantConnect.Lean.Engine.Setup.ConsoleSetupHandler.CreateAlgorithmInstance(AlgorithmNodePacket algorithmNodePacket, String assemblyPath) in C:\Lean-master\Engine\Setup\ConsoleSetupHandler.cs:line 94
at QuantConnect.Lean.Engine.Engine.Run(AlgorithmNodePacket job, AlgorithmManager manager, String assemblyPath) in C:\Lean-master\Engine\Engine.cs:line 111
at QuantConnect.Lean.Engine.Setup.ConsoleSetupHandler.CreateAlgorithmInstance(AlgorithmNodePacket algorithmNodePacket, String assemblyPath) in C:\Lean-master\Engine\Setup\ConsoleSetupHandler.cs:line 94
at QuantConnect.Lean.Engine.Engine.Run(AlgorithmNodePacket job, AlgorithmManager manager, String assemblyPath) in C:\Lean-master\Engine\Engine.cs:line 111
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
Generally speaking please post LEAN / open source issues which we can't debug through QuantConnect.com to the open source group -- 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.
Trisith Keeratireungwattana
Incase of error UCS4
When Run LEAN at the first time,
Need to update QuantConnect.pythonnet (Nuget package) from 1.0.4.4 => 1.0.5.1
Instruction
1. Rebuild Solution (CSharp)
2. Tools -> Nuget package manager -> Manage Nuget package for Solution -> (Wait few minutes for checking update) -> Updates -> Check QunatConnect.pythonnet 1.0.5.1 -> Update
3. Then try to run BasicTemplateAlgorithm.py (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.
Trisith Keeratireungwattana
- Unable to load DLL 'python2.7':
Problem come from Python.Runtime.dll and Win x64
Solution:
Load pythonnet from the following URL and select environment DebugWin x64 or ReleaseWin x64 to build solution
Remanrk:
Default environment, DebugMono is not working for Win x64
then Copy Python.Runtime.dll => C:\Lean\Lean-2.4.0.1\packages\QuantConnect.pythonnet.1.0.5.1\lib
Testing:
testing via run cmd C:\pythonnet-master\src\console\bin\nPython.exe, if you got python command prompt it's working.
So, right now, Ready to run Lean with 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.
Trisith Keeratireungwattana
- Unable to load DLL 'python2.7':
Problem come from Python.Runtime.dll and Win x64
Solution:
1. Load pythonnet from the following URL and rebuild with following configuration
select
- "solution configuration" either => DebugWin or ReleaseWin
- "solution platform" => x64
then
2. Build -> Rebuild Solution
Remanrk:
Default solution configuration, DebugMono is not working for Win x64
3.CopyPython.Runtime.dll => C:\Lean\Lean-2.4.0.1\packages\QuantConnect.pythonnet.1.0.5.1\lib
Testing:
1. run cmd C:\pythonnet-master\src\console\bin\nPython.exe, if you got python command prompt that's mean it's work good.
So, right now, Ready to run Lean with Python.
sorry for duplicate post.
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!