Sphinx autodoc not importing module.submodule but importing module

13 views
Skip to first unread message

Diego F Medina

unread,
Aug 8, 2019, 6:05:46 AM8/8/19
to sphinx-users

(_I have been browsing among the Sphinx autodoc related answers for a while now but I have not been able to find a solution (nor a bug report, if it is the case) for this. I would highly appreciate some help._)

I am using Sphinx to document some python project on Anaconda, and as other answers suggest I have added all the suggested lines into my config.py:

```python
sys.path.insert(0, 'C:/ProgramData/Anaconda3/lib/site-packages')
sys.path.insert(0, os.path.abspath('../..'))
```
I know this is working properly since for one the modules the documentation is build correclty, and it has the lines:
```python
import scipy.optimize as sp
sp.optimize.curve_fit(my_funct, x, y)
```
However, when using:
```python
import scipy.optimize as op
op.curve_fit(my_funct, x, y)
```
or
```python
from scipy.optimize import curve_fit
curve_fit(my_funct, x, y)
```
The build fails, giving:
```
  File "C:\my_module.py", line 1, in <module>
    import scipy.optimize as op
ModuleNotFoundError: No module named 'scipy.optimize'
```
Am I supposed to used every imported functions calling all the modules structure (i.e. sp.optimize.curve_fit) whenever using autodoc?

Is there some additional set up I have missed?

----------------------

I have encounter the same problem with other packages (both default python and user created) so I know the problem is not package specific.
Reply all
Reply to author
Forward
0 new messages