I try to run lean local live trading(lean live) using Interactive Broker paper account, but run into error: No suitable Java Virtual Machine could be found on your system. The version of the JVM must be1.8.0_152.
Looks like this is IBGateway process try to locate Java 1.8 inside Lean VM?
I login to Lean VM and check java -version, looks like there do have Java 1.8 inside VM.
But why the IBGateway process can not locate it? How can I set the JAVA_HOME to /usr/lib/jvm/java-8-openjdk-arm64 so IBGateway can pickup the right Java.
(I am using Macbook M1, not sure if this is M1 specific issue?)
# java -versionopenjdk version "1.8.0_312"OpenJDK Runtime Environment (build 1.8.0_312-8u312-b07-0ubuntu1~20.04-b07)OpenJDK 64-Bit Server VM (build 25.312-b07, mixed mode)
Full error log:
20220707 20:44:54.941 TRACE:: InteractiveBrokersBrokerage.InteractiveBrokersBrokerage(): Starting IB Automater...20220707 20:44:54.949 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): Setting execute permissions onIBAutomater.sh20220707 20:44:54.960 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): chmod +x IBAutomater.sh: processexit code: 020220707 20:44:54.962 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): Loading IBGateway - Version: 985 -Path: /root/ibgateway - User: p20220707 20:44:54.964 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): Searching for TWS JRE path20220707 20:44:54.965 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): Install4J path:/root/ibgateway/.install4j20220707 20:44:54.967 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): File not found:/root/ibgateway/.install4j/pref_jre.cfg20220707 20:44:54.968 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): File found:/root/ibgateway/.install4j/inst_jre.cfg20220707 20:44:54.970 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): Directory found:/usr/lib/jvm/java-8-openjdk-arm64/jre20220707 20:44:54.972 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): Updating IBGateway ini file:/root/Jts/jts.ini20220707 20:44:54.974 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): Updating IBGateway configurationfile: /root/ibgateway/ibgateway.vmoptions20220707 20:44:54.983 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): IBAutomater process started - Id:157- Name:IBAutomater.sh - InitializationTimeout:00:15:0020220707 20:44:54.986 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): UID PID PPID C SZ RSSPSR STIME TTY TIME CMD20220707 20:44:54.987 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): root 1 0 62 5660961370732 0 20:44 pts/0 00:00:03 dotnet QuantConnect.Lean.Launcher.dll20220707 20:44:54.988 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): root 157 1 0 2379 28683 20:44 pts/0 00:00:00 /bin/bash /Lean/Launcher/bin/Debug/IBAutomater.sh /root/ibgateway20220707 20:44:54.989 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): root 158 157 0 2844 27802 20:44 pts/0 00:00:00 ps -AFH20220707 20:45:00.005 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): UID PID PPID C SZ RSSPSR STIME TTY TIME CMD20220707 20:45:00.009 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): root 1 0 37 5660961371488 3 20:44 pts/0 00:00:04 dotnet QuantConnect.Lean.Launcher.dll20220707 20:45:00.010 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): root 157 1 0 2379 29523 20:44 pts/0 00:00:00 /bin/bash /Lean/Launcher/bin/Debug/IBAutomater.sh /root/ibgateway20220707 20:45:00.013 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): root 162 157 0 2844 28200 20:44 pts/0 00:00:00 ps -AFH20220707 20:45:00.120 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): No suitable Java Virtual Machinecould be found on your system.20220707 20:45:00.123 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): The version of the JVM must be1.8.0_152.20220707 20:45:00.123 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): IBGateway process exited20220707 20:45:00.141 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): Please define INSTALL4J_JAVA_HOME topoint to a suitable JVM.20220707 20:45:00.148 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterExited(): Exit code: 020220707 20:45:00.150 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterExited(): IBGateway close detected, restarting
Jared Broad
Hey there,
Rather than mess with individual environment setups which can be very difficult and error-prone, we made the LEAN CLI package everything via docker containers. Are you able to use the CLI? lean.io/cli
Thanks, Jared
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.
Francis Hsu
Hi Jared,
I do use Lean CLI to run live trading locally. After some digging I know the root cause of the issue. This is Ibgateway bug specific to Macbook M1. (or any ARM based CPU).
Inside the Lean docker image it start Ibgateway script at /root/ibgateway/ibgateway. The ibgateway shell script which check the java version installed and it ONLY accept 1.8.0_152. ( So we see error message like this: The version of the JVM must be 1.8.0_152.20220707 )
However Lean docker image for M1 only pre-installed with Java "1.8.0_312". and the ibgateway start-up will fail.
Everyone run lean live trading on M1 will run into this.
To really fix the issue we should fix ibgateway script in IBGateway repo. But I don't have access to it. So my temporary workaround for this is:
Here is ibgateway we need to change.
Jared Broad
Great work thank you for sharing the result back to the community. We'll work on a systematic fix for the CLI.
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 Francis Hsu ,
We have created a GitHub issue on LEAN-CLI repo based on your report:
"No suitable Java Virtual Machine" Error on IB Deployment under macOS (M1 Chip) #114
Please subscribe for updates.
Best regards,
Alex
Francis Hsu
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!