Closed joanba68 closed 11 months ago
It fails because pyrfc version 2.8.2 cached source is fetched for some reason and that old version can't be built with newer Cython
Using cached https://files.pythonhosted.org/packages/c2/3f/282b01c8a76da8610b76209ffd825ce999797b7aef2974acbb55ad43ab1d/pyrfc-2.8.2.tar.gz
Which python version is used to run the pyrfc install command? You can try to fix pyrfc version 3.3 in pip install but it should work without it.
Can you also install pyrfc in user space, not root?
Hi,
I'm able to fix the installation but still not able to use pyrfc. I'm not sure why we get the files from old version as I've no access to check it. What I've done to install is to simply download the .zip package from this site (PyRFC-main.zip) and unzip in server. From here, just to set the envvar SAPNWRFC_HOME and install:
[root@useazsbxss199 sap_installers]# cd PyRFC-main/
[root@useazsbxss199 PyRFC-main]# pip3 install .
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Processing /tmp/sap_installers/PyRFC-main
Installing collected packages: pyrfc
Running setup.py install for pyrfc ... done
Successfully installed pyrfc-0.0.0
[root@useazsbxss199 PyRFC-main]#
still done as root, we will change it later when fix errors. Why it's showing v0.0.0 ?
Now error is different:
[cofcoadm@useazsbxss199 ~]$ python3
Python 3.6.8 (default, Jun 14 2022, 12:54:58)
[GCC 8.5.0 20210514 (Red Hat 8.5.0-10)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyrfc import *
>>> from pyrfc import Connection
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'Connection'
>>>
Python 3.6 is not supported PyRFC, see: https://pypi.org/project/pyrfc/
Many Linux systems still use older pre-installed system Python and virtual environment installation is therefore recommended, using pyenv for example. It provides supported Python and avoids running applications as root.
I need to investigate why the installation as you described did not fail with unsupported Python.
I've uninstalled python v3.6 ( from our OS image ) and installed v3.9.7. Now I've an error during installation again:
[root@useazsbxss199 sap_installers]# pip3 install pyrfc --user
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting pyrfc
Downloading pyrfc-3.3.tar.gz (352 kB)
|████████████████████████████████| 352 kB 579 kB/s
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Building wheels for collected packages: pyrfc
Building wheel for pyrfc (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3.9 /usr/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpuc_5ewsl
cwd: /tmp/pip-install-mr87mwzt/pyrfc
Complete output (17 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-39
creating build/lib.linux-x86_64-cpython-39/pyrfc
copying src/pyrfc/__init__.py -> build/lib.linux-x86_64-cpython-39/pyrfc
copying src/pyrfc/_exception.py -> build/lib.linux-x86_64-cpython-39/pyrfc
copying src/pyrfc/_utils.py -> build/lib.linux-x86_64-cpython-39/pyrfc
running build_ext
building 'pyrfc._cyrfc' extension
creating build/temp.linux-x86_64-cpython-39
creating build/temp.linux-x86_64-cpython-39/src
creating build/temp.linux-x86_64-cpython-39/src/pyrfc
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DNDEBUG -D_LARGEFILE_SOURCE -D_CONSOLE -D_FILE_OFFSET_BITS=64 -DSAPonUNIX -DSAPwithUNICODE -DSAPwithTHREADS -DSAPonLIN -I/usr/include/python3.9 -c src/pyrfc/_cyrfc.cpp -o build/temp.linux-x86_64-cpython-39/src/pyrfc/_cyrfc.o -Wall -O2 -fexceptions -funsigned-char -fno-strict-aliasing -Wall -Wno-uninitialized -Wno-deprecated-declarations -Wno-unused-function -Wcast-align -fPIC -pthread -minline-all-stringops -I/tmp/sap_installers/nwrfcsdk/include
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
error: command '/bin/gcc' failed with exit code 1
----------------------------------------
ERROR: Failed building wheel for pyrfc
Failed to build pyrfc
ERROR: Could not build wheels for pyrfc which use PEP 517 and cannot be installed directly
[root@useazsbxss199 sap_installers]#
We're advancing and getting new errors, previous one was probably because an old pip3 version. Upgraded with:
pip3 install --upgrade pip
Now error has changed:
[root@useazsbxss199 sap_installers]# pip3 install pyrfc --user
Collecting pyrfc
Using cached pyrfc-3.3.tar.gz (352 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pyrfc
Building wheel for pyrfc (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for pyrfc (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [17 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-39
creating build/lib.linux-x86_64-cpython-39/pyrfc
copying src/pyrfc/__init__.py -> build/lib.linux-x86_64-cpython-39/pyrfc
copying src/pyrfc/_exception.py -> build/lib.linux-x86_64-cpython-39/pyrfc
copying src/pyrfc/_utils.py -> build/lib.linux-x86_64-cpython-39/pyrfc
running build_ext
building 'pyrfc._cyrfc' extension
creating build/temp.linux-x86_64-cpython-39
creating build/temp.linux-x86_64-cpython-39/src
creating build/temp.linux-x86_64-cpython-39/src/pyrfc
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DNDEBUG -D_LARGEFILE_SOURCE -D_CONSOLE -D_FILE_OFFSET_BITS=64 -DSAPonUNIX -DSAPwithUNICODE -DSAPwithTHREADS -DSAPonLIN -I/usr/include/python3.9 -c src/pyrfc/_cyrfc.cpp -o build/temp.linux-x86_64-cpython-39/src/pyrfc/_cyrfc.o -Wall -O2 -fexceptions -funsigned-char -fno-strict-aliasing -Wall -Wno-uninitialized -Wno-deprecated-declarations -Wno-unused-function -Wcast-align -fPIC -pthread -minline-all-stringops -I/tmp/sap_installers/nwrfcsdk/include
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
error: command '/bin/gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pyrfc
Failed to build pyrfc
ERROR: Could not build wheels for pyrfc, which is required to install pyproject.toml-based projects
Something is apparently wrong with C++ development toolchain on your system. Cython transforms the Cython source to C++ and C++ compiler required to build.
error: command '/bin/gcc' failed with exit code 1
Perhaps this helps: https://access.redhat.com/solutions/1137503 but I have no access.
Here how the toolchain is installed on Ubuntu system, used in PyRFC testing: https://github.com/SAP/fundamental-tools/blob/main/docker/ubuntu-qa.Dockerfile#L22
Finally got installed pyrfc 3.3.
dnf install gcc-c++
# python v3.9.7 installed
dnf install python39-devel
[root@useazsbxss199 sap_installers]# pip3 install --upgrade pip
(...)
Successfully installed pip-23.2.1
and finally got a successful installation of pyrfc:
[root@useazsbxss199 sap_installers]# pip3 install pyrfc --user
Collecting pyrfc
Using cached pyrfc-3.3.tar.gz (352 kB)
(...)
Successfully installed pyrfc-3.3
Unfortunately we still not have a working pyrfc:
[root@useazsbxss199 sap_installers]# python
Python 3.9.7 (default, Jun 14 2023, 09:39:13)
[GCC 8.5.0 20210514 (Red Hat 8.5.0-10)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyrfc import Connection
libsapnwrfc.so: cannot open shared object file: No such file or directory
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'Connection' from 'pyrfc' (/root/.local/lib/python3.9/site-packages/pyrfc/__init__.py)
>>>
Moving to a user, we've repeated pyrfc installation and finally have it working but adding a new env variable: LD_LIBRARY_PATH
[cofcoadm@useazsbxss199 ~]$ export LD_LIBRARY_PATH=/tmp/sap_installers/nwrfcsdk/lib
[cofcoadm@useazsbxss199 ~]$ python
Python 3.9.7 (default, Jun 14 2023, 09:39:13)
[GCC 8.5.0 20210514 (Red Hat 8.5.0-10)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyrfc import Connection
>>>
So at this point I understand we have pyrfc properly installed, but still failing in ansible task. But that's subject of another repo.
Thanks !!
Added the note IN README about Linux https://github.com/SAP/PyRFC#linux, to help other users with similar issues
We've installed NW RFC SDK v7.50 PL 12 in our server running RHEL v8.6. As root we set en environment:
export SAPNWRFC_HOME=/tmp/sap_installers/nwrfcsdk
and run the installation:
pip3 install pyrfc
but fails immediately:
Any idea ?