Python Import Metatrader 5 crashes


On Anaconda3 shell I have installed Metatrader 5 package using pipenv. My Python script does an import Metatrader 5; and immediately the program crashes (as seen from pdb step line by line). Windows Event log has the below, apparently pointing to some math libaries:

- <Event xmlns="">
- <System>
  <Provider Name="Application Error" />
  <EventID Qualifiers="0">1000</EventID>
  <TimeCreated SystemTime="2023-01-07T08:41:12.7808684Z" />
  <Correlation />
  <Execution ProcessID="0" ThreadID="0" />
  <Security />
- <EventData>
  <Data />
  <Data />

I have Metatrader5 package 5.0.37, Python 3.9.12 and Windows 10 32 bit. Any help on how to resolve this is much appreciated and please do so before I shoot myself.


Just considering the error message you shared, I have a feeling that your problem might not be related to Metatrader5 but instead with your conda installation or numpy package.

I assume you installed Anaconda (not miniconda) and your environment has multiple Python packages already installed.

If you haven't already, I suggest you create your own conda environment (documentation here) and in your yml file use only following packages:

python any version > 3.10 and < 3.11 

numpy 1.20+

MetaTrader5 5.0.43 (source should be pip / pypi)

If conda is not a must, I suggest Poetry for environment management.

Managing environments — conda 22.11.1.post24+48f51e6c1 documentation
With conda, you can create, export, list, remove, and update environments that have different versions of Python and/or packages installed in them. Switching or moving between environments is called activating the environment. You can also share an environment file. Creating an environment with commands Use the terminal or an Anaconda Prompt...