2 years ago

#65881

test-img

The_Fallen

Cannot install Python projects in readthedocs

I've got a couple of projects here for which I'm preparing documentation at the moment, hosted at readthedocs.org. FYI, all of them use poetry and I use custom .readthedocs.yml files with this entry:

python:
  install:
    - method: pip
      path: .

It works fine for most projects, but it fails for two for different reasons during installation of the project via pip:

  1. The first one uses PyGObject, which failes like this:
Package gobject-introspection-1.0 was not found in the pkg-config search path.
  Perhaps you should add the directory containing `gobject-introspection-1.0.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'gobject-introspection-1.0' found
  Command '('pkg-config', '--print-errors', '--exists', 'gobject-introspection-1.0 >= 1.56.0')' returned non-zero exit status 1.
  
  Try installing it with: 'sudo apt install libgirepository1.0-dev'

So it seems that PyGObject cannot be installed without some system packages to be installed. I could rearrange the code so that the import is not top-level. But still I need it in the dependencies. Can I tell pip install to ignore this single package somehow? Any other idea?

  1. The second project compiles some C++ code via Cython and fails, because it's missing a library. I use a custom build script in the pyproject.toml:
[tool.poetry.build]
script = "build.py"
generate-setup-file = false

Is there some flag in pip that I could set and retrieve in build.py to skip the compilation? Or is there a better way?

python

pip

python-poetry

0 Answers

Your Answer

Accepted video resources