I am trying to run the LEAN report creator on a local Linux machine using the following command line instruction according to tutorial:
./QuantConnect.Report.exe --backtest-data-source-file sample.json --report-destination Example.html I have changed the permissions of the .exe to grant it execution priveleges, but am still receiving the following error: bash: ./QuantConnect.Report.exe: cannot execute binary file: Exec format error I believe this is because the architecture of the .exe is a 32 bit (i386) executable that cannot be executed in Linux. Is there any workaround to this for LEAN development on Linux?
Aaron Janeiro Stone
Have you tried ```mono QuantConnect.Report.exe --backtest-data-source-file sample.json --report-destination Example.html```
CAPOCAPITAL
Aaron - Thank you for the suggestion. I now see the report executable is attempting to parse files and I am now running into a possible path error. My terminal command produces the following output
$ sudo mono ./Lean/Report/bin/Debug/QuantConnect.Report.exe --backtest-data-source-file ./Lean/Results/BasicTemplateFrameworkAlgorithm.json --report-destination ./Lean/Results/Example.html
20210308 17:27:25.927 TRACE:: Config.Get(): Configuration key not found. Key: strategy-name - Using default value:
20210308 17:27:25.928 TRACE:: Config.Get(): Configuration key not found. Key: strategy-description - Using default value:
20210308 17:27:25.928 TRACE:: Config.Get(): Configuration key not found. Key: strategy-version - Using default value:
20210308 17:27:25.928 TRACE:: Config.Get(): Configuration key not found. Key: live-data-source-file - Using default value:
20210308 17:27:25.928 TRACE:: QuantConnect.Report.Main(): Parsing source files..../Lean/Results/BasicTemplateFrameworkAlgorithm.json,
20210308 17:27:26.016 TRACE:: Config.Get(): Configuration key not found. Key: map-file-provider - Using default value: LocalDiskMapFileProvider
20210308 17:27:26.094 TRACE:: QuantConnect.Report.Main(): Instantiating report...
20210308 17:27:26.121 TRACE:: QuantConnect.Report.Report(): Processing backtesting orders
20210308 17:27:26.141 TRACE:: Config.Get(): Configuration key not found. Key: plugin-directory - Using default value:
20210308 17:27:26.142 TRACE:: Config.Get(): Configuration key not found. Key: composer-dll-directory - Using default value: /home/xdelta/Lean/Report/bin/Debug/
20210308 17:27:26.200 TRACE:: Config.Get(): Configuration key not found. Key: map-file-provider - Using default value: LocalDiskMapFileProvider
20210308 17:27:26.351 TRACE:: Config.Get(): Configuration key not found. Key: data-directory - Using default value: ../../../Data/
20210308 17:27:26.352 TRACE:: Config.Get(): Configuration key not found. Key: version-id - Using default value:
20210308 17:27:26.352 TRACE:: Config.Get(): Configuration key not found. Key: cache-location - Using default value: ../../../Data/
Unhandled Exception:
System.IO.DirectoryNotFoundException: Could not find a part of the path "/Data/market-hours/market-hours-database.json".
 at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x00164] in <5dfd69ae4e3b402db546d8ded6fc755e>:0
 at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options) [0x00000] in <5dfd69ae4e3b402db546d8ded6fc755e>:0
 at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions)
 at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks, System.Int32 bufferSize) [0x00055] in <5dfd69ae4e3b402db546d8ded6fc755e>:0
 at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks) [0x00000] in <5dfd69ae4e3b402db546d8ded6fc755e>:0
 at (wrapper remoting-invoke-with-check) System.IO.StreamReader..ctor(string,System.Text.Encoding,bool)
 at System.IO.File.InternalReadAllText (System.String path, System.Text.Encoding encoding) [0x00000] in <5dfd69ae4e3b402db546d8ded6fc755e>:0
 at System.IO.File.ReadAllText (System.String path) [0x0002c] in <5dfd69ae4e3b402db546d8ded6fc755e>:0
 at QuantConnect.Securities.MarketHoursDatabase.FromFile (System.String path) [0x00001] in <ad85237c90ef4eaf95265a819e4acb5f>:0
 at QuantConnect.Securities.MarketHoursDatabase.FromDataFolder (System.String dataFolder) [0x00031] in <ad85237c90ef4eaf95265a819e4acb5f>:0
 at QuantConnect.Securities.MarketHoursDatabase.FromDataFolder () [0x00006] in <ad85237c90ef4eaf95265a819e4acb5f>:0
 at QuantConnect.Algorithm.QCAlgorithm..ctor () [0x001e1] in <48a685522b19402baf089b329e59ae8f>:0
 at QuantConnect.Report.PortfolioLooperAlgorithm..ctor (System.Decimal startingCash, System.Collections.Generic.IEnumerable`1[T] orders) [0x00000] in <3945e85771fb4d0ca8ced73c64a5491e>:0
 at (wrapper remoting-invoke-with-check) QuantConnect.Report.PortfolioLooperAlgorithm..ctor(System.Decimal,System.Collections.Generic.IEnumerable`1<QuantConnect.Orders.Order>)
 at QuantConnect.Report.PortfolioLooper..ctor (System.Double startingCash, System.Collections.Generic.List`1[T] orders, QuantConnect.Resolution resolution) [0x00097] in <3945e85771fb4d0ca8ced73c64a5491e>:0
 at QuantConnect.Report.PortfolioLooper+<FromOrders>d__14.MoveNext () [0x0028f] in <3945e85771fb4d0ca8ced73c64a5491e>:0
 at System.Collections.Generic.List`1[T].AddEnumerable (System.Collections.Generic.IEnumerable`1[T] enumerable) [0x00059] in <5dfd69ae4e3b402db546d8ded6fc755e>:0
 at System.Collections.Generic.List`1[T]..ctor (System.Collections.Generic.IEnumerable`1[T] collection) [0x00062] in <5dfd69ae4e3b402db546d8ded6fc755e>:0
 at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00018] in <d9f4d70345484e55bbf6c1ef353f07c4>:0
 at QuantConnect.Report.Report..ctor (System.String name, System.String description, System.String version, QuantConnect.Packets.BacktestResult backtest, QuantConnect.Packets.LiveResult live, System.String pointInTimePortfolioDestination) [0x00088] in <3945e85771fb4d0ca8ced73c64a5491e>:0
 at QuantConnect.Report.Program.Main (System.String[] args) [0x0012c] in <3945e85771fb4d0ca8ced73c64a5491e>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.DirectoryNotFoundException: Could not find a part of the path "/Data/market-hours/market-hours-database.json".
 at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x00164] in <5dfd69ae4e3b402db546d8ded6fc755e>:0
 at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options) [0x00000] in <5dfd69ae4e3b402db546d8ded6fc755e>:0
 at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions)
 at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks, System.Int32 bufferSize) [0x00055] in <5dfd69ae4e3b402db546d8ded6fc755e>:0
 at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks) [0x00000] in <5dfd69ae4e3b402db546d8ded6fc755e>:0
 at (wrapper remoting-invoke-with-check) System.IO.StreamReader..ctor(string,System.Text.Encoding,bool)
 at System.IO.File.InternalReadAllText (System.String path, System.Text.Encoding encoding) [0x00000] in <5dfd69ae4e3b402db546d8ded6fc755e>:0
 at System.IO.File.ReadAllText (System.String path) [0x0002c] in <5dfd69ae4e3b402db546d8ded6fc755e>:0
 at QuantConnect.Securities.MarketHoursDatabase.FromFile (System.String path) [0x00001] in <ad85237c90ef4eaf95265a819e4acb5f>:0
 at QuantConnect.Securities.MarketHoursDatabase.FromDataFolder (System.String dataFolder) [0x00031] in <ad85237c90ef4eaf95265a819e4acb5f>:0
 at QuantConnect.Securities.MarketHoursDatabase.FromDataFolder () [0x00006] in <ad85237c90ef4eaf95265a819e4acb5f>:0
 at QuantConnect.Algorithm.QCAlgorithm..ctor () [0x001e1] in <48a685522b19402baf089b329e59ae8f>:0
 at QuantConnect.Report.PortfolioLooperAlgorithm..ctor (System.Decimal startingCash, System.Collections.Generic.IEnumerable`1[T] orders) [0x00000] in <3945e85771fb4d0ca8ced73c64a5491e>:0
 at (wrapper remoting-invoke-with-check) QuantConnect.Report.PortfolioLooperAlgorithm..ctor(System.Decimal,System.Collections.Generic.IEnumerable`1<QuantConnect.Orders.Order>)
 at QuantConnect.Report.PortfolioLooper..ctor (System.Double startingCash, System.Collections.Generic.List`1[T] orders, QuantConnect.Resolution resolution) [0x00097] in <3945e85771fb4d0ca8ced73c64a5491e>:0
 at QuantConnect.Report.PortfolioLooper+<FromOrders>d__14.MoveNext () [0x0028f] in <3945e85771fb4d0ca8ced73c64a5491e>:0
 at System.Collections.Generic.List`1[T].AddEnumerable (System.Collections.Generic.IEnumerable`1[T] enumerable) [0x00059] in <5dfd69ae4e3b402db546d8ded6fc755e>:0
 at System.Collections.Generic.List`1[T]..ctor (System.Collections.Generic.IEnumerable`1[T] collection) [0x00062] in <5dfd69ae4e3b402db546d8ded6fc755e>:0
 at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00018] in <d9f4d70345484e55bbf6c1ef353f07c4>:0
 at QuantConnect.Report.Report..ctor (System.String name, System.String description, System.String version, QuantConnect.Packets.BacktestResult backtest, QuantConnect.Packets.LiveResult live, System.String pointInTimePortfolioDestination) [0x00088] in <3945e85771fb4d0ca8ced73c64a5491e>:0
 at QuantConnect.Report.Program.Main (System.String[] args) [0x0012c] in <3945e85771fb4d0ca8ced73c64a5491e>:0
Â
CAPOCAPITAL
The path /Data/market-hours/market-hours-database.json looks fine and I did confirm the file is in the correct place.
Jasper van Merle
Hi CAPOCAPITAL, please try running the report creator from the ./Report/bin/Debug directory with mono QuantConnect.Report.exe --backtest-data-source-file ../../../Results/BasicTemplateFrameworkAlgorithm.json --report-destination ../../../Results/Example.html.
CAPOCAPITAL
Thank you Jasper - I am one step closer. After running the command from within the Debug directory I receive a System.DLL.Notfoundexception
$ mono QuantConnect.Report.exe --backtest-data-source-file ../../../Results/BasicTemplateFrameworkAlgorithm.json --report-destination ../../../Results/Example.html
20210309 01:55:19.855 TRACE:: Config.Get(): Configuration key not found. Key: strategy-name - Using default value:
20210309 01:55:19.857 TRACE:: Config.Get(): Configuration key not found. Key: strategy-description - Using default value:
20210309 01:55:19.857 TRACE:: Config.Get(): Configuration key not found. Key: strategy-version - Using default value:
20210309 01:55:19.857 TRACE:: Config.Get(): Configuration key not found. Key: live-data-source-file - Using default value:
20210309 01:55:19.857 TRACE:: QuantConnect.Report.Main(): Parsing source files...../../../Results/BasicTemplateFrameworkAlgorithm.json,
20210309 01:55:19.950 TRACE:: Config.Get(): Configuration key not found. Key: map-file-provider - Using default value: LocalDiskMapFileProvider
20210309 01:55:20.029 TRACE:: QuantConnect.Report.Main(): Instantiating report...
20210309 01:55:20.055 TRACE:: QuantConnect.Report.Report(): Processing backtesting orders
20210309 01:55:20.075 TRACE:: Config.Get(): Configuration key not found. Key: plugin-directory - Using default value:
20210309 01:55:20.076 TRACE:: Config.Get(): Configuration key not found. Key: composer-dll-directory - Using default value: /home/xdelta/Lean/Report/bin/Debug/
20210309 01:55:20.129 TRACE:: Config.Get(): Configuration key not found. Key: map-file-provider - Using default value: LocalDiskMapFileProvider
20210309 01:55:20.281 TRACE:: Config.Get(): Configuration key not found. Key: data-directory - Using default value: ../../../Data/
20210309 01:55:20.286 TRACE:: Config.Get(): Configuration key not found. Key: version-id - Using default value:
20210309 01:55:20.286 TRACE:: Config.Get(): Configuration key not found. Key: cache-location - Using default value: ../../../Data/
20210309 01:55:20.560 TRACE:: Config.GetValue(): scheduled-event-leaky-bucket-capacity - Using default value: 120
20210309 01:55:20.560 TRACE:: Config.GetValue(): scheduled-event-leaky-bucket-time-interval-minutes - Using default value: 1440
20210309 01:55:20.560 TRACE:: Config.GetValue(): scheduled-event-leaky-bucket-refill-amount - Using default value: 18
20210309 01:55:20.576 TRACE:: Config.Get(): Configuration key not found. Key: results-destination-folder - Using default value: /home/xdelta/Lean/Report/bin/Debug
20210309 01:55:20.793 TRACE:: DataManager.AddSubscription(): Unable to add subscription for: QC-UNIVERSE-USERDEFINED-USA-EQUITY,QC-UNIVERSE-USERDEFINED-USA-EQUITY,Daily,TradeBar,Trade,Adjusted,Internal
20210309 01:55:20.795 TRACE:: Config.GetValue(): regression-update-statistics - Using default value: False
20210309 01:55:20.805 TRACE:: BacktestingResultHandler(): Sample Period Set: 04.00
20210309 01:55:20.808 TRACE:: Time.TradeableDates(): Security Count: 1
20210309 01:55:20.811 TRACE:: Config.GetValue(): forward-console-messages - Using default value: True
20210309 01:55:20.848 TRACE:: BacktestingResultHandler.Exit(): starting...
20210309 01:55:20.868 TRACE:: BacktestingResultHandler.Exit(): Saving logs...
20210309 01:55:20.915 TRACE:: StopSafely(): waiting for 'Result Thread' thread to stop...
20210309 01:55:20.994 TRACE:: Debug: Your log was successfully created and can be retrieved from: /home/xdelta/Lean/Report/bin/Debug/dab45a5e3dc14d188cda69a7fb38b7a8-log.txt
20210309 01:55:20.994 TRACE:: BacktestingResultHandler.Run(): Ending Thread...
20210309 01:55:21.106 TRACE::
STATISTICS:: OrderListHash d41d8cd98f00b204e9800998ecf8427e
20210309 01:55:21.106 TRACE:: BacktestingResultHandler.SendAnalysisResult(): Processed final packet
20210309 01:55:21.108 TRACE:: QuantConnect.Report.Report(): Processing live orders
20210309 01:55:21.118 TRACE:: Report.Report(): Writing backtest point-in-time portfolios to JSON file: ../../../Results/Example.-backtesting-portfolio.json
20210309 01:55:21.138 TRACE:: PythonInitializer.Initialize(): start...
PythonEngine.Initialize(): Runtime.Initialize()...
Unhandled Exception:
System.DllNotFoundException: python3.6m assembly:<unknown assembly> type:<unknown type> member:(null)
 at (wrapper managed-to-native) Python.Runtime.Runtime.Py_IsInitialized()
 at Python.Runtime.Runtime.Initialize () [0x00000] in <c56ab175820d412caf052e079c2ab9ef>:0
 at Python.Runtime.PythonEngine.Initialize (System.Collections.Generic.IEnumerable`1[T] args, System.Boolean setSysArgv) [0x0001e] in <c56ab175820d412caf052e079c2ab9ef>:0
 at Python.Runtime.PythonEngine.Initialize (System.Boolean setSysArgv) [0x00005] in <c56ab175820d412caf052e079c2ab9ef>:0
 at Python.Runtime.PythonEngine.Initialize () [0x00000] in <c56ab175820d412caf052e079c2ab9ef>:0
 at QuantConnect.Python.PythonInitializer.Initialize () [0x0001a] in <ad85237c90ef4eaf95265a819e4acb5f>:0
 at QuantConnect.Report.ReportElements.ChartReportElement..ctor () [0x00008] in <3945e85771fb4d0ca8ced73c64a5491e>:0
 at QuantConnect.Report.ReportElements.MonthlyReturnsReportElement..ctor (System.String name, System.String key, QuantConnect.Packets.BacktestResult backtest, QuantConnect.Packets.LiveResult live) [0x00000] in <3945e85771fb4d0ca8ced73c64a5491e>:0
 at QuantConnect.Report.Report..ctor (System.String name, System.String description, System.String version, QuantConnect.Packets.BacktestResult backtest, QuantConnect.Packets.LiveResult live, System.String pointInTimePortfolioDestination) [0x0044a] in <3945e85771fb4d0ca8ced73c64a5491e>:0
 at QuantConnect.Report.Program.Main (System.String[] args) [0x0012c] in <3945e85771fb4d0ca8ced73c64a5491e>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: python3.6m assembly:<unknown assembly> type:<unknown type> member:(null)
 at (wrapper managed-to-native) Python.Runtime.Runtime.Py_IsInitialized()
 at Python.Runtime.Runtime.Initialize () [0x00000] in <c56ab175820d412caf052e079c2ab9ef>:0
 at Python.Runtime.PythonEngine.Initialize (System.Collections.Generic.IEnumerable`1[T] args, System.Boolean setSysArgv) [0x0001e] in <c56ab175820d412caf052e079c2ab9ef>:0
 at Python.Runtime.PythonEngine.Initialize (System.Boolean setSysArgv) [0x00005] in <c56ab175820d412caf052e079c2ab9ef>:0
 at Python.Runtime.PythonEngine.Initialize () [0x00000] in <c56ab175820d412caf052e079c2ab9ef>:0
 at QuantConnect.Python.PythonInitializer.Initialize () [0x0001a] in <ad85237c90ef4eaf95265a819e4acb5f>:0
 at QuantConnect.Report.ReportElements.ChartReportElement..ctor () [0x00008] in <3945e85771fb4d0ca8ced73c64a5491e>:0
 at QuantConnect.Report.ReportElements.MonthlyReturnsReportElement..ctor (System.String name, System.String key, QuantConnect.Packets.BacktestResult backtest, QuantConnect.Packets.LiveResult live) [0x00000] in <3945e85771fb4d0ca8ced73c64a5491e>:0
 at QuantConnect.Report.Report..ctor (System.String name, System.String description, System.String version, QuantConnect.Packets.BacktestResult backtest, QuantConnect.Packets.LiveResult live, System.String pointInTimePortfolioDestination) [0x0044a] in <3945e85771fb4d0ca8ced73c64a5491e>:0
 at QuantConnect.Report.Program.Main (System.String[] args) [0x0012c] in <3945e85771fb4d0ca8ced73c64a5491e>:0
Â
Jasper van Merle
The report creator requires Python to be set up within LEAN. See Algorithm.Python's readme.md file, it contains the following steps to fix that error:
- Find libpython3.6m.so in your Python installation folder. If you installed Python with Miniconda, it may be found at:
For the report creator you'll also need to install matplotlib using pip install matplotlib in the Python environment you set up in Python.Runtime.dll.config./home/{your_user_name}/miniconda3/envs/{qc_environment}/lib/libpython3.6m.so
Note that you can create a new virtual environment with all required dependencies by executing:
Â
conda create -n qc_environment python=3.6.8 cython=0.29.11 pandas=0.25.3 wrapt=1.11.2
Â
Open Lean/Common/Python/Python.Runtime.dll.config, add the following text under <configuration> ... </configuration> and save:
Â
<dllmap dll="python3.6m" target="{the path in step 1 including libpython3.6m.so}" os="linux"/>
Â
CAPOCAPITAL
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!