sudo apt install wine
Thank you Nio, but step 5 cannot be executed without some additional work. Installing Python does not add it to the PATH. And adding the correct location to the PATH is no easy task in this case. It is not obvious where the installed running on wine cmd will store the Python executable.
Thank you Nio, but step 5 cannot be executed without some additional work. Installing Python does not add it to the PATH. And adding the correct location to the PATH is no easy task in this case. It is not obvious where the installed running on wine cmd will store the Python executable.
Hi Juan,
Thank you for your feedback. You are right, step 5 can only be executed if Python is already in the PATH of Wine environment. So, in step 4 while installing Python, make sure we enable the checkbox "Add Python 3.8 to PATH".
Otherwise, we can add Python to PATH variable manually as follows.
1. Find where was Python (and its modules) installed in Wine. I believe they locate at, for example
~/.wine/drive_c/users/niopham/Local Settings/Application Data/Programs/Python/Python38/ ~/.wine/drive_c/users/niopham/Local Settings/Application Data/Programs/Python/Python38/Scripts/ ~/.wine/drive_c/users/niopham/Local Settings/Application Data/Programs/Python/Python38/Lib/site-packages/
2. Then, in Linux terminal, run
wine regedit
3. Add the above paths to HKEY_CURRENT_USER/Environment/PATH. Assuming your Python locates as above, then you need to add the following line to the begining of the PATH variable
C:\users\niopham\Local Settings\Application Data\Programs\Python\Python38\;C:\users\niopham\Local Settings\Application Data\Programs\Python\Python38\Scripts\;C:\users\niopham\Local Settings\Application Data\Programs\Python\Python38\Lib\site-packages\;
4. Finally, you can verify again the updated PATH variable of Wine by running
wine cmd echo %PATH%
Feel free to feedback.
Nice to read instructions on how to install MetaTrader5 on wine, but ... step 5 fails for me.
I get this error message
Preparing metadata (pyproject.toml) ... error Cargo, the Rust package manager, is not installed or is not on PATH. This package requires Rust and Cargo to compile extensions. Install it through the system's package manager or via https://rustup.rs/
So i have downloaded rustup-init.exe from the page rustup.rs, and tried to install it, but once again, i got an error
error: could not download file from 'https://static.rust-lang.org/dist/channel-rust-stable.toml.s ha256' to 'C:\users\XXX\.rustup\tmp\74b751a_b4gwxqip_file': failed to make network request: error sending re quest for url (https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256): error trying to connect: OS E rror -2146762482 (FormatMessageW() returned error 317) (os error -2146762482): error trying to connect: OS Error -2146762482 (FormatMessageW() returned error 317) (os error -2146762482): OS Error -2146762482 (FormatMessageW( ) returned error 317) (os error -2146762482)
At this point, i have no idea on how to finish the installation of jupiterlab ...
Any idea ... ?
I need to say that when i use this command in wine
python -m pip install MetaTrader5
i got this error message
ERROR: Could not find a version that satisfies the requirement MetaTrader5 (from versions: none) ERROR: No matching distribution found for MetaTrader5
So i have no idea on how to install this python library ...
Nice to read instructions on how to install MetaTrader5 on wine, but ... step 5 fails for me.....
Hi Thierry,
For your problem when installing Jupyter lab, I have no idea (did not happen to me).
However, I found a related post: https://discourse.jupyter.org/t/jupyter-lab-install-fails-without-rust/18065/2?u=fomightez
According to the author (Orome), the solution that worked for him is: "pip install -I y-py==0.5.5" (see also the answer of davidbrochart).
For your problem when installing MetaTrader5, I have some suggestions:
1. Make sure you are in CMD environment provided by Wine, not in the command line environment of Linux. This means you must run "wine cmd" first to enter into the CMD environment.
2. Probably that your python version is not compatible. Check "python --version" (again, make sure you are in CMD environment). If your version is supported by MetaTrader5 (as mentioned at https://pypi.org/project/MetaTrader5/) then I believe you should be able to install it properly.
Please feel free to update.
I can install jupyterlab and Metatrader5, but got error when use it.
Do you know how to fix this ?
Hi trunix9999
Did you got the error when import another library, for example, "import numpy as np"?
Anyway, I believe the problem is related to Wine and its config.
Try runing winecfg from terminal and changing the Windows versions. You can also try to install the newest version of Wine, as well as other version of Python.
Good luck!
I have many linux ubuntu servers. I want to open EA bot on that server. Is there any way to do it?
Hi kim nguyễn
In your case, I think you can install a GUI for each server, then connect (using remote desktop applications) and proceed as an usual Ubuntu Desktop (manually install MT5, python packages,...)
You can also use just a Windows server to run multiple MT5 instances (multiple bots) simultaneously. The number of instances you can run depends mainly on your server’s available RAM (for a reference, with the lowest configuration server on AWS, 3 instances can run smoothly).
I can install jupyterlab and Metatrader5, but got error when use it.
Do you know how to fix this ?
Hi again trunix9999,
I found the solution for your problem.
Recently, I tried installing MetaTrader5 on Python 3.10 on a new Ubuntu (with Wine 10.0) and saw the same error.
What you need to do is to add the missing (not full-supported, actually) dll file mentioned in the terminal to the folder ./wine/drive_c/windows/system32.
You can also see the name of the dll file by clicking "Show Details", I believe it is ucrtbase.dll. This file, as well as other dll files, can be downloaded from the internet (e.g., DLLme.com, DLL-files.com).
After pasting it into the folder, register it by configurating Wine: run winecfg from terminal, select tab Libraries, add the dll file (select native, builtin), then restart Python from Wine
wine python.exe >>> import MetaTrader5 as mt5
That works perfectly for me.
Thanks for sharing — this is a clear and useful guide for running the MetaTrader5 Python integration on Ubuntu via Wine. Important reminder: MetaTrader5 Python package only works when MT5 is open in Wine, and all Python calls must run in the same Wine environment.
This method is a valid workaround since MT5 doesn't natively support Linux or Python integration outside Windows APIs.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have successfully installed and used the MetaTrader5 package on Ubuntu without any difference on Windows. Here are the instructions.
1. Install Wine with the following command (skip if you already installed)
2. Install the MetaTrader 5 platform for Linux according to the official instructions provided in MetaTrader 5 on Linux
3. Download Python 3.8 to your Downloads folder
cd ~/Downloads wget https://www.python.org/ftp/python/3.8.0/python-3.8.0-amd64.exe --no-check-certificate
4. Install Python 3.8 for the Windows environment in Wine. Assuming you are in the ~/Downloads folder
5. After successfully installing Python 3.8, we install Jupyter Lab (or Notebook) for the Windows environment in Wine. Make sure you are still in the wine cmd environment
6. Start Jupyter (again, ensure you are still in the wine cmd environment)
7. The key point here is to install the MetaTrader5 package from Jupyter to avoid any path-related issues. After the Jupyter window opens, install MetaTrader5 using the following command
8. You are done !
Note:
- Please ensure that you follow the instructions carefully and execute the commands in the appropriate environments.
- Just like on Windows, it is necessary to open an instance of MetaTrader 5 for the MetaTrader5 package to work.