MetaTrader 5 Python User Group - how to use Python in Metatrader - page 19

 
capissimo:

1. I originally had Python 3.7.2 installed. Installed your package and the command shell and Jupyter notepad pops up the same error: RuntimeError: IPC call failed

2. I ripped Python 3.7.2, installed Python 3.8, but the same story - it doesn't install in Python 3.8

3. Installed Anaconda Python, specifically created a virtual environment for Python 3.7.2 and tried to pip your package and run the example - same view, but on the side: RuntimeError: IPC call failed

Thus, in Python 3.8 the package does not install at all. In Python 3.7.2 aRuntimeError: IPC call failed. Point
 
Maxim Dmitrievsky:

doing something wrong

Maxim Dmitrievsky:

A good tutorial on how to work with data and a bit of MO if there's something you didn't know, but have forgotten. Including a tip on how to stop thinking that python is retarded.

https://jakevdp.github.io/PythonDataScienceHandbook/

Here's the report in Python 3.8


C:\Users\labor>pip install MetaTrader5

Collecting MetaTrader5

Using cached https://files.pythonhosted.org/packages/3c/c8/713f1b8283cbbdef30dc9cf50a5d767f9b4a194eb4f886a8e50074b696a1/MetaTrader5-5.0.6.tar.gz

Installing collected packages: MetaTrader5

Running setup.py install for MetaTrader5 ... error

ERROR: Command errored out with exit status 1:

command: 'c:\python38\python.exe' -u -c'import sys, setuptools, tokenize; sys.argv[0] = '"'''C:\Users\\\\labor\\AppData\Local\\\Temp\\pip-install-283aremb\\MetaTrader5\\setup.py'"'"'; __file__='"'"'C:\\Users\\labor\\AppData\\Local\\Temp\\pip-install-283aremb\\MetaTrader5\\setup.py''';f=getattr(tokenize, ''''open''', open)(__file__);code=f.read().replace(''''\r\n''', '''''\n''');f.close();exec(compile(code, __file__, '''exec''')'' install --record 'C:\Users\labor\AppData\Local\Temp\pip-record-t10_91ai\install-record.txt' --single-version-externally-managed --compile

cwd: C:\Users\labor\AppData\Local\Temp\pip-install-283aremb\MetaTrader5\

Complete output (16 lines):

running install

running build

running build_py

creating build

creating build\lib.win-amd64-3.8

creating build\lib.win-amd64-3.8\MetaTrader5

copying MetaTrader5\__init__.py -> build\lib.win-amd64-3.8\MetaTrader5

running build_ext

building 'MetaTrader5.C' extension

creating build/temp.win-amd64-3.8

creating build/temp.win-amd64-3.8/Release

creating build\temp.win-amd64-3.8\release\src

creating build\temp.win-amd64-3.8\Release\src\Interprocess

creating build\temp.win-amd64-3.8\Release\src\Connector

cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DUNICODE -Isrc -Ic:\python38\include -Ic:\python38\include /EHsc /Tpsrc/MetaTrader.cpp /Fobuild\temp.win-amd64-3.8\Release\src/MetaTrader.obj

error: command 'cl.exe' failed: No such file or directory

----------------------------------------

ERROR: Command errored out with exit status 1: 'c:\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'''C:\Users\\\labor\AppData\\Local\\Temp\pip-install-283aremb\\MetaTrader5\\setup.py'''; __file__=''''C:\Users\\labor\\AppData\Local\\Temp\pip-install-283aremb\MetaTrader5\\setup.py''';f=getattr(tokenize, ''''open''', open)(__file__);code=f.read().replace(''''\r\n''', '''''\n''');f.close();exec(compile(code, __file__, '''exec'''))' install --record 'C:\Users\labor\AppData\Local\Temp\pip-record-t10_91ai\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.


Here is the report in Python 3.7.2

Created a project in JreBrains IDE under Python 3.7.2. Loaded the test file metatrader5-test.py and got the same result:

C:\Users\labor\Anaconda3\envs\metatrader5\python.exe C:/Users/labor/Downloads/MetaTrader5-Python/metatrader5-test.py

Traceback (most recent call last):

File "C:/Users/labor/Downloads/MetaTrader5-Python/metatrader5-test.py", line 10, in <module>

ticks1 = MT5CopyTicksFrom('EURAUD', datetime(2019,1,28,13), 10000, MT5_COPY_TICKS_ALL)

[2, 'Exness-MT5Real', '0000000'] # zeros close the real code

RuntimeError: IPC call failed

[500, 2174, '11 Oct 2019']

Process finished with exit code 1


Note: localhost in Options -> Expert Advisers added. Does not work.

 
capissimo:

Stumbles on :

ticks1= MT5CopyTicksFrom("EURAUD", datetime(2019,1,28,13),10000, MT5_COPY_TICKS_ALL)

...

RuntimeError: IPC call failed


Path to the terminal is through r (raw). The terminal itself is detected, of course.

When this happens is the terminal working, i.e. it is not frozen (e.g. the menu is working)?
 
capissimo:

Here is the report in Python 3.8


C:\Users\labor>pip install MetaTrader5

Collecting MetaTrader5

Using cached https://files.pythonhosted.org/packages/3c/c8/713f1b8283cbbdef30dc9cf50a5d767f9b4a194eb4f886a8e50074b696a1/MetaTrader5-5.0.6.tar.gz

Installing collected packages: MetaTrader5

Running setup.py install for MetaTrader5 ... error

ERROR: Command errored out with exit status 1:

command: 'c:\python38\python.exe' -u -c'import sys, setuptools, tokenize; sys.argv[0] = '"'''C:\Users\\\\labor\\AppData\Local\\\Temp\\pip-install-283aremb\\MetaTrader5\\setup.py'''; __file__=''''C:\Users\\labor\AppData\Local\\Temp\pip-install-283aremb\\\MetaTrader5\\setup.py''';f=getattr(tokenize, ''''open''', open)(__file__);code=f.read().replace(''''\r\n''', '''''\n''');f.close();exec(compile(code, __file__, '''exec''')'' install --record 'C:\Users\labor\AppData\Local\Temp\pip-record-t10_91ai\install-record.txt' --single-version-externally-managed --compile

cwd: C:\Users\labor\AppData\Local\Temp\pip-install-283aremb\MetaTrader5\

Complete output (16 lines):

running install

running build

running build_py

creating build

creating build\lib.win-amd64-3.8

creating build\lib.win-amd64-3.8\MetaTrader5

copying MetaTrader5\__init__.py -> build\lib.win-amd64-3.8\MetaTrader5

running build_ext

building 'MetaTrader5.C' extension

creating build/temp.win-amd64-3.8

creating build/temp.win-amd64-3.8/Release

creating build\temp.win-amd64-3.8\release\src

creating build\temp.win-amd64-3.8\Release\src\Interprocess

creating build\temp.win-amd64-3.8\Release\src\Connector

cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DUNICODE -Isrc -Ic:\python38\include -Ic:\python38\include /EHsc /Tpsrc/MetaTrader.cpp /Fobuild\temp.win-amd64-3.8\Release\src/MetaTrader.obj

error: command 'cl.exe' failed: No such file or directory

----------------------------------------

ERROR: Command errored out with exit status 1: 'c:\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'''C:\Users\\\labor\AppData\\Local\\Temp\pip-install-283aremb\\MetaTrader5\\setup.py'''; __file__=''''C:\Users\\labor\\AppData\Local\\Temp\pip-install-283aremb\MetaTrader5\\setup.py''';f=getattr(tokenize, ''''open''', open)(__file__);code=f.read().replace(''''\r\n''', '''''\n''');f.close();exec(compile(code, __file__, '''exec'''))' install --record 'C:\Users\labor\AppData\Local\Temp\pip-record-t10_91ai\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.


Here is the report in Python 3.7.2

Created a project in JreBrains IDE under Python 3.7.2. Loaded the test file metatrader5-test.py and got the same result:

C:\Users\labor\Anaconda3\envs\metatrader5\python.exe C:/Users/labor/Downloads/MetaTrader5-Python/metatrader5-test.py

Traceback (most recent call last):

File "C:/Users/labor/Downloads/MetaTrader5-Python/metatrader5-test.py", line 10, in <module>

ticks1 = MT5CopyTicksFrom('EURAUD', datetime(2019,1,28,13), 10000, MT5_COPY_TICKS_ALL)

[2, 'Exness-MT5Real', '0000000'] # zeros close the real code

RuntimeError: IPC call failed

[500, 2174, '11 Oct 2019']

Process finished with exit code 1


Note: localhost in Options -> Expert Advisers added. Does not work.

In first case I think I need some compiler to build the package. Mb the developers will answer. I have everything working on 3.7

 
Almaz:
When this happens is the terminal working, i.e. it is not frozen (e.g. the menu is working)?
The terminal is working as it should.
 
Maxim Dmitrievsky:

In the first case you need some kind of compiler, I understand, to build the package. Mb the developers will answer. I have everything working on 3.7

And how to scomile it if there is no Git of this package, no sources of it?
 
capissimo:
And how to compile it, if there is no Git of this package, no sources?
It compiles itself when the package is installed on your computer, you need to install some C compiler, like cL.exe as it says in the logs. The process can't find it on you
 
Maxim Dmitrievsky:
It compiles itself when the package is installed on your computer, for this you need to install some cis compiler, e.g. cL.exe as it says in the logs. The process can't find it with you

Downloaded VC_redist.x64.exe. No luck so far and I'm sure I shouldn't be doing this - it's up to the developer, isn't it? At the very least there should be detailed documentation that takes all cases into account. Universum is not that big - only 3 branches of operating systems - Win/Linux/MacOS:

C:\Users\labor>pip install MetaTrader5

Collecting MetaTrader5

Using cached https://files.pythonhosted.org/packages/3c/c8/713f1b8283cbbdef30dc9cf50a5d767f9b4a194eb4f886a8e50074b696a1/MetaTrader5-5.0.6.tar.gz

Installing collected packages: MetaTrader5

Running setup.py install for MetaTrader5 ... error

ERROR: Command errored out with exit status 1:

command: 'c:\python38\python.exe' -u -c'import sys, setuptools, tokenize; sys.argv[0] = '"'''C:\Users\\\\labor\\AppData\Local\\\\Temp\\pip-install-d68bdu0o\\MetaTrader5\\setup.py'"'"'; __file__='"'"'C:\\Users\\labor\\AppData\\Local\\Temp\\pip-install-d68bdu0o\\MetaTrader5\\setup.py''';f=getattr(tokenize, '''''open''', open)(__file__);code=f.read().replace(''''\r\n''', '''''\n''');f.close();exec(compile(code, __file__, '''exec''')'' install --record 'C:\Users\labor\AppData\Local\Temp\pip-record-mt16672p\install-record.txt' --single-version-externally-managed --compile

cwd: C:\Users\labor\AppData\Local\Temp\pip-install-d68bdu0o\MetaTrader5\

Complete output (16 lines):

running install

running build

running build_py

creating build

creating build\lib.win-amd64-3.8

creating build\lib.win-amd64-3.8\MetaTrader5

copying MetaTrader5\__init__.py -> build\lib.win-amd64-3.8\MetaTrader5

running build_ext

building 'MetaTrader5.C' extension

creating build/temp.win-amd64-3.8

creating build/temp.win-amd64-3.8/Release

creating build\temp.win-amd64-3.8\release\src

creating build\temp.win-amd64-3.8\Release\src\Interprocess

creating build\temp.win-amd64-3.8\Release\src\Connector

cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DUNICODE -Isrc -Ic:\python38\include -Ic:\python38\include /EHsc /Tpsrc/MetaTrader.cpp /Fobuild\temp.win-amd64-3.8\Release\src/MetaTrader.obj

error: command 'cl.exe' failed: No such file or directory

----------------------------------------

ERROR: Command errored out with exit status 1: 'c:\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'''C:\Users\\\labor\\AppData\\Local\\Temp\pip-install-d68bdu0o\\\MetaTrader5\\setup.py'''; __file__=''''C:\Users\\labor\\AppData\Local\\Temp\pip-install-d68bdu0o\MetaTrader5\\setup.py''';f=getattr(tokenize, '''''open''', open)(__file__);code=f.read().replace(''''\r\n''', '''''\n''');f.close();exec(compile(code, __file__, '''exec''')'' install --record 'C:\Users\labor\AppData\Local\Temp\pip-record-mt16672p\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.


 
capissimo:

Downloaded VC_redist.x64.exe. No luck so far and I'm sure I shouldn't be doing this - it's up to the developer, isn't it?

C:\Users\labor>pip install MetaTrader5

Collecting MetaTrader5

Using cached https://files.pythonhosted.org/packages/3c/c8/713f1b8283cbbdef30dc9cf50a5d767f9b4a194eb4f886a8e50074b696a1/MetaTrader5-5.0.6.tar.gz

Installing collected packages: MetaTrader5

Running setup.py install for MetaTrader5 ... error

ERROR: Command errored out with exit status 1:

command: 'c:\python38\python.exe' -u -c'import sys, setuptools, tokenize; sys.argv[0] = '"'''C:\Users\\\\labor\\AppData\Local\\\\Temp\\pip-install-d68bdu0o\\MetaTrader5\\setup.py"''; __file__="""C:\Users\\labor\AppData\Local\\Temp\pip-install-d68bdu0o\\MetaTrader5\\\setup.py''';f=getattr(tokenize, '''''open''', open)(__file__);code=f.read().replace(''''\r\n''', '''''\n''');f.close();exec(compile(code, __file__, '''exec''')'' install --record 'C:\Users\labor\AppData\Local\Temp\pip-record-mt16672p\install-record.txt' --single-version-externally-managed --compile

cwd: C:\Users\labor\AppData\Local\Temp\pip-install-d68bdu0o\MetaTrader5\

Complete output (16 lines):

running install

running build

running build_py

creating build

creating build\lib.win-amd64-3.8

creating build\lib.win-amd64-3.8\MetaTrader5

copying MetaTrader5\__init__.py -> build\lib.win-amd64-3.8\MetaTrader5

running build_ext

building 'MetaTrader5.C' extension

creating build/temp.win-amd64-3.8

creating build/temp.win-amd64-3.8/Release

creating build\temp.win-amd64-3.8\release\src

creating build\temp.win-amd64-3.8\Release\src\Interprocess

creating build\temp.win-amd64-3.8\Release\src\Connector

cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DUNICODE -Isrc -Ic:\python38\include -Ic:\python38\include /EHsc /Tpsrc/MetaTrader.cpp /Fobuild\temp.win-amd64-3.8\Release\src/MetaTrader.obj

error: command 'cl.exe' failed: No such file or directory

----------------------------------------

ERROR: Command errored out with exit status 1: 'c:\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'''C:\Users\\\labor\AppData\\Local\\Temp\pip-install-d68bdu0o\\\MetaTrader5\\setup.py'''; __file__=''''C:\Users\labor\\\AppData\Local\\Temp\pip-install-d68bdu0o\MetaTrader5\\setup.py''';f=getattr(tokenize, '''''open''', open)(__file__);code=f.read().replace(''''\r\n''', '''''\n''');f.close();exec(compile(code, __file__, '''exec'''))' install --record 'C:\Users\labor\AppData\Local\Temp\pip-record-mt16672p\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.


I think that's what Microsoft build tools were missing, that's what they write:

https://stackoverflow.com/questions/41724445/python-pip-on-windows-command-cl-exe-failed

i.e. add cl.exe to the PATH, or open a command line from the folder where it is installed and pip install metatrader5 from there

the developers don't have to, the system just doesn't see the compiler

python pip on Windows - command 'cl.exe' failed
python pip on Windows - command 'cl.exe' failed
  • 2017.01.18
  • ashishsingalashishsingal 92422 gold badges99 silver badges2323 bronze badges
  • stackoverflow.com
I'm trying to install spaCy using but I'm getting the following error .. I have VS 2015 installed, and I have the following Python install .. I tried the following SO solutions to no avail .. As...
 
Maxim Dmitrievsky:

Microsoft build tools seemed to be exactly what was missing, this is what they say:

https://stackoverflow.com/questions/41724445/python-pip-on-windows-command-cl-exe-failed

i.e. add cl.exe to the PATH, or open a command line from the folder where it is installed, and pip install metatrader5 from there

The developers don't have to, the system just doesn't see the compiler.

At least there should be detailed documentation that takes all cases into account. Universum is not that big - only 3 branches of operating systems - Win/Linux/MacOS.

Installed Microsoft build tools from https://visualstudio.microsoft.com/ru/downloads/?rr=https%3A%2F%2Fwww.google.com%2F. The package is now installed in Python 3.8. This problem is SOLVED.

C:\Users\labor>pip install MetaTrader5

Collecting MetaTrader5

Using cached https://files.pythonhosted.org/packages/3c/c8/713f1b8283cbbdef30dc9cf50a5d767f9b4a194eb4f886a8e50074b696a1/MetaTrader5-5.0.6.tar.gz

Installing collected packages: MetaTrader5

Running setup.py install for MetaTrader5 ... done

Successfully installed MetaTrader5-5.0.6


BUT! RuntimeError: IPC call failed:

C:\Users\labor>C:\Users\labor\Anaconda3\envs\metatrader5\python.exe C:/Users/labor/Downloads/MetaTrader5-Python/metatrader5-test.py

[2, 'Exness-MT5Real', '0000000'] # code is zeroed in the printout

[500, 2174, '11 Oct 2019']

Traceback (most recent call last):

File "C:/Users/labor/Downloads/MetaTrader5-Python/metatrader5-test.py", line 10, in <module>

ticks1 = MT5CopyTicksFrom("EURAUD", datetime(2019,1,28,13), 10000, MT5_COPY_TICKS_ALL)

RuntimeError: IPC call failed

Скачиваемые файлы | IDE, Code и Team Foundation Server | Visual Studio
Скачиваемые файлы | IDE, Code и Team Foundation Server | Visual Studio
  • 2019.08.29
  • visualstudio.microsoft.com
Интегрированное комплексное решение для разработчиков, обеспечивающее высокую производительность и удобную координацию между командами любых размеров. Дополнительные сведения см. в Заметках о выпуске. Повышайте производительность с помощью профессиональных инструментов разработки и служб, предназначенных для создания приложений для любой...