metatrader error when trying to login with Python, error code = (-10005, 'IPC timeout')


I am trying to login to Metatrader account and I have been receiving this error code.

Please see code below;

I first import necessary libraries and initialize which works fine

from datetime import datetime

import MetaTrader5 as mt5


But when I try to log in using the below code, I receive this error - 

failed to connect at account #51166970, error code: (-10005, 'IPC timeout')

In  [14]:


authorized=mt5.login(account, password='z6kjjrtr', server='ICMarketsSC-Demo')

if authorized:


    print("Show account_info()._asdict():")

    account_info_dict = mt5.account_info()._asdict()

    for prop in account_info_dict:

        print("  {}={}".format(prop, account_info_dict[prop]))


    print("failed to connect at account #{}, error code: {}".format(account, mt5.last_error()))

I also read some post about similar errors which asked I specify the path, please see post links ( and and, so I edited my code but received this error - initialize() failed, error code = (-10005, 'IPC timeout')

As noted in an answer here ( I changed my path from

"C:\Program Files\MetaTrader 5\terminal64.exe"


"C:/Program Files/MetaTrader 5/terminal64.exe"

#start the platform with initialize()
if not mt5.initialize("C:/Program Files/MetaTrader 5/terminal64.exe", login=22000642, password="duzhhjkd8", server="Deriv-Demo"):   
    print("initialize() failed, error code =", mt5.last_error())
    mt5.login(login=22000642, password='duzhhjkd8', server='Deriv-Demo')

How can I rectify this

MetaTrader5 libarary in Python 3.7
MetaTrader5 libarary in Python 3.7
  • 2019.09.20
  • Çağlar Can Sarıkaya
I am trying to analyze currency data using MT5 in Python but it is not working. I didn't understand where is the problem? even importing is not work This is the error: