I can successfully run backtest on my local machine but "lean optimize" fails with the following error.
20220402 19:23:52.656 TRACE:: Config.GetValue(): debug-mode - Using default value: False
20220402 19:23:52.660 TRACE:: Config.Get(): Configuration key not found. Key: plugin-directory - Using default value:
20220402 19:23:52.662 TRACE:: Config.Get(): Configuration key not found. Key: composer-dll-directory - Using default value:
20220402 19:23:52.665 TRACE:: Composer(): Loading Assemblies from /Lean/Optimizer.Launcher/bin/Debug/
20220402 19:23:52.691 TRACE:: Config.Get(): Configuration key not found. Key: log-handler - Using default value: CompositeLogHandler
20220402 19:23:52.777 TRACE:: Config.GetValue(): maximum-concurrent-backtests - Using default value: 3
20220402 19:23:52.785 TRACE:: Config.GetValue(): optimization-update-interval - Using default value: 10
20220402 19:23:52.789 TRACE:: Config.Get(): Configuration key not found. Key: lean-binaries-location - Using default value:
/Lean/Optimizer.Launcher/bin/Debug/../../../Launcher/bin/Debug/QuantConnect.Lean.Launcher
20220402 19:23:52.790 TRACE:: Config.Get(): Configuration key not found. Key: algorithm-type-name - Using default value:
20220402 19:23:52.792 TRACE:: Config.Get(): Configuration key not found. Key: algorithm-language - Using default value:
20220402 19:23:52.794 TRACE:: Config.Get(): Configuration key not found. Key: algorithm-location - Using default value:
20220402 19:23:52.813 TRACE:: LeanOptimizer.LaunchLeanForParameterSet(OID 6c896969-8dd1-43ec-8d0a-b1e327891583): launched backtest '19fd1094-0f7f-4086-831c-2e58aae487b6'
with parameters 'st_period:2'
qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
20220402 19:23:52.830 TRACE:: LeanOptimizer.LaunchLeanForParameterSet(OID 6c896969-8dd1-43ec-8d0a-b1e327891583): launched backtest
'ae9e86a1-b7bc-4e53-ae70-1007220572d1' with parameters 'st_period:3'
qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
20220402 19:23:52.844 TRACE:: LeanOptimizer.LaunchLeanForParameterSet(OID 6c896969-8dd1-43ec-8d0a-b1e327891583): launched backtest
'96994fa3-96af-484f-9278-4d2e96bb4c35' with parameters 'st_period:4'
qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
20220402 19:23:52.846 TRACE:: LeanOptimizer.Start(OID 6c896969-8dd1-43ec-8d0a-b1e327891583): start ended. Waiting on 3 backtests
20220402 19:23:52.853 ERROR:: LeanOptimizer.NewResult(OID 6c896969-8dd1-43ec-8d0a-b1e327891583): Got null/empty backtest result for backtest id
'19fd1094-0f7f-4086-831c-2e58aae487b6'
20220402 19:23:52.853 TRACE:: ConsoleLeanOptimizer.SendUpdate(): 3 Completed:0, Failed:1, Running:2, In Queue:0, Average Length:00:00:00, Total Runtime:00:00:00
20220402 19:23:52.855 ERROR:: LeanOptimizer.NewResult(OID 6c896969-8dd1-43ec-8d0a-b1e327891583): Got null/empty backtest result for backtest id
'ae9e86a1-b7bc-4e53-ae70-1007220572d1'
20220402 19:23:52.857 ERROR:: LeanOptimizer.NewResult(OID 6c896969-8dd1-43ec-8d0a-b1e327891583): Got null/empty backtest result for backtest id
'96994fa3-96af-484f-9278-4d2e96bb4c35'
20220402 19:23:52.858 TRACE:: LeanOptimizer.TriggerOnEndEvent(OID 6c896969-8dd1-43ec-8d0a-b1e327891583): Optimization has ended. Result was not reached
Successfully optimized 'equity_trader' and stored the output in 'equity_trader/optimizations/2022-04-02_12-23-34'
My Environment:
Docker v20.10.13
Apple M1 Pro 16 GB
Lean Docker: quantconnect/lean:latest "Created": "2022-04-01T23:10:30.375340294Z" "Architecture": "arm64"
conda 4.12.0
Fred Painchaud
Hi Sunil,
I would report to support@quantconnect.com. It looks like the optimizer is using QEMU and that at least one file is missing:
qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
It looks like the optimizer is running 3 backtests, for st_period:2, st_period:3 and st_period:4.
But then the results are empty for those 3 backtests. Maybe because of the missing file…
Fred
Alexandre Catarino
Hi,
SunilKumar has contacted support@quantconnect.com. Meanwhile, he was able to solve the issue:
I did some more testing and found that forcing docker to use the amd64 image by setting the environment variable "DOCKER_DEFAULT_PLATFORM=linux/amd64" or manually pulling docker images with "--platform=linux/amd64" flag, both backtest and optimization command works.
We have suggested building Lean to fix the issue:
Undo the DOCKER_DEFAULT_PLATFORM=linux/amd64 and --platform=linux/amd64 changes and make sure to be using the ARM64 images instead (basic check is to run lean optimize and to make sure that it fails with the "qemu-x86_64: ..." error)
1. Create an empty directory and cd into it in a terminal
2. Run git clone https://github.com/QuantConnect/Lean
3. Run git clone https://github.com/QuantConnect/AlphaStreams
4. Run lean build
5. cd to the directory lean init was executed in
6. lean optimize should work now
lean build automatically configures the CLI to use the custom-built Docker images, to revert to using the official images you can follow the instructions in the second half of the "Using Custom Images" section at https://www.quantconnect.com/docs/v2/lean-cli/projects/custom-docker-images#02-Using-Custom-Images
We will add this information to the Lean-CLI documentation.
SunilKumar
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!