SAP / PyRFC

Asynchronous, non-blocking SAP NW RFC SDK bindings for Python
http://sap.github.io/PyRFC
Apache License 2.0
511 stars 139 forks source link

Failure in installing pyrfc in windows #242

Closed raviteja-oops closed 3 years ago

raviteja-oops commented 3 years ago

Hi, I'm trying to install pyrfc in windows - 10 VM x64 64-bit.

The pre-requisites I already installed i.e., visual studio and SAPNWRFC SDK. But while building pyrfc wheel I'm getting below error. Can you please help me on this to fix.

C:\PyRFC>python setup.py bdist_wheel 750 Patch Level 8 running bdist_wheel running build running build_py running build_ext skipping 'src/pyrfc_pyrfc.cpp' Cython extension (up-to-date) building 'pyrfc.pyrfc' extension C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -DSAPonNT -D_CRT_NON_CONFORMING_SWPRINTFS -D_CRT_SECURE_NO_DEPRECATES -D_CRT_NONSTDC_NO_DEPRECATE -D_AFXDLL -DWIN32 -D_WIN32_WINNT=0x0502 -DWIN64 -DAMD64 -DNDEBUG -DSAPwithUNICODE -DUNICODE -D_UNICODE -DSAPwithTHREADS -D_ATL_ALLOW_CHAR_UNSIGNED -D_LARGEFILE_SOURCE -D_CONSOLE -DSAP_PLATFORM_MAKENAME=ntintel "-IC:\Program Files (x86)\Python37-32\include" "-IC:\Program Files (x86)\Python37-32\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /EHsc /Tpsrc/pyrfc_pyrfc.cpp /Fobuild\temp.win32-3.7\Release\src/pyrfc_pyrfc.obj -IC:\nwrfcsdk\include -IC:\Python\Python37\Include -IC:\Python\Python37\Include\PC /EHs /Gy /J /MD /nologo /W3 /Z7 /GL /O2 /Oy- /we4552 /we4700 /we4789 cl : Command line warning D9025 : overriding '/MT' with '/MD' _pyrfc.cpp src/pyrfc_pyrfc.cpp(21148): error C2664: 'RFC_RC RfcInstallGenericServerFunction(RFC_SERVER_FUNCTION,RFC_FUNC_DESC_CALLBACK,RFC_ERROR_INFO )': cannot convert argument 1 from 'RFC_RC (__cdecl )(RFC_CONNECTION_HANDLE,RFC_FUNCTION_HANDLE,RFC_ERROR_INFO *)' to 'RFC_SERVER_FUNCTION' src/pyrfc_pyrfc.cpp(21148): note: None of the functions with this name in scope match the target type C:\nwrfcsdk\include\sapnwrfc.h(2266): note: see declaration of 'RfcInstallGenericServerFunction' src/pyrfc_pyrfc.cpp(29685): warning C4018: '<': signed/unsigned mismatch error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\cl.exe' failed with exit status 2

bsrdjan commented 3 years ago

Which Python version and which pyrfc version are you using?

I could not reproduce with the current pyrfc and Python 3.7.6:

PS C:\src\test\pyrfc> python -V
Python 3.7.6
PS C:\src\test> git clone https://github.com/sap/pyrfc.git
Cloning into 'pyrfc'...
remote: Enumerating objects: 2478, done.
remote: Counting objects: 100% (587/587), done.
remote: Compressing objects: 100% (346/346), done.
Receiving objects: 100% (2478/2478), 34.31 MiB | 8.38 MiB/s, done.d 1891 eceiving objects: 100% (2478/2478), 33.40 MiB | 8.34 MiB/s

Resolving deltas: 100% (1340/1340), done.
PS C:\src\test> cd pyrfc
PS C:\src\test\pyrfc> python setup.py bdist_wheel  
750 Patch Level 8
running bdist_wheel
running build   
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\pyrfc
copying src\pyrfc\_exception.py -> build\lib.win-amd64-3.7\pyrfc
copying src\pyrfc\__init__.py -> build\lib.win-amd64-3.7\pyrfc  
running build_ext
building 'pyrfc.pyrfc' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\src
creating build\temp.win-amd64-3.7\Release\src\pyrfc
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DSAPonNT -D_CRT_NON_CONFORMING_SWPRINTFS -D_CRT_SECURE_NO_DEPRECATES -D_CRT_NONSTDC_NO_DEPRECATE -D_AFXDLL -DWIN32 -D_WIN32_WINNT=0x0502 
-DWIN64 -D_AMD64_ -DNDEBUG -DSAPwithUNICODE -DUNICODE -D_UNICODE -DSAPwithTHREADS -D_ATL_ALLOW_CHAR_UNSIGNED -D_LARGEFILE_SOURCE -D_CONSOLE -DSAP_PLATFORM_MAKENAME=ntintel -IC:\Tools\Pythons\3.7.6\include -IC:\Tools\Pythons\3.7.6\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /EHsc /Tpsrc/pyrfc/_pyrfc.cpp /Fobuild\temp.win-amd64-3.7\Release\src/pyrfc/_pyrfc.obj -IC:\Tools\nwrfcsdk\include -IC:\Tools\Pythons\3.7.6\lib\inspect.py\Include -IC:\Tools\Pythons\3.7.6\lib\inspect.py\Include\PC /EHs /Gy /J /MD /nologo /W3 /Z7 /GL /O2 /Oy- /we4552 /we4700 /we4789
_pyrfc.cpp
src/pyrfc/_pyrfc.cpp(4021): warning C4244: '=': conversion from 'Py_ssize_t' to 'unsigned int', possible loss of data
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Tools\Pythons\3.7.6\libs /LIBPATH:C:\Tools\Pythons\3.7.6\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64" sapnwrfc.lib libsapucum.lib /EXPORT:PyInit_pyrfc build\temp.win-amd64-3.7\Release\src/pyrfc/_pyrfc.obj /OUT:build\lib.win-amd64-3.7\pyrfc\pyrfc.cp37-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.7\Release\src/pyrfc\pyrfc.cp37-win_amd64.lib -LIBPATH:C:\Tools\nwrfcsdk\lib -LIBPATH:C:\Tools\Pythons\3.7.6\lib\inspect.py\PCbuild /NXCOMPAT /STACK:0x2000000 /SWAPRUN:NET /DEBUG /OPT:REF /DEBUGTYPE:CV,FIXUP /MACHINE:amd64 /nologo /LTCG
   Creating library build\temp.win-amd64-3.7\Release\src/pyrfc\pyrfc.cp37-win_amd64.lib and object build\temp.win-amd64-3.7\Release\src/pyrfc\pyrfc.cp37-win_amd64.exp
Generating code
Finished generating code
installing to build\bdist.win-amd64\wheel
running install
running install_lib
creating build\bdist.win-amd64
creating build\bdist.win-amd64\wheel
creating build\bdist.win-amd64\wheel\pyrfc
copying build\lib.win-amd64-3.7\pyrfc\pyrfc.cp37-win_amd64.pdb -> build\bdist.win-amd64\wheel\.\pyrfc
copying build\lib.win-amd64-3.7\pyrfc\pyrfc.cp37-win_amd64.pyd -> build\bdist.win-amd64\wheel\.\pyrfc
copying build\lib.win-amd64-3.7\pyrfc\_exception.py -> build\bdist.win-amd64\wheel\.\pyrfc
copying build\lib.win-amd64-3.7\pyrfc\__init__.py -> build\bdist.win-amd64\wheel\.\pyrfc
running install_egg_info
running egg_info
creating src\pyrfc.egg-info
writing src\pyrfc.egg-info\PKG-INFO
writing dependency_links to src\pyrfc.egg-info\dependency_links.txt
writing requirements to src\pyrfc.egg-info\requires.txt
writing top-level names to src\pyrfc.egg-info\top_level.txt
writing manifest file 'src\pyrfc.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*' found under directory 'material'
warning: no previously-included files found matching 'PyRFC.code-workspace'
writing manifest file 'src\pyrfc.egg-info\SOURCES.txt'
Copying src\pyrfc.egg-info to build\bdist.win-amd64\wheel\.\pyrfc-2.4.2-py3.7.egg-info
running install_scripts
C:\Tools\Pythons\3.7.6\lib\site-packages\wheel\bdist_wheel.py:82: RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
  warn=(impl == 'cp')):
C:\Tools\Pythons\3.7.6\lib\site-packages\wheel\bdist_wheel.py:87: RuntimeWarning: Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may 
be incorrect
  sys.version_info < (3, 8))) \
adding license file "LICENSE" (matched pattern "LICEN[CS]E*")
creating build\bdist.win-amd64\wheel\pyrfc-2.4.2.dist-info\WHEEL
creating 'dist\pyrfc-2.4.2-cp37-cp37m-win_amd64.whl' and adding 'build\bdist.win-amd64\wheel' to it
adding 'pyrfc/__init__.py'
adding 'pyrfc/_exception.py'
adding 'pyrfc/pyrfc.cp37-win_amd64.pdb'
adding 'pyrfc/pyrfc.cp37-win_amd64.pyd'
adding 'pyrfc-2.4.2.dist-info/LICENSE'
adding 'pyrfc-2.4.2.dist-info/METADATA'
adding 'pyrfc-2.4.2.dist-info/WHEEL'
adding 'pyrfc-2.4.2.dist-info/top_level.txt'
adding 'pyrfc-2.4.2.dist-info/RECORD'
removing build\bdist.win-amd64\wheel
PS C:\src\test\pyrfc> 
raviteja-oops commented 3 years ago

Python -- 3.7.4 pyrfc -- 2.4.2

bsrdjan commented 3 years ago

Could you please try if this works on your system and post the full log if there are errors:

git clone https://github.com/sap/pyrfc.git
cd pyrfc
python setup.py bdist_wheel
raviteja-oops commented 3 years ago

C:\PyRfc>git clone https://github.com/sap/pyrfc.git Cloning into 'pyrfc'... fatal: unable to access 'https://github.com/sap/pyrfc.git/': OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443

Getting above error while cloning. So I downloaded the zip file from github directly and unzip in C drive

bsrdjan commented 3 years ago

No idea what might be wrong. I could not reproduce with Python 3.7.4 either.

Perhaps to try on another machine and check if correct SAP NWRFC SDK is installed, like 64 bit Windows version, not 32 bit ?

raviteja-oops commented 3 years ago

okay, Is there any problem with Visual Studio..?? As in error it is showing like below

src/pyrfc_pyrfc.cpp(21148): error C2664: 'RFC_RC RfcInstallGenericServerFunction(RFC_SERVER_FUNCTION,RFC_FUNC_DESC_CALLBACK,RFC_ERROR_INFO )': cannot convert argument 1 from 'RFC_RC (__cdecl )(RFC_CONNECTION_HANDLE,RFC_FUNCTION_HANDLE,RFC_ERROR_INFO *)' to 'RFC_SERVER_FUNCTION' src/pyrfc_pyrfc.cpp(21148): note: None of the functions with this name in scope match the target type C:\nwrfcsdk\include\sapnwrfc.h(2266): note: see declaration of 'RfcInstallGenericServerFunction' src/pyrfc_pyrfc.cpp(29685): warning C4018: '<': signed/unsigned mismatch error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\cl.exe' failed with exit status 2

bsrdjan commented 3 years ago

Yes, it might be an issue with the build toolchain.

Please check if all requirements are met: https://github.com/SAP/PyRFC#windows

raviteja-oops commented 3 years ago

Okay and also do you have any installation steps of SAPNWRFC SDK and pyrfc for Ubuntu 18.04.3..??

bsrdjan commented 3 years ago

Here it is: http://sap.github.io/PyRFC/install.html#linux

You also check installation steps in these docker containers: SAP/fundamental-tools/docker

raviteja-oops commented 3 years ago

Thank you so much...!

And I'm able to install in my windows VM and I wrote some code for connection check. But I'm getting below error. Can you please suggest what is the error exactly is

E:>py sapbw_connectivity.py Config File Path:D:\SAPBW\CONFIG\SAPBW_CONFIG.ini RfcLogWrite: could not open E:\.\dev_rfc_07236.log. Trace directory set to .\Traceback (most recent call last): File "sapbw_connectivity.py", line 79, in src_db = sap_bw.get_sapbw_details(source_host_name, source_user_name, source_password,source_port_num, source_client_id) File "sapbw_connectivity.py", line 34, in get_sapbw_details passwd=m_pass_word) File "src/pyrfc/_pyrfc.pyx", line 260, in pyrfc.pyrfc.Connection.init File "src/pyrfc/_pyrfc.pyx", line 306, in pyrfc.pyrfc.Connection._open File "src/pyrfc/_pyrfc.pyx", line 349, in pyrfc.pyrfc.Connection._error pyrfc._exception.CommunicationError: RFC_COMMUNICATION_FAILURE (rc=1): key=RFC_COMMUNICATION_FAILURE, message= LOCATION CPIC (TCP/IP) on local host INFNWR2CRPADEV1 with Unicode ERROR connection to partner 'sapbiwdev102.isus.emc.com:3317' broken TIME Fri Oct 01 06:00:41 2021 RELEASE 753 COMPONENT NI (network interface) VERSION 40 RC -6 MODULE D:/depot/bas/753_REL/src/krn/si/gw/gwxx.c LINE 1179 DETAIL NiIRead: P=10.196.128.13:3317; L=10.179.194.90:55061 SYSTEM CALL GwRead ERRNO 10054 ERRNO TEXT WSAECONNRESET: Connection reset by peer COUNTER 2 [MSG: class=, type=, number=, v1-4:=;;;]

raviteja-oops commented 3 years ago

Can you please check above error

bsrdjan commented 3 years ago

It looks like a network error. Please check your system connection parameters.

You can also run the niping utility on your Python host, to check the connectivity with ABAP system: https://github.com/SAP/PyRFC/issues/241#issuecomment-931132332

jfilak commented 3 years ago

If you cannot install niping for any reason, you can also try TCP/IP connectivity by the utility telnet which is most probably avialbe on all operating systems.

If I try telnet on a live system with instance (sysnr) 02 with random input, I run the following on command line

telnet XXX.YYY.ZZZ.WWW 3302

and I get:

Trying XXX.YYY.ZZZ.WWW...
Connected to XXX.YYY.ZZZ.WWW.
Escape character is '^]'.

so I type:

HELLO

and the response is

Connection closed by foreign host.

But if I cannot connect to the system becuase of any TCP/IP problems (e.g. I unplug my ethernet cable), telnet hangs with:

Trying XXX.YYY.ZZZ.WWW...
raviteja-oops commented 3 years ago

yes, I'm able to hit the host using telnet. But via python I'm not able to connect over windows VM.

But I'm able to connect via python using my local windows machine

bsrdjan commented 3 years ago

via python I'm not able to connect over windows VM.

My test VMWare VMs work in network shared mode. Perhaps you can try shared and bridged:

Screenshot 2021-10-02 at 11 15 47

?

raviteja-oops commented 3 years ago

Hi, I checked with windows server support team and they said the firewall is blocking the destination port. So, I'm unable to connect via windows VM.

Thank you for the support..