So I finally got the docs built. Couple of points which I think might be helpful to people building docs in the future:
- You need to have sphinx installed in your working environment (native installation, virtualenv, conda, whatever). I did not see sphinx listed as a dependency online. Maybe it should be included in the HACKING.rst.txt file?
- You do NOT need to have numpydoc installed on your system. Irrespective of where it is installed, the build process only uses the numpydoc package present under the sphinxext directory. I wasted a lot of hours trying to find which version of numpydoc was being used as I had it installed both in my virtualenv, and native installation; neither of those had the faulty import line.
- After using `git submodule update` to get the latest sphinxext directory and numpydoc installation, the faulty import line in file doc/sphinxext/numpydoc/
numpydoc.py needs to be changed. From from sphinx.util.compat import Directivetofrom docutils.parsers.rst import DirectiveThank you Lars for pointing that out. Finally, and this was my fault entirely, I had my virtual environment running python version 3.5.2, but as python3 or python. Calling python3.5 (as the Makefile was doing when I set PYVER=3.5) called the python executable in /usr/bin/python3.5, which couldn't find the sphinx module itself (as I didn't install it along with my native installation). Setting PYVER=3, or PYTHON=/path/to/python/in/virtualenv fixed this. On 25 April 2018 at 03:40, Lars G. <lagru@mailbox.org> wrote:On 24.04.2018 20:36, Aditya Bharti wrote:
> Regarding building the documentation, I was able to figure out that I
> needed to install sphinx separately. The HACKING.rst.txt file only
> mentions Numpy Cython and pytest as dependencies.
> I was able to get the make command running with `make html PYVER=3.5`,
> but I'm getting the follwing error:
>
>
> Could not import extension numpydoc (exception: cannot import name
> 'Directive')
Hello Aditya,
I had the same problem with my setup. I'm still a little bit confused
but I think the error was due to an old version of numpydoc trying use
an import that didn't work with new versions of sphinx.
I think got the old version with the git-submodules included in the
doc-dirctory (can be downloaded with `git submodule update`).
Anyway I got it to work by modifying the faulty import itself. Try to
find the file numpydoc/numpydoc.py and try to find the line:
from sphinx.util.compat import Directive
If you can find that line you may be in luck because replacing that line
with:
from docutils.parsers.rst import Directive
fixed it for me. I hope this helps.
By the way, perhaps it would be useful to extend the doc/README.txt with
a more thorough explanation of the build process and mention that the
submodules can be downloaded with `git submodule update`. I only found
out because I looked at guide for NumPy
https://github.com/numpy/numpy/blob/master/doc/source/docs/ howto_build_docs.rst
while trying to figure out the build process myself.
Best regards,
Lars
_______________________________________________
SciPy-Dev mailing list
SciPy-Dev@python.org
https://mail.python.org/mailman/listinfo/scipy-dev