Skip to content

Installation requires preinstalled Sphinx #714

@danwos

Description

@danwos

I'm unable to install breathe with a fresh new virtual environment from locally checked out git repo .

Error message after pip install breathe ,:

    ERROR: Command errored out with exit status 1:
     command: /home/daniel/workspace/sphinx/breathe/.venv/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-mqj3ctdq/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-mqj3ctdq/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-cjlbra1y
         cwd: /tmp/pip-req-build-mqj3ctdq/
    Complete output (15 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-req-build-mqj3ctdq/setup.py", line 10, in <module>
        from breathe import __version__
      File "/tmp/pip-req-build-mqj3ctdq/breathe/__init__.py", line 1, in <module>
        from . import directives
      File "/tmp/pip-req-build-mqj3ctdq/breathe/directives.py", line 1, in <module>
        from breathe.directive.base import create_warning
      File "/tmp/pip-req-build-mqj3ctdq/breathe/directive/base.py", line 1, in <module>
        from breathe.finder.factory import FinderFactory
      File "/tmp/pip-req-build-mqj3ctdq/breathe/finder/__init__.py", line 1, in <module>
        from breathe.project import ProjectInfo
      File "/tmp/pip-req-build-mqj3ctdq/breathe/project.py", line 4, in <module>
        from sphinx.application import Sphinx
    ModuleNotFoundError: No module named 'sphinx'

Reason is this line in setup.py:
from breathe import __version__

breathe/__init__.py, which contains the __version__ attribute, also contains this line:
from sphinx.application import Sphinx.

So it looks like this line forces pip/setuptools to import already sphinx, which may not be installed yet.

Workarounds

  1. Remove from setup.py from breathe import __version__ and set a fix value for version.
  2. Install sphinx in advance

Solutions idea

Maybe put __version__ into a separate version.py and let __init__.py import it.
setup.py could then import directly from version.py.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprovements, additions (also cosmetics)packagingRequirements, setup.py, etc

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions