Broker API HubMenu

MT5 Python initialize() failed: error -10005, IPC timeout

The MetaTrader5 Python package asked the MetaTrader 5 terminal for a connection and got no answer in time. What the code means, what the forum thread that reports it found, and what to check before you run the script again.

Independent and unofficialLast reviewed

Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.

Carried over from an earlier version of this site. The links below are the sources it was written from, but its statements have not been re-read at source since the date shown, so check anything you rely on.

What to check

  1. Check that the Python running your script is a Windows build. Run python -c "import sys; print(sys.platform)" in the same environment; on Windows it prints win32. On Linux or macOS, read the MetaTrader5 package on Linux and macOS.
  2. Check that a MetaTrader 5 terminal is installed, running and logged in to your account before initialize() is called.
  3. If more than one terminal is installed, pass the full path of the one you mean to initialize(path=...), so there is no doubt which copy the package connects to.
  4. initialize() also takes a timeout argument (MQL5 docs). If the terminal is slow to start, a longer value is a fair check. Neither the thread nor the docs say it cures -10005.
  5. Check the terminal is build 4755 or later. MetaQuotes ended support for older terminals from 1 Jul 2025, and older terminals cannot connect to broker servers.

The fix reported in the thread is the Windows Python point in step 1. Steps 2 to 5 are checks we suggest, not fixes anyone has reported for this error.

Next steps for this error

Why it happens

The MetaTrader5 package does not talk to your broker. It talks to a MetaTrader 5 terminal running on the same machine, over interprocess communication, and the terminal talks to the broker's server. When initialize() cannot complete that local handshake in time, last_error() returns -10005.

In the MQL5 forum thread of 22 Jan 2025, the reply to this error was that on Linux and macOS the package needs Windows Python. PyPI agrees on the packaging side: the newest release when we read it, 5.0.6231 of 27 Sep 2026, ships wheels for win32 and win_amd64 only, with no macOS or Linux build.

Questions

What does error code -10005 mean in MetaTrader5 Python?

It is RES_E_INTERNAL_FAIL_TIMEOUT, which MQL5's last_error table describes as an internal timeout: the package waited for the MetaTrader 5 terminal and got no answer in time.

Is the IPC timeout a problem with my broker?

Not on its own. The package reaches the terminal on your machine by interprocess communication, and only the terminal talks to the broker, so check the terminal and your Python first.

How do I fix (-10005, 'IPC timeout') on Linux or macOS?

The reply in the MQL5 forum thread of 22 Jan 2025 is that on Linux and macOS the package needs Windows Python. PyPI publishes the package for win32 and win_amd64 (Windows) only.

Will a longer timeout in initialize() fix it?

Nobody in the sources we read reports that. initialize() does take a timeout argument, so a longer value is a fair check if the terminal is slow to start, but treat it as a test, not a known fix.

Sources

Sections