astropy / astropy-helpers

Helpers for Astropy and Affiliated packages
BSD 3-Clause "New" or "Revised" License
28 stars 42 forks source link

Install fails if Sphinx dependency imagesize is missing #228

Closed cdeil closed 7 years ago

cdeil commented 8 years ago

I have Sphinx 1.4 installed, but not it's dependency imagesize that they added in 1.4 (so yes, you could say I have a broken Sphinx install).

This prevents me from installing Astropy or any affiliated package!?

$ python2 setup.py install --user
Traceback (most recent call last):
  File "setup.py", line 57, in <module>
    cmdclassd = register_commands(PACKAGENAME, VERSION, RELEASE)
  File "/Users/deil/code/package-template/astropy_helpers/astropy_helpers/setup_helpers.py", line 142, in register_commands
    from .commands.build_sphinx import AstropyBuildSphinx, AstropyBuildDocs
  File "/Users/deil/code/package-template/astropy_helpers/astropy_helpers/commands/build_sphinx.py", line 16, in <module>
    from sphinx.setup_command import BuildDoc as SphinxBuildDoc
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sphinx/setup_command.py", line 23, in <module>
    from sphinx.application import Sphinx
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sphinx/application.py", line 38, in <module>
    from sphinx.environment import BuildEnvironment
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sphinx/environment.py", line 42, in <module>
    from sphinx.util.images import guess_mimetype
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sphinx/util/images.py", line 13, in <module>
    import imagesize
ImportError: No module named imagesize

Can this be made more robust? A missing dependency for Sphinx shouldn't prevent Astropy installation, right?

saimn commented 8 years ago

It should have been installed with Sphinx (1.4.1). I guess it is possible to skip registering the build_sphinx command if Sphinx install is broken, but it may be simpler to fix your Sphinx install ?

saimn commented 8 years ago

Actually it is a dependency since 1.4 : https://github.com/sphinx-doc/sphinx/commit/fd674ef9f91216363b273f299bdfcd1fd3b65445

cdeil commented 8 years ago

@saimn - Yes, I did install imagesize and now it works for me.

My feature request here is: please make the Astropy setup.py more robust, so that package install is possible even in cases where Sphinx is broken. I think this might be possible by catching the error and just emitting a warning instead of aborting?

It's OK for me if the answer is "won't fix" and you close the issue ... I just thought I'd report it as a possible suggestion.

eteq commented 8 years ago

I agree with @cdeil that not having imagesize installed shouldn't cause the astropy build to fail.

@cdeil - just so we're clear, though: if you don't even have sphinx installed everything is fine, right? The case here is only where sphinx 1.4 is installed but imagesize is not?

cdeil commented 8 years ago

if you don't even have sphinx installed everything is fine, right?

I'm pretty sure that the answer is yes, but I didn't try. (If that were broken tons of users would have complained.)

The case here is only where sphinx 1.4 is installed but imagesize is not?

Yes.