mt5.initialize() fails with (-10005, 'IPC timeout') - terminal launches/logs in fine, every config variable ruled out

Environment:
- Windows Server 2019 (build 17763), Hyper-V VPS
- MetaTrader 5 terminal build 6231
- Python 3.11, MetaTrader5 pip package (tested both 5.0.6180 and 5.0.6231 — identical failure on both)
- Terminal launched from a copied/portable installation folder (not the default install path)

Problem:
mt5.initialize() reliably fails with (-10005, 'IPC timeout') in every configuration tested. The terminal itself always launches correctly, logs into the account successfully (confirmed via terminal title bar and Journal), and its Journal shows a clean startup with no errors ("MCP started on 127.0.0.1:22346", no IPC/dispatcher errors). The failure is specifically in the Python client's own IPC handshake to the already-running, already-logged-in terminal.

Things ruled out (each individually tested and confirmed not the cause):
1. Environment variables / credentials - confirmed correct via echo, retested
2. Stray/orphaned terminal processes or port 22346 conflicts — confirmed clean via tasklist/netstat before each test
3. Bitness mismatch - both Python and package confirmed 64-bit
4. Package version mismatch - tested both 5.0.6180 and 5.0.6231 (terminal is build 6231), identical failure on both
5. Portable vs non-portable terminal mode — tested both, identical failure
6. Combined mt5.initialize(path=, login=, password=, server=) call vs. separately launching the terminal (with /login /password /server command-line flags) then calling bare mt5.initialize() with no arguments - identical failure both ways
7. "Allow algorithmic trading" / "Disable algorithmic trading via external Python API" settings in Tools > Options > Experts  -confirmed correctly enabled
8. Windows Firewall - fully disabled for all profiles, identical failure
9. Windows Defender real-time antivirus protection — fully disabled, identical failure
10. Account-specific restriction - tested against two completely separate Deriv-Demo accounts, identical failure on both
11. Stale/corrupted process state - full VPS reboot performed, all auto-starting scheduled tasks disabled to guarantee a clean process/port state, identical failure persisted

Question: Is there a known issue or undocumented requirement for MetaTrader5 Python package automation on Windows Server 2019 specifically, or with terminal build 6231? Is there additional diagnostic logging we can enable on the terminal side to see what is actually rejecting the IPC handshake?



Python code used ?

And also post the log for MT5 or ME.

Adeyemi8819:
Environment:
...
- Terminal launched from a copied/portable installation folder (not the default install path)

...
6. Combined mt5.initialize(path=, login=, password=, server=) call vs. separately launching the terminal (with /login /password /server command-line flags) then calling bare mt5.initialize() with no arguments - identical failure both ways

...


Try passing in the path explicitly to the `path=` parameter
Adeyemi8819:
7. "Allow algorithmic trading" / "Disable algorithmic trading via external Python API" settings in Tools > Options > Experts  -confirmed correctly enabled

Hi

Usually the timeout error cause for Python Integration is unchecked. Please after you checked the Python Integration, restart the MT5. and if you installed multiple Terminals of MetaTrader, should assign the path of terminal correctly.

Sandro Begashvili #:

Hi

Usually the timeout error cause for Python Integration is unchecked. Please after you checked the Python Integration, restart the MT5. and if you installed multiple Terminals of MetaTrader, should assign the path of terminal correctly.

Nice try but with Python integration disabled, here is what it gives :

2026.10.01 16:24:09.562    517401 (USDJPY,M1)    3.14.7 (tags/v3.14.7:823f032, Aug  5 2026, 10:51:32) [MSC v.1944 64 bit (AMD64)]
2026.10.01 16:24:09.641    517401 (USDJPY,M1)    MetaTrader5 package version:  5.0.6231
2026.10.01 16:24:09.641    517401 (USDJPY,M1)    MetaTrader5 running Build:  (0, 0, '')
2026.10.01 16:25:51.502    517401 (USDJPY,M1)    False
2026.10.01 16:25:51.502    517401 (USDJPY,M1)    (-10003, "IPC initialize failed, Pipe server didn't answer in 60 sec")