Persistent mt5.initialize() IPC Timeout (-10005) on MT5 Build 6231 with Python 3.13 (64-bit)

Hello,

I am developing a Python-based trading system using the official MetaTrader 5 Python package. I am experiencing a persistent IPC timeout when attempting to connect Python to the MT5 desktop terminal.

Environment

  • OS: Windows 64-bit

  • Python: 3.13.15 (64-bit)

  • MetaTrader5 Python package: 5.0.6231

  • MT5 terminal: Build 6231

  • Broker: Exness demo account

  • Terminal executable: C:\Program Files\MetaTrader 5\terminal64.exe

Error

mt5.initialize(path=r"C:\Program Files\MetaTrader 5\terminal64.exe") False mt5.last_error() (-10005, 'IPC timeout')

Troubleshooting already performed

  1. Confirmed Python and the MT5 terminal are 64-bit.

  2. Verified that the MetaTrader5 Python package imports successfully.

  3. Confirmed the terminal is running and logged into my Exness demo account.

  4. Checked MT5's Expert Advisors settings. “Disable algorithmic trading via external Python API” is unchecked.

  5. Specified the exact terminal executable path in mt5.initialize() .

  6. Increased the initialization timeout to 120,000 ms. The call still failed with (-10005, 'IPC timeout') .

  7. Tested an isolated portable terminal in a separate directory. It also failed with the same error.

  8. Verified that the terminal process was running and listening on its local IPC-related port.

  9. Reinstalled neither MT5 nor the Python package, and have not modified the existing installation.

No orders were placed, and no live account was used for these tests.

Questions

  1. Is there a known Python IPC compatibility issue with MT5 Build 6231 and Python 3.13?

  2. Are there known issues with MetaTrader5 Python package version 5.0.6231?

  3. Is there an official, supported method to test an earlier MT5 terminal build side by side without modifying the current installation?

  4. Are there additional diagnostic steps or logs that can identify why the IPC handshake is timing out?

I would appreciate any technical guidance or confirmation of a known issue. I am happy to provide further diagnostic information if needed.

Thank you.

A common cause of -10005 is an elevation mismatch. If terminal64.exe runs as administrator and Python doesn't (or the other way round), the IPC handshake just times out even though the terminal looks fine. Run both at the same level, close all terminal instances, and let Python start the terminal itself:

import MetaTrader5 as mt5
ok = mt5.initialize(path=r"C:\Program Files\MetaTrader 5\terminal64.exe")
print(ok, mt5.last_error())

If it still times out with nothing else running, then it's worth reporting with the build numbers to Service Desk.

Navid Mirzaaghazadeh #:

A common cause of -10005 is an elevation mismatch. If terminal64.exe runs as administrator and Python doesn't (or the other way round), the IPC handshake just times out even though the terminal looks fine. Run both at the same level, close all terminal instances, and let Python start the terminal itself:

Nice assumption without any evidence.

If it still times out with nothing else running, then it's worth reporting with the build numbers to Service Desk.

Whatever, technical issue should NOT be reported to the ServiceDesk, only financial issue. Please avoid such advice on the forum.

I’m seeing a similar −10005 initialization failure on terminal build 6249, without assuming it has the same cause as other reports here.

Environment:

  • Windows Server 2025 Datacenter 24H2, OS build 26100.33438
  • CPython 3.13.16 x64, standard GIL build, isolated virtual environment
  • Official MetaTrader5 Python package 5.0.6231, cp313 Windows x64 wheel; import succeeds
  • IC Markets Global MT5 build 6249, with a valid MetaQuotes executable signature
  • External Python through PowerShell, not MetaEditor; terminal already running

The terminal and Python worker were verified to use the same Windows user and session. The Python worker was non-elevated. PowerShell was started with runas /profile for a dedicated standard user inside an Administrator RDP desktop.

No broker account was manually logged in. Authentication state was not independently verified because initialization failed. No login, password or server arguments were supplied.

Minimal extracted call with a generic executable-path placeholder, illustrating the tested initialization rather than an additional test:

import MetaTrader5 as mt5 try: initialized = mt5.initialize( r"C:\PATH\TO\MT5\terminal64.exe", timeout=60000, portable=False, ) if not initialized: error_code = mt5.last_error()[0] print("initialize:", initialized) print("last_error code:", error_code) finally: mt5.shutdown()

Observed output: initialize: False; last_error code: −10005.

Results:

  • timeout=5000: False / −10005; elapsed time was not recorded.
  • timeout=60000: False / −10005 after 65.556 seconds; total supervisor duration 66.096 seconds.
  • shutdown returned in both runs. Neither the 15-second nor the 90-second outer watchdog fired.
  • Before/after snapshots showed unchanged terminal PID, owner, build and executable hash. This was not continuous monitoring.
  • account_info, terminal_info and version were not reached. No trading calls were made.

A bounded scan of two candidate logs found no matching diagnostic entries around the second attempt. Both files’ modification times predated the attempt, and their mapping to the running terminal remains unconfirmed. File → Open Data Folder produced no visible Explorer window in this runas arrangement.

Questions:

  1. Should initialize succeed before any broker-account login?
  2. Is there a known issue with terminal build 6249 and Python package 5.0.6231 on this Windows/Python combination?
  3. What is the smallest supported, non-sensitive diagnostic to distinguish an IPC transport problem from terminal-profile initialization failure?

Use 

mt5.initialize( r"C:/PATH/TO/MT5/terminal64.exe",...)

Instead of :

mt5.initialize( r"C:\PATH\TO\MT5\terminal64.exe",...)
Alain Verleyen #:

Use 

Instead of :

Thank you, Alain.

I've tested your suggested forward-slash path format, changing only the path separators in mt5.initialize().

Unfortunately, the result was unchanged:

  • Backslash path: -10005, initialization returned false after 65.556 seconds.

  • Forward-slash path: -10005, initialization returned false after 65.593 seconds.

Both path formats were independently verified to reference the same MT5 executable. The terminal remained running under the same standard Windows user and session as Python. No elevation was used, and shutdown returned normally.

One detail that may be relevant: this MT5 installation has never been manually logged into a trading account, and its initial account wizard was cancelled.

Is initialize() expected to establish IPC successfully in that state, before a broker account has been configured? Or does the terminal require initial broker-server discovery or account setup?

We're specifically looking for a supported way to initialize a fresh terminal automatically, without manual GUI interaction.

Thank you for your guidance.

AFX Trading #:

Thank you, Alain.

I've tested your suggested forward-slash path format, changing only the path separators in mt5.initialize().

Unfortunately, the result was unchanged:

  • Backslash path: -10005, initialization returned false after 65.556 seconds.

  • Forward-slash path: -10005, initialization returned false after 65.593 seconds.

Both path formats were independently verified to reference the same MT5 executable. The terminal remained running under the same standard Windows user and session as Python. No elevation was used, and shutdown returned normally.

One detail that may be relevant: this MT5 installation has never been manually logged into a trading account, and its initial account wizard was cancelled.

Is initialize() expected to establish IPC successfully in that state, before a broker account has been configured? Or does the terminal require initial broker-server discovery or account setup?

We're specifically looking for a supported way to initialize a fresh terminal automatically, without manual GUI interaction.

Thank you for your guidance.

Try it and let us know.
Alain Verleyen #:
Try it and let us know.

Hi Alain,

Good news — I've successfully established the Python IPC connection.

After manually logging into a separate MT5 demo account, the same Python initialize() call succeeded in approximately 4 ms, rather than timing out with -10005.

The account and server identities matched, demo mode and broker connectivity were confirmed, and shutdown() completed normally.

The earlier tests failed before any account had been manually authenticated. This suggests that initial account or terminal-profile configuration may have played a role, although I haven't established the precise cause.

For automated deployments, is there a recommended way to bootstrap a completely fresh MT5 installation with account/server credentials so Python IPC can connect without requiring an initial manual GUI login?

Thank you for your help.