Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation fails on sysrepo/sysrepo-netopeer2 Docker container #62

Closed
tudor-paraschivescu opened this issue Mar 12, 2024 · 2 comments
Closed

Comments

@tudor-paraschivescu
Copy link

Hello,

I tried to install sysrepo-python in a container based on the sysrepo/sysrepo-netopeer2:latest image and I get an error during the installation.

In the new container, I've installed the needed dependencies with apt-get update && apt-get install python3-dev gcc python3-cffi python3-pip. All good here, everything installed successfully.

But, when I try to install sysrepo-python with pip3 install sysrepo, I get the following error:

Collecting sysrepo
  Downloading sysrepo-1.7.2.tar.gz (39 kB)
[...]
Requirement already satisfied: cffi; platform_python_implementation != "PyPy" in /usr/lib/python3/dist-packages (from sysrepo) (1.14.0)
Collecting libyang>=2.1
  Downloading libyang-2.8.4.tar.gz (59 kB)
     |████████████████████████████████| 59 kB 1.6 MB/s
Building wheels for collected packages: sysrepo, libyang
  Building wheel for sysrepo (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /tmp/tmppammkmso build_wheel /tmp/tmp38a826de
       cwd: /tmp/pip-install-qg4neeyj/sysrepo
  [...]
  build/temp.linux-x86_64-cpython-38/_sysrepo.c: In function ‘_cffi_const_SR_SUBSCR_FILTER_ORIG’:
  build/temp.linux-x86_64-cpython-38/_sysrepo.c:1340:12: error: ‘SR_SUBSCR_FILTER_ORIG’ undeclared (first use in this function)
   1340 |   int n = (SR_SUBSCR_FILTER_ORIG) <= 0;
        |            ^~~~~~~~~~~~~~~~~~~~~
  build/temp.linux-x86_64-cpython-38/_sysrepo.c:1340:12: note: each undeclared identifier is reported only once for each function it appears in
  build/temp.linux-x86_64-cpython-38/_sysrepo.c: In function ‘_cffi_d_sr_discard_items’:
  build/temp.linux-x86_64-cpython-38/_sysrepo.c:1951:10: error: implicit declaration of function ‘sr_discard_items’; did you mean ‘sr_discard_changes’? [-Werror=implicit-function-declaration]
   1951 |   return sr_discard_items(x0, x1);
        |          ^~~~~~~~~~~~~~~~
        |          sr_discard_changes
  cc1: all warnings being treated as errors
  error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for sysrepo
  Building wheel for libyang (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /tmp/tmpm6lsxjwf build_wheel /tmp/tmpbusr3yi6
       cwd: /tmp/pip-install-qg4neeyj/libyang
  [...]
  build/temp.linux-x86_64-cpython-38/_libyang.c:581:2: error: #error "Need at least libyang 2.37"
    581 | #error "Need at least libyang 2.37"
        |  ^~~~~
  build/temp.linux-x86_64-cpython-38/_libyang.c: In function ‘_cffi_const_LYD_VALIDATE_MULTI_ERROR’:
  build/temp.linux-x86_64-cpython-38/_libyang.c:7732:12: error: ‘LYD_VALIDATE_MULTI_ERROR’ undeclared (first use in this function); did you mean ‘_cffi_const_LYD_VALIDATE_MULTI_ERROR’?
   7732 |   int n = (LYD_VALIDATE_MULTI_ERROR) <= 0;
        |            ^~~~~~~~~~~~~~~~~~~~~~~~
        |            _cffi_const_LYD_VALIDATE_MULTI_ERROR
  build/temp.linux-x86_64-cpython-38/_libyang.c:7732:12: note: each undeclared identifier is reported only once for each function it appears in
  build/temp.linux-x86_64-cpython-38/_libyang.c: In function ‘_cffi_const_LYS_GETNEXT_WITHSCHEMAMOUNT’:
  build/temp.linux-x86_64-cpython-38/_libyang.c:7921:12: error: ‘LYS_GETNEXT_WITHSCHEMAMOUNT’ undeclared (first use in this function); did you mean ‘LYS_GETNEXT_WITHCHOICE’?
   7921 |   int n = (LYS_GETNEXT_WITHSCHEMAMOUNT) <= 0;
        |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
        |            LYS_GETNEXT_WITHCHOICE
  build/temp.linux-x86_64-cpython-38/_libyang.c: In function ‘_cffi_const_LY_CTX_LEAFREF_EXTENDED’:
  build/temp.linux-x86_64-cpython-38/_libyang.c:8369:12: error: ‘LY_CTX_LEAFREF_EXTENDED’ undeclared (first use in this function); did you mean ‘_cffi_const_LY_CTX_LEAFREF_EXTENDED’?
   8369 |   int n = (LY_CTX_LEAFREF_EXTENDED) <= 0;
        |            ^~~~~~~~~~~~~~~~~~~~~~~
        |            _cffi_const_LY_CTX_LEAFREF_EXTENDED
  error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for libyang
Failed to build sysrepo libyang
ERROR: Could not build wheels for sysrepo, libyang which use PEP 517 and cannot be installed directly

What could be causing this and how could this problem be fixed?
Thank you in advance.

@tbsuht
Copy link
Contributor

tbsuht commented Mar 13, 2024

Probably the same issue as mentioned here: #61

@tudor-paraschivescu
Copy link
Author

I solved it by using older versions for libyang and sysrepo, due to the sysrepo/sysrepo-netopeer2 Docker image being 1-year old and installing the most recent dependencies at that time.

So instead of:
pip install sysrepo
I've used:
pip install libyang==2.8.0 && pip install sysrepo==1.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants