econchick / interrogate

Explain yourself! Interrogate a codebase for docstring coverage.
https://interrogate.readthedocs.io
MIT License
565 stars 46 forks source link

`interrogate` is unable to run when installed with `png` extra #101

Closed cesarcoatl closed 2 years ago

cesarcoatl commented 2 years ago

Environment

Description of the bug

I have installed using pipx install 'interrogate[png]' and on a virtual environment on both macOS and Windows, and even interrogate --version fails with the following error:

macOS

$ pipx install 'interrogate[png]'
  installed package interrogate 1.5.0, installed using Python 3.10.1
  These apps are now globally available
    - interrogate
done! ✨ 🌟 ✨
$ interrogate --version
Traceback (most recent call last):
  File "/Users/thecesrom/.local/bin/interrogate", line 5, in <module>
    from interrogate.cli import main
  File "/Users/thecesrom/.local/pipx/venvs/interrogate/lib/python3.10/site-packages/interrogate/cli.py", line 11, in <module>
    from interrogate import badge_gen
  File "/Users/thecesrom/.local/pipx/venvs/interrogate/lib/python3.10/site-packages/interrogate/badge_gen.py", line 15, in <module>
    import cairosvg
  File "/Users/thecesrom/.local/pipx/venvs/interrogate/lib/python3.10/site-packages/cairosvg/__init__.py", line 26, in <module>
    from . import surface  # noqa isort:skip
  File "/Users/thecesrom/.local/pipx/venvs/interrogate/lib/python3.10/site-packages/cairosvg/surface.py", line 9, in <module>
    import cairocffi as cairo
  File "/Users/thecesrom/.local/pipx/venvs/interrogate/lib/python3.10/site-packages/cairocffi/__init__.py", line 48, in <module>
    cairo = dlopen(
  File "/Users/thecesrom/.local/pipx/venvs/interrogate/lib/python3.10/site-packages/cairocffi/__init__.py", line 45, in dlopen
    raise OSError(error_message)  # pragma: no cover
OSError: no library called "cairo-2" was found
no library called "cairo" was found
no library called "libcairo-2" was found
cannot load library 'libcairo.so.2': dlopen(libcairo.so.2, 2): image not found
cannot load library 'libcairo.2.dylib': dlopen(libcairo.2.dylib, 2): image not found
cannot load library 'libcairo-2.dll': dlopen(libcairo-2.dll, 2): image not found

Windows

> interrogate --version
Traceback (most recent call last):
  File "C:\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\cesrom\.local\bin\interrogate.exe\__main__.py", line 4, in <module>
  File "C:\Users\cesrom\.local\pipx\venvs\interrogate\lib\site-packages\interrogate\cli.py", line 11, in <module>
    from interrogate import badge_gen
  File "C:\Users\cesrom\.local\pipx\venvs\interrogate\lib\site-packages\interrogate\badge_gen.py", line 15, in <module>
    import cairosvg
  File "C:\Users\cesrom\.local\pipx\venvs\interrogate\lib\site-packages\cairosvg\__init__.py", line 26, in <module>
    from . import surface  # noqa isort:skip
  File "C:\Users\cesrom\.local\pipx\venvs\interrogate\lib\site-packages\cairosvg\surface.py", line 9, in <module>
    import cairocffi as cairo
  File "C:\Users\cesrom\.local\pipx\venvs\interrogate\lib\site-packages\cairocffi\__init__.py", line 48, in <module>
    cairo = dlopen(
  File "C:\Users\cesrom\.local\pipx\venvs\interrogate\lib\site-packages\cairocffi\__init__.py", line 45, in dlopen
    raise OSError(error_message)  # pragma: no cover
OSError: no library called "cairo-2" was found
no library called "cairo" was found
no library called "libcairo-2" was found
cannot load library 'libcairo.so.2': error 0x7e
cannot load library 'libcairo.2.dylib': error 0x7e
cannot load library 'libcairo-2.dll': error 0x7e

What you expected to happen

interrogate should be able to run without errors.

How to reproduce (as minimally and precisely as possible)

  1. python -m pip install 'interrogate[png]' or pipx install 'interrogate[png]'
  2. Execute interrogate --version or interrogate --verbose <dir>
  3. Error

Anything else we need to know?

interrogate without the [png] extra works fine.

$ pipx install interrogate
  installed package interrogate 1.5.0, installed using Python 3.10.1
  These apps are now globally available
    - interrogate
done! ✨ 🌟 ✨
$ interrogate --version
interrogate, version 1.5.0
cesarcoatl commented 2 years ago

Sorry, I had not installed cairo.

Closing issue.