divi255 / sphinxcontrib.asciinema

Easily embed asciinema videos into Sphinx documentation
MIT License
17 stars 11 forks source link

Pip installation fails if sphinx is not in pip cache #2

Closed hugobuddel closed 4 years ago

hugobuddel commented 4 years ago

Installation through pip fails if sphinx is not available in the pip cache. E.g., explicitly disabling the cache:

$ conda create -n satest
$ conda activate satest
$ pip install --no-cache-dir sphinxcontrib.asciinema
...
    ERROR: Command errored out with exit status 1:
...
        from sphinxcontrib import asciinema as pkg
      File "/tmp/pip-install-e7tmpd_3/sphinxcontrib.asciinema/sphinxcontrib/asciinema/__init__.py", line 9, in <module>
        from docutils import nodes
    ModuleNotFoundError: No module named 'docutils'
...

The error also occurs without --no-cache-dir if sphinx has not been installed earlier through pip, e.g. on a freshly installed machine, which is harder to reproduce.

The same error occurs when installing sphinx at the same time:

$ pip install --no-cache-dir sphinxcontrib.asciinema

This can be resolved by first installing sphinx:

$ pip install --no-cache-dir sphinx
Successfully installed ... sphinx-2.2.1 ...
$ pip install --no-cache-dir sphinxcontrib.asciinema
Successfully installed sphinxcontrib.asciinema-0.1.6

It would be better if the both sphinx and the asciinema extension can be installed with a single pip command. If that's not possible, then the documentation should be updated to mention that sphinx must be installed first before installing this plugin.

hugobuddel commented 4 years ago

Perhaps fixing this properly requires adding sphinx to the requirements in setup.py. E.g.

    install_requires=[
       'sphinx'
    ],
divi255 commented 4 years ago

setup.py has 'sphinx' in install_requires. can not figure out why this is ignored by pip. will look a bit later

if you have any ideas, please share too.

teake commented 4 years ago

I tried this in a fresh conda env with both Python 3.8.0 and Python 3.7.3 from conda-forge (OSX), and 3.8.0 failed with the above behavior while 3.7.3 works ok. So it's probably not related to this package.

divi255 commented 4 years ago

I'm testing in a clean ubuntu 18.04 and can confirm sphinx is not installed by pip3, despite it's listed in install_requires.

hugobuddel commented 4 years ago

Tested it with 3.7.3 and 3.8.something from conda on Ubuntu 16.04.6 and both failed for me.

Maybe from sphinxcontrib import asciinema as pkg does not work? (As in, it should not work if the file is executed at requirement-gathering time because that will import not-yet-installed dependencies. But I'm not sure what pip actually does; maybe the file is only executed when the package is made, and everything should be fine then.)

divi255 commented 4 years ago

fixed, installs fine now (0.1.7)