Skip to content

Instantly share code, notes, and snippets.

@prehensilecode
Last active September 11, 2023 14:36
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save prehensilecode/dd4aa3b3f349d2ef01bcce6002697e86 to your computer and use it in GitHub Desktop.
HOWTO build NCI-GDC/gdc_client

HOWTO build NCI-GDC/gdc_client

Notes on building https://github.com/NCI-GDC/gdc-client

Issue

Following their instructions, get error in building lxml Python package:

Building wheels for collected packages: lxml
  Building wheel for lxml (setup.py): started
  Building wheel for lxml (setup.py): finished with status 'error'
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [97 lines of output]
      Building lxml version 4.4.2.
      /tmp/pip-install-f3lu9_f_/lxml_2b73c7f2ec5345da925d4c9a21d250a8/setup.py:64: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.i
o/en/latest/pkg_resources.html
        import pkg_resources
      Building without Cython.
      Using build configuration of libxslt 1.1.34
      running bdist_wheel
      running build
      running build_py
      ...
       running build_ext
      building 'lxml.etree' 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/lxml
      gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -I/usr/include/libxml2 -Isrc -Isrc/lxml/includes -I/home/chind/Src/gdc-client/venv/include -I/home/chind/opt/include/python3.11 -c src/lxml/etree.c -o build/temp.linux-x86_64-cpython-311/src/lxml/etree.o -w
      src/lxml/etree.c:289:12: fatal error: longintrepr.h: No such file or directory
        289 |   #include "longintrepr.h"
            |            ^~~~~~~~~~~~~~~
      compilation terminated.
      Compile failed: command '/usr/bin/gcc' failed with exit code 1
      creating tmp
      cc -I/usr/include/libxml2 -I/usr/include/libxml2 -c /tmp/xmlXPathInitymh_uec5.c -o tmp/xmlXPathInitymh_uec5.o
      cc tmp/xmlXPathInitymh_uec5.o -lxml2 -o a.out
      error: command '/usr/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 lxml
  Running setup.py clean for lxml
Failed to build lxml
ERROR: Could not build wheels for lxml, which is required to install pyproject.toml-based projects

The key bit is Building without Cython. We can fix the error by using Cython instead of avoiding it.

Source directory

Assume gdc_client source code has been cloned to SOMEWHERE/gdc_client

Adding Cython < 3 to requirements.txt does not work

Manually adding Cython < 3 to setup.py and then running pip-compile to generate a new requirements.txt did not work: the same error occurs.

Manually installing Cython < 3 and lxml == 4.4.2

I found that manually installing Cython < 3 with pip, and installing lxml == 4.4.2 manually from source worked.

Do everything below while in the venv as per gdc_client build instructions.

Build gdc_client following standard instructions

  • cd SOMEWHERE/gdc_client
  • pip install -r requirements.txt
  • python setup.py install

This creates the gdc_client executable script in SOMEWHRE/gdc_client/bin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment