SAP / PyRFC

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

Issue to install on SUSE, Cython not installed #337

Closed dafiahmad123 closed 11 months ago

dafiahmad123 commented 1 year ago

Describe the bug Unable to install on SUSE Linux Enterprise Server 15 SP4. I've checked bug 331 and 332, however, I'm still can't figure out what is the problem.

To Reproduce (TC) [Dev/Test] root@sanbox-machine:~/django/TC # python --version Python 3.8.5

(TC) [Dev/Test] root@sanbox-machine:~/django/TC # pip show cython Name: Cython Version: 3.0.0 Summary: The Cython compiler for writing C extensions in the Python language. Home-page: https://cython.org/ Author: Robert Bradshaw, Stefan Behnel, Dag Seljebotn, Greg Ewing, et al. Author-email: cython-devel@python.org License: Apache-2.0 Location: /root/django/TC/lib/python3.8/site-packages Requires: Required-by:

(TC) [Dev/Test] root@sanbox-machine:~/django/TC # pip install https://github.com/SAP/PyRFC/archive/refs/tags/v3.1.0.tar.gz Collecting https://github.com/SAP/PyRFC/archive/refs/tags/v3.1.0.tar.gz Using cached https://github.com/SAP/PyRFC/archive/refs/tags/v3.1.0.tar.gz Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [1 lines of output] Cython not installed: https://cython.readthedocs.io/en/latest/src/quickstart/install.html [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

bsrdjan commented 1 year ago

Is Cython installed like described in documentation, or perhaps some special way on SUSE ?

pip install Cython

Can you test the output of cython -V and if Cython module imports from setup.py work from command line:

python -c "from Cython.Distutils import build_ext"
python -c "from Cython.Build import cythonize"
dafiahmad123 commented 1 year ago

Thanks for the information. I've run an issue when executing those two python commands. So, I have re-installed everything again from scratch.

python -3.8.5.

Cython==0.29.28 pyrfc==2.5.0 pip==22.2.2

It is working now.

Anyway, do we have general information about compatibility of these packages. Or is it generally work for all version without any dependency,

bsrdjan commented 1 year ago

Hello @dafiahmad123,

supported Python and Cython versions are defined in pyproject.toml and there are no other dependencies among them.

Cython is required on Linux systems because the build from source is recommended way of Python C++ extensions installation on Linux. It is not required on Mac or Windows because pre-built PyRFC binaries are fetched from pip in that case.

Linux systems usually come up with older Python version pre-installed and Python virtual environment like pyenv is recommended to PyRFC and other packages, with newer Python version.

PyRFC 2.5 is older version which works with older SAP NW RFC SDK binaries. Can you upgrade to current PyRFC and SAP NW RFC SDK version ? SAP NW RFC SDK is backwards compatible and only the latest version is supported, this in case of issues with pyrfc 2.5 low chances to get help.

Regards, Srdjan

dafiahmad123 commented 1 year ago

I'm getting an error when installing the latest pyrfc on the same server - "Cython not installed" FYI, I'm using virtualenv

root@sandbox:/usr/local/sap/nwrfcsdk/bin # ./startrfc -v NW RFC Library Version: 750 Patch Level 12 Compiler Version: 4.8.5 Startrfc Version: 2018-08-15

root@sandbox:/django/pyrfc32 # virtualenv . -p /usr/local/bin/python3 created virtual environment CPython3.8.5.final.0-64 in 463ms creator CPython3Posix(dest=/django/pyrfc32, clear=False, no_vcs_ignore=False, global=False) seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/root/.local/share/virtualenv) added seed packages: pip==23.2.1, setuptools==68.1.2, wheel==0.41.2 activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator root@sandbox:/django/pyrfc32 # source bin/activate (pyrfc32) root@sandbox:/django/pyrfc32 # pip install Cython==3.0.0 Collecting Cython==3.0.0 Obtaining dependency information for Cython==3.0.0 from https://files.pythonhosted.org/packages/d1/06/54c30ddfc9268fae14bd8c0755155680f62db89c7d67d7740d8f811f65b0/Cython-3.0.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata Downloading Cython-3.0.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.1 kB) Using cached Cython-3.0.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.6 MB) Installing collected packages: Cython Successfully installed Cython-3.0.0 (pyrfc32) root@sandbox:/django/pyrfc32 # pip install pyrfc==3.2 Collecting pyrfc==3.2 Using cached pyrfc-3.2.tar.gz (350 kB) Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [1 lines of output] Cython not installed: https://cython.readthedocs.io/en/latest/src/quickstart/install.html [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip. (pyrfc32) root@sandbox:/django/pyrfc32 #

bsrdjan commented 1 year ago

No need to fix Cython version, just install the latest one in virtual env:

pip install Cython

After Cython installed in virtual environment, what is the output of

cython -V
python -c "from Cython.Distutils import build_ext"
python -c "from Cython.Build import cythonize"
dafiahmad123 commented 12 months ago

Here is the output for Cython output. I still got the same error when i tried to install pyrfc.

(pyrfc32) [Dev/Test] root@sandbox:/django/pyrfc32 # pip install Cython Requirement already satisfied: Cython in ./lib/python3.8/site-packages (3.0.0) WARNING: There was an error checking the latest version of pip.

(pyrfc32) [Dev/Test] root@sandbox:/django/pyrfc32 # cython -V Cython version 3.0.0 (pyrfc32) [Dev/Test] root@sandbox:/django/pyrfc32 # python -c "from Cython.Distutils import build_ext" (pyrfc32) [Dev/Test] root@sandbox:/django/pyrfc32 # python -c "from Cython.Build import cythonize" (pyrfc32) [Dev/Test] root@sandbox:/django/pyrfc32 #

bsrdjan commented 12 months ago

which error occurs now when you run pip install pyrfc from virtualenv?

dafiahmad123 commented 12 months ago

I can't install the latest pyrfc package (or any other higher than 2.5.0). It still saying Cython not installed. FYI, no issue with version 2.5.0

(pyrfc32) [Dev/Test] root@sandbox:/django/pyrfc32 # pip install pyrfc Collecting pyrfc Using cached pyrfc-3.3.tar.gz (352 kB) Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [1 lines of output] Cython not installed: https://cython.readthedocs.io/en/latest/src/quickstart/install.html [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip. WARNING: There was an error checking the latest version of pip.

(pyrfc32) [Dev/Test] root@sandbox:/django/pyrfc32 # pip install pyrfc==2.5.0 Collecting pyrfc==2.5.0 Using cached pyrfc-2.5.0-cp38-cp38-linux_x86_64.whl Requirement already satisfied: setuptools in ./lib/python3.8/site-packages (from pyrfc==2.5.0) (68.1.2) Installing collected packages: pyrfc Successfully installed pyrfc-2.5.0 WARNING: There was an error checking the latest version of pip. (pyrfc32) [Dev/Test] root@sandbox:/django/pyrfc32 #

bsrdjan commented 12 months ago

Could you please totally remove pyrfc package from site by

rn -rf /lib/python3.8/site-packages/pyrfc*

and in Python 3 virtual environment install wheel and build

pip install wheel build

Then run pip install pyrfc in virtual env in verbose mode and post the installation log

pip install pyrfc --verbose

If it does not help, I can only check in your system. For that I need customer message on BC-MID-RFC SDK component, with reference to this issue

bsrdjan commented 12 months ago

I could not reproduce on SuSE server, the issue is not related to PyRFC. Please check or re-create your Python environment on SuSE.

I installed pyenv, pyenv-virtualenv plugin and created virtualenv py3.11.4 for Python 3.11.4.

$ (py3.11.4) www-admin@coevi29:~> cat /etc/os-release
NAME="SLES"
VERSION="15-SP5"
VERSION_ID="15.5"
PRETTY_NAME="SUSE Linux Enterprise Server 15 SP5"
ID="sles"
ID_LIKE="suse"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:15:sp5"
DOCUMENTATION_URL="https://documentation.suse.com/"

export SAPNWRFC_HOME=/usr/local/sap/nwrfcsdk
export LD_LIBRARY_PATH=$SAPNWRFC_HOME/lib

(py3.11.4) www-admin@coevi29:~> pip install --verbose pyrfc
WARNING: The directory '/home/www-admin/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
Using pip 23.3 from /home/www-admin/.pyenv/versions/3.11.4/envs/py3.11.4/lib/python3.11/site-packages/pip (python 3.11)
Collecting pyrfc
  Downloading pyrfc-3.3.tar.gz (352 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 352.6/352.6 kB 31.7 MB/s eta 0:00:00
  Running command pip subprocess to install build dependencies
  WARNING: The directory '/home/www-admin/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
  Collecting Cython>=3.0.0
    Downloading Cython-3.0.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.2 kB)
  Collecting setuptools>=67
    Downloading setuptools-68.2.2-py3-none-any.whl.metadata (6.3 kB)
  Collecting wheel>=0.40
    Downloading wheel-0.41.2-py3-none-any.whl.metadata (2.2 kB)
  Downloading Cython-3.0.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.6/3.6 MB 102.2 MB/s eta 0:00:00
  Downloading setuptools-68.2.2-py3-none-any.whl (807 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 807.9/807.9 kB 366.9 MB/s eta 0:00:00
  Downloading wheel-0.41.2-py3-none-any.whl (64 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 64.8/64.8 kB 292.4 MB/s eta 0:00:00
  Installing collected packages: wheel, setuptools, Cython
  Successfully installed Cython-3.0.4 setuptools-68.2.2 wheel-0.41.2
  Installing build dependencies ... done
  Running command Getting requirements to build wheel
  performance hint: src/pyrfc/_cyrfc.pyx:1539:5: Exception check on 'metadataLookup' will always require the GIL to be acquired. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  performance hint: src/pyrfc/_cyrfc.pyx:1572:5: Exception check on 'genericHandler' will always require the GIL to be acquired. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  Compiling src/pyrfc/_cyrfc.pyx because it changed.
  [1/1] Cythonizing src/pyrfc/_cyrfc.pyx
  running egg_info
  writing src/pyrfc.egg-info/PKG-INFO
  writing dependency_links to src/pyrfc.egg-info/dependency_links.txt
  writing top-level names to src/pyrfc.egg-info/top_level.txt
  reading manifest file 'src/pyrfc.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no previously-included files matching '*' found under directory 'tests'
  adding license file 'LICENSES/Apache-2.0.txt'
  writing manifest file 'src/pyrfc.egg-info/SOURCES.txt'
  Getting requirements to build wheel ... done
  Running command Preparing metadata (pyproject.toml)
  running dist_info
  creating /tmp/pip-modern-metadata-uu7jvbi8/pyrfc.egg-info
  writing /tmp/pip-modern-metadata-uu7jvbi8/pyrfc.egg-info/PKG-INFO
  writing dependency_links to /tmp/pip-modern-metadata-uu7jvbi8/pyrfc.egg-info/dependency_links.txt
  writing top-level names to /tmp/pip-modern-metadata-uu7jvbi8/pyrfc.egg-info/top_level.txt
  writing manifest file '/tmp/pip-modern-metadata-uu7jvbi8/pyrfc.egg-info/SOURCES.txt'
  reading manifest file '/tmp/pip-modern-metadata-uu7jvbi8/pyrfc.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no previously-included files matching '*' found under directory 'tests'
  adding license file 'LICENSES/Apache-2.0.txt'
  writing manifest file '/tmp/pip-modern-metadata-uu7jvbi8/pyrfc.egg-info/SOURCES.txt'
  creating '/tmp/pip-modern-metadata-uu7jvbi8/pyrfc-3.3.dist-info'
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pyrfc
  Running command Building wheel for pyrfc (pyproject.toml)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-cpython-311
  creating build/lib.linux-x86_64-cpython-311/pyrfc
  copying src/pyrfc/__init__.py -> build/lib.linux-x86_64-cpython-311/pyrfc
  copying src/pyrfc/_exception.py -> build/lib.linux-x86_64-cpython-311/pyrfc
  copying src/pyrfc/_utils.py -> build/lib.linux-x86_64-cpython-311/pyrfc
  running build_ext
  building 'pyrfc._cyrfc' extension
  creating build/temp.linux-x86_64-cpython-311
  creating build/temp.linux-x86_64-cpython-311/src
  creating build/temp.linux-x86_64-cpython-311/src/pyrfc
  gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DNDEBUG -D_LARGEFILE_SOURCE -D_CONSOLE -D_FILE_OFFSET_BITS=64 -DSAPonUNIX -DSAPwithUNICODE -DSAPwithTHREADS -DSAPonLIN -I/home/www-admin/.pyenv/versions/3.11.4/envs/py3.11.4/include -I/home/www-admin/.pyenv/versions/3.11.4/include/python3.11 -c src/pyrfc/_cyrfc.cpp -o build/temp.linux-x86_64-cpython-311/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/usr/local/sap/nwrfcsdk/include
  g++ -pthread -shared -L/home/www-admin/.pyenv/versions/3.11.4/lib -Wl,-rpath,/home/www-admin/.pyenv/versions/3.11.4/lib -L/home/www-admin/.pyenv/versions/3.11.4/lib -Wl,-rpath,/home/www-admin/.pyenv/versions/3.11.4/lib build/temp.linux-x86_64-cpython-311/src/pyrfc/_cyrfc.o -L/home/www-admin/.pyenv/versions/3.11.4/lib -lsapnwrfc -lsapucum -o build/lib.linux-x86_64-cpython-311/pyrfc/_cyrfc.cpython-311-x86_64-linux-gnu.so -L/usr/local/sap/nwrfcsdk/lib
  installing to build/bdist.linux-x86_64/wheel
  running install
  running install_lib
  creating build/bdist.linux-x86_64
  creating build/bdist.linux-x86_64/wheel
  creating build/bdist.linux-x86_64/wheel/pyrfc
  copying build/lib.linux-x86_64-cpython-311/pyrfc/__init__.py -> build/bdist.linux-x86_64/wheel/pyrfc
  copying build/lib.linux-x86_64-cpython-311/pyrfc/_cyrfc.cpython-311-x86_64-linux-gnu.so -> build/bdist.linux-x86_64/wheel/pyrfc
  copying build/lib.linux-x86_64-cpython-311/pyrfc/_exception.py -> build/bdist.linux-x86_64/wheel/pyrfc
  copying build/lib.linux-x86_64-cpython-311/pyrfc/_utils.py -> build/bdist.linux-x86_64/wheel/pyrfc
  running install_egg_info
  running egg_info
  writing src/pyrfc.egg-info/PKG-INFO
  writing dependency_links to src/pyrfc.egg-info/dependency_links.txt
  writing top-level names to src/pyrfc.egg-info/top_level.txt
  reading manifest file 'src/pyrfc.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no previously-included files matching '*' found under directory 'tests'
  adding license file 'LICENSES/Apache-2.0.txt'
  writing manifest file 'src/pyrfc.egg-info/SOURCES.txt'
  Copying src/pyrfc.egg-info to build/bdist.linux-x86_64/wheel/pyrfc-3.3-py3.11.egg-info
  running install_scripts
  creating build/bdist.linux-x86_64/wheel/pyrfc-3.3.dist-info/WHEEL
  creating '/tmp/pip-wheel-8acuv7i_/.tmp-syte1g74/pyrfc-3.3-cp311-cp311-linux_x86_64.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
  adding 'pyrfc/__init__.py'
  adding 'pyrfc/_cyrfc.cpython-311-x86_64-linux-gnu.so'
  adding 'pyrfc/_exception.py'
  adding 'pyrfc/_utils.py'
  adding 'pyrfc-3.3.dist-info/Apache-2.0.txt'
  adding 'pyrfc-3.3.dist-info/METADATA'
  adding 'pyrfc-3.3.dist-info/WHEEL'
  adding 'pyrfc-3.3.dist-info/top_level.txt'
  adding 'pyrfc-3.3.dist-info/RECORD'
  removing build/bdist.linux-x86_64/wheel
  Building wheel for pyrfc (pyproject.toml) ... done
  Created wheel for pyrfc: filename=pyrfc-3.3-cp311-cp311-linux_x86_64.whl size=1047158 sha256=32afefa4809caf5f56037151c626b520ce7c0f37deaab83f1ac1446300717360
  Stored in directory: /tmp/pip-ephem-wheel-cache-zymh43x_/wheels/bb/53/c1/6031da54faf6271f0a9102f06fbfe8f22321efad713fb39657
Successfully built pyrfc
Installing collected packages: pyrfc
Successfully installed pyrfc-3.3

# Test
(py3.11.4) www-admin@coevi29:~> python -c "from pyrfc import *"
(py3.11.4) www-admin@coevi29:~>
dafiahmad123 commented 12 months ago

Thanks for spending the time to simulate on your own sandbox. I've also managed to installed similar to your simulation. Now. I will probably take a look on how my python environment is setup.