Comments (18)
I have the same problem when I try to build the docs.
I do get some warnings from the doc generator (see below).
How am I supposed to build it?
C:\github\python_example\docs>.\make.bat html
Running Sphinx v1.7.6
making output directory...
loading pickled environment... done
[autosummary] generating autosummary for: index.rst, python_example.rst
Failed to import 'python_example': no module named python_example
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 2 source files that are out of date
updating environment: 0 added, 1 changed, 0 removed
reading sources... [100%] python_example
WARNING: autodoc: failed to import module 'python_example'; the following exception was raised:
No module named 'python_example'
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] python_example
C:\github\python_example\docs\index.rst:6: WARNING: toctree contains reference to document 'python_example' that doesn't have a title: no link will be generated
C:\github\python_example\docs\index.rst:6: WARNING: toctree contains reference to document 'python_example' that doesn't have a title: no link will be generated
C:\github\python_example\docs\index.rst:6: WARNING: toctree contains reference to document 'python_example' that doesn't have a title: no link will be generated
generating indices... genindexC:\github\python_example\docs\index.rst:6: WARNING: toctree contains reference to document 'python_example' that doesn't have a title: no link will be generated
writing additional pages... searchC:\github\python_example\docs\index.rst:6: WARNING: toctree contains reference to document 'python_example' that doesn't have a title: no link will be generated
copying static files... WARNING: html_static_path entry 'C:\\github\\python_example\\docs\\_static' does not exist
done
copying extra files... done
dumping search index in English (code: en) ... done
dumping object inventory... done
build succeeded, 7 warnings.
The HTML pages are in _build\html.
Build finished. The HTML pages are in _build/html.
from python_example.
@am2222 FYI, I'm looking into their recent, still experimental, readthedocs support for conda. Sounds like a good alternative to building, as it pulls your packages from conda directly.
from python_example.
@williamfgc you're correct that sphinx has to find the package in the PYTHONPATH in order to work. It is, however, usually sufficient to install your package with pip which then includes it in the PYTHONPATH, too.
I've tried using RTD for my library. You can configure their system to pull from your repository and install via pip which means that it is locally built on their virtual machine and then sphinx is run on that machine. You have to make sure that their virtual machine has a C++11-compliant compiler, which worked for me. However, their machines do have limited RAM (I think 1GB). In my library, I've worked quite a lot with template function which take a lot of RAM during compilation and so building failed and as such, building the docs failed, as well. I've settled for local generation of the docs with make html
and upload it to my own web server.
RTD provides access to their log files so if building fails you can check them to find out more about the problem.
from python_example.
@benmaier thanks for the explanation and providing insight for your own process. I recently had to tweak the requirements.txt file to point at fixed versions, not all version were compatible (some breathe update). Thanks, this is very helpful.
from python_example.
@bsamseth how did you edit your Makefile specifically to get this to work? I'm still having the same issue on macOS Catalina.
It has been a while, so not 100% sure what I did. But reading my own comments, I believe I edited the Makefile to use a full path to sphinx-build
. I.e use the full path to the correct version executable on this line (something like /path/to/repo/my-venv/bin/sphinx-build
):
Line 6 in 4a08067
from python_example.
I still have this issue, exactly as described above. Does anyone know how to fix this?
from python_example.
did you install python_example
with pip? The warning implies that Python wants to import the package but can't and as such the docstrings cannot be created
from python_example.
I ran cloned the repo, then ran Never mind, confused that with a different repo I tried similarly. Trying to run setup after a clone here fails due to python setup.py develop
successfully from within a fresh virtual environment. Should be equivalent to running pip install -e .
, no? Is there some different way I should have done it for sphinx to find it?no module named pybind11
.
Could you say what steps one should take in order for the docs to build as they should? Trying to get this to work for my own project, with similar results, except it runs without any warnings about not finding the module.
from python_example.
I now tried to replicate with a freshly cloned repo. somehow running python setup.py develop
does not seem to be enough for the package to be importable. After running pip -e install ../python_example
, building the docs with make html
works
from python_example.
I still had issues, even after running pip install -e .
and/or python setup.py develop
. Found the issue to be that sphinx-build
pointed to something in /usr/local/bin
, and not to the active virtualenv. Editing the Makefile to point to the correct sphinx fixed it. Sorry to bother with this, turned out to be my fault (surprise!).
from python_example.
from python_example.
Hi,
I have the same problem, with the fact that it only shows one of my functions when I build it on local machine. when I deploy it on readthedocs website it does not show that function even. IS there any way to find what is wrong with my methods?
from python_example.
@am2222 I have the same issue, I believe the parser needs to find the generated python module in your PYTHONPATH. See related issue in pybind11.
from python_example.
@williamfgc Seems we need to focus on building on read the docs but their system does not have much abilities to build libraries
from python_example.
@williamfgc thanks, seems I have to move my package to anaconda too,
from python_example.
@benmaier Can you show me how you configured RTD to make and install your package? Mine has a problem with installing pybind
from python_example.
my package is this one: https://github.com/benmaier/tacoma
you need to have a completely set up subdirectory named docs
, like so: https://github.com/benmaier/tacoma/tree/master/docs
In this subdirectory, you need to have a file docs/requirements.txt
in which the crucial dependencies for your package are listed. Mine looks like this:
pip==18.0
pybind11==2.2.3
sphinxcontrib-katex==0.3
I have a lot of other dependencies which do not really matter to build the docstrings, so you have to add those as MOCK_MODULES
in Sphinx's docs/conf.py
. Looks like this in my docs:
...
from mock import Mock as MagicMock
class Mock(MagicMock):
@classmethod
def __getattr__(cls, name):
return Mock()
MOCK_MODULES = ['numpy', 'scipy', 'matplotlib', 'matplotlib.pyplot', 'matplotlib.collections',
'lmfit', 'networkx', 'community',
'scipy.optimize', 'scipy.stats', 'scipy.special', 'scipy.integrate',
'scipy.sparse', 'scipy.sparse.linalg', 'scipy.linalg',
'numpy.polynomial', 'numpy.polynomial.polynomial', 'wget',
'lmfit',
]
...
On RTD, go to Admin > Advanced Settings and put docs/requirements.txt
in the field Requirements file
. Also, check the boxes Install Project
and Use system packages
.
If a build on RTD fails, go to Builds
, click on the latest build attempt and then click View raw
to see the whole log file and to see what went wrong.
Also, you can set up a docs/.readthedocs.yml
to automate all this, I think, see https://docs.readthedocs.io/en/stable/config-file/v2.html . I have not done that, though.
from python_example.
@bsamseth how did you edit your Makefile specifically to get this to work? I'm still having the same issue on macOS Catalina.
from python_example.
Related Issues (20)
- Compilation issue on macOS 12.3
- Cannot compile with conda build HOT 1
- I can't get it to work when I use my own python interpreter HOT 1
- Install compiled package in a Jupyter Notebook HOT 2
- Unsupported Wheel on x86_64 Intel Chip Mac running OSX 13.4 HOT 4
- yocto recipe for this example
- pybind11.get_include() with virutalenv HOT 1
- Libopenblas issues in conda build when adding <pybind11/numpy.h> functionality on OSX HOT 6
- module builds but fails to load with non-cmake library HOT 6
- The example does not explain how to handle .h file. HOT 2
- Linker error building on macOS HOT 4
- [Question] ImportError: DLL load failed while importing HOT 2
- REQ Github template repository HOT 8
- trying to install kivy on ubuntu HOT 1
- [Question] Modifying setup.py with pybind used in a submodule HOT 2
- Difficulty uploading to pypi? HOT 2
- What about the pygrep hooks for the RST files we added recently. Those seem quite useful.
- Linking HOT 1
- Why the same code can be built and installed on Linux and macOS but not on Windows? HOT 4
- ImportError: dynamic module does not define module export function (PyInit_python_example) HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python_example.