MT5 Python integration on Mac M1 (ARM)

 

Does anyone know if there's any way to get the MT5 python integration to work on Mac M1 (arm).

Python installs and runs fine on a Mac, but unsurprisingly, when I try:

pip install MetaTrader5

I get:

ERROR: Could not find a version that satisfies the requirement MetaTrader5 (from versions: none)
ERROR: No matching distribution found for MetaTrader5

...because it's looking for a Mac version of the package, while the available package is Windows only.


Now... The normal full MetaTrader 5 app works ok on Mac (via Wine/Crossover) as per https://www.metatrader5.com/en/download.  It's basically the Windows version packaged up in a Wine/Crossover bottle to run on the Mac, but there doesn't seem to be any way to do any similar process with the python MT5 that I can find.

If my Mac was an Intel Mac I could run it in a Windows virtual machine, but the new M1 Macs don't support that -- mostly.  There is the option to run a Windows 11 ARM virtual machine, but will the python MT5 (what you get when you run `pip install MetaTrader5`) install and work on Arm Windows?

I'll welcome and appreciate any advice or knowledge anyone is willing to share. Thanks!

Documentation on MQL5: Integration / MetaTrader for Python
Documentation on MQL5: Integration / MetaTrader for Python
  • www.mql5.com
MetaTrader for Python - Integration - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
David _Detnator_:

Does anyone know if there's any way to get the MT5 python integration to work on Mac M1 (arm).

Python installs and runs fine on a Mac, but unsurprisingly, when I try:

I get:

...because it's looking for a Mac version of the package, while the available package is Windows only.

I don't think that will be the issue, python packages do not depend on the type of machine as long as the machine can run python code, I haven't used Mac M1 though so correct me if I'm wrong I believe you should check out pip related issues and make sure you have virtual environment activated so that you can use pip install metatrader5 instead of pip3 install metatrader5 post the picture of your command line here also let us know the python version you have installed on your pc
 

Really, not working on Mac M1, python 3.10:

ERROR: Could not find a version that satisfies the requirement MetaTrader5 (from versions: none)
ERROR: No matching distribution found for MetaTrader5
 
seggest #: Really, not working on Mac M1, python 3.10:

You will probably have to run a "Windows" python setup on Wine as well. I don't think it will be able to "talk" to the the macOS setup of Python.

 
Omega J Msigwa #:
I don't think that will be the issue, python packages do not depend on the type of machine as long as the machine can run python code, I haven't used Mac M1 though so correct me if I'm wrong I believe you should check out pip related issues and make sure you have virtual environment activated so that you can use pip install metatrader5 instead of pip3 install metatrader5 post the picture of your command line here also let us know the python version you have installed on your pc

Thanks for your comments, however...

Tried it with multiple versions of python, including the latest download for Mac from python.org (3.10.7 at time of writing this).  I'm not sure what you mean by virtual environment activated. Can you elaborate?

All that said, since writing my question initially (a few months ago now) I've learned that I think/believe the MT5 python package is written mostly in C++ and is compiled specifically for Windows OS on Intel architecture.  If that's the case, it lines up with the results I'm getting and it means it will never run natively on an M1/2 Mac, unless of course MetaQuotes releases a version specifically for Mac and the Apple M chips.

Of course I can run it through Wine or a virtual machine, on a Mac, but still only on an Intel Mac, not an M1/2.

I do happen to have an Intel Mac -- the last 8-core i9 16" MBP, maxed out in every way, and it does the job in a virtual machine or booting the entire machine into Windows instead of MacOS, but I can fry an egg on it doing anything even remotely processor intensive, which is the 2nd biggest reason I bought my M1 Max MBP... the biggest reason being the M1 Max is much faster.  So running my Javascript app that calls MT5 through the python integration works, but I found a better way (at least based on the results)...

I finally more or less solved this problem by setting up the Intel Mac with a Windows Virtual Machine (using VMWare Fusion) and it does nothing but run a python based REST API that I wrote (with some help).  It receives REST API calls (over the local gigabit network from my Javascript app running natively on my M1 Max Mac) calls corresponding python MT5 functions, gets the results and returns those to the calling M1 Max Mac.  It's faster and more effective, compared with every other option I've tried (including the above mentioned running the whole thing natively on the Intel Mac running Windows).  And now I have the benefit of developing my trade automation app in a language that doesn't make me want to jump off a bridge (Javascript as opposed to MQL) and on an OS that doesn't make me want to jump off a bridge (MacOS as opposed to Windows).  So many more possibilities and options in JS also.

Of course if anyone else ever comes up with a better way to do this (the goals being develop on MacOS in any decent modern language instead of MQL), then I'm all ears, but until then this is working well so I'm happy for now!

Want to share this in case it helps anyone else trying to do anything similar.

 
Fernando Carreiro #:

You will probably have to run a "Windows" python setup on Wine as well. I don't think it will be able to "talk" to the the macOS setup of Python.

Fernando, Indeed, that's is correct.  Or at least I know of no way to do it directly, despite multiple questions about it on multiple forums.

See my comment above for how I was able to do it, indirectly (but efficient and fast enough).

 
David _Detnator_ #:

 [...]

I finally more or less solved this problem by setting up the Intel Mac with a Windows Virtual Machine (using VMWare Fusion) and it does nothing but run a python based REST API that I wrote (with some help).  It receives REST API calls (over the local gigabit network from my Javascript app running natively on my M1 Max Mac) calls corresponding python MT5 functions, gets the results and returns those to the calling M1 Max Mac.  It's faster and more effective, compared with every other option I've tried (including the above mentioned running the whole thing natively on the Intel Mac running Windows).  And now I have the benefit of developing my trade automation app in a language that doesn't make me want to jump off a bridge (Javascript as opposed to MQL) and on an OS that doesn't make me want to jump off a bridge (MacOS as opposed to Windows).  So many more possibilities and options in JS also.

Of course if anyone else ever comes up with a better way to do this (the goals being develop on MacOS in any decent modern language instead of MQL), then I'm all ears, but until then this is working well so I'm happy for now!

Want to share this in case it helps anyone else trying to do anything similar.

Hey David, thanks for sharing your experience. By the way, what is the best way to get a virtual Windows OS  on VMWare Fusion (with Mac as host)?

Are there cheap licenses anywhere? and what would you say is the oldest Windows OS that can run the python MT5 API and the MT5 terminal satisfactory?

I also plan to use it only for the purpose of running the python script.  

 
Does anyone can help me installing MT5 to my Mac OS with M1? or the only way to use it is by VMWare?