[ERROR] Python Integration MetaTrader5 - AttributeError: module 'MetaTrader5' has no attribute 'initialize'

 

Hi all, 

After install package: 

pip install MetaTrader5

Then, I try with code:


import MetaTrader5 as mt5
# display data on the MetaTrader 5 package
print("MetaTrader5 package author: ", mt5.__author__)  # ok
print("MetaTrader5 package version: ", mt5.__version__)  # ok

# Initialize connection to MetaTrader 5
if not mt5.initialize():
   print("initialize() failed")
   mt5.shutdown()

It's always error:

AttributeError: module 'MetaTrader5' has no attribute 'initialize'

MetaTrader 5 terminal is running already.

System:

  • OS: Windows 10
  • Python 3.9

Has anyone ever encountered this error? please help.

Thanks.

 

Solved! downgrade numpy

pip install numpy==1.26.4