'Sphinx Extensions (numpydoc)
NOTE Added After: I finally got numpydoc working. It was also a python 2 problem. I ran 2to3 on it and now it seems to be working.
OK, I've spent an entire day trying to get any Sphinx extension to work and am now hoping someone could point out what I'm doing wrong. (Sorry this is a bit long, but maybe more info will help you quickly find the error of my ways).
Sphinx seems to be working as advertised, but I would like to use NumPy style documentation so thought I'd install numpydoc. In case it matters, I'm using Python 3.3 (winpython 64 bit on windows 7). I started with the directions here but got the error:
Extension error:
Could not import extension numpydoc (exception: cannot import name setup)
Googling that I found that some people got around it by using numpydoc.numpydoc
No dice. I made sure everything possibly relevant was in my path (as well as added into sys.path in sphinx's conf.py
file). I even tried copying numpydoc into sphinx's ext folder and changing the extension string accordingly, still no luck.
At this point I gave up on numpdoc and decided to try napoleon. Following the installation directions I just pip install sphinxcontrib-napoleon
and then should be good to go. But alas, no, as napoleon seems to be in 2.x not 3 (though the egg says Sphinx-1.1.3-py3.3.egg-info
and during installation it says it is installing sphinxcontrib_napoleon-0.2.1-py3.3-nspkg.pth
. None-the-less, lots of python 2 code. I tried converting it with 2to3 but then I get a recursion too deep error.
So, I decide to see if I am capable of installing any extension to sphinx. I essentially at random pick findanything. Install it as requested and it also fails, this time because of a relpath error (ValueError: path is on mount 'C:', start on mount 'D:'
). Which I guess means that it is unhappy that my python installation is on C but my code I'm trying to document (and where I'm trying to run sphinx) is on D (and that I'm running Windows).
So, did I just happen to pick 3 troubled extensions? Or, if not, what am I doing wrong and (more importantly) how can I do it right so that I get this working?
PS I'm completely new to Python so please don't assume that I'm not making an incredibly stupid and basic error.
Solution 1:[1]
Old thread, however...
If you are using Ubuntu 20+, don't install numpydoc via pip. Use
apt install python3-numpydoc
instead. Many of the sphinx packages need to be installed this way going forward.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | beep_check |