ReadTheDocs Cython ImportError: Cannot import module ...
danielhanchen opened this issue · comments
This is just a post to highlight how the problem has been solved. Building locally works, however within RTD, the error showcases WARNING: autodoc: failed to import module 'hyperlearn.base'; the following exception was raised:
No module named 'hyperlearn.cython.base'
I've checked: https://stackoverflow.com/questions/13238736/how-to-document-cython-function-on-readthedocs/13364247, https://stackoverflow.com/questions/13372068/importerror-for-my-code-on-readthedocs, https://stackoverflow.com/questions/10324393/sphinx-build-fail-autodoc-cant-import-find-module, readthedocs/readthedocs.org#3634, readthedocs/readthedocs.org#2511, https://docs.readthedocs.io/en/latest/faq.html, astropy/astropy-healpix#4, and mozilla/treeherder@f17bcf8.
All didn't solve the problem. To solve it, in conf.py change
sys.path.insert(0, os.path.abspath('.')) sys.path.insert(0, os.path.abspath('..')) sys.path.insert(0, os.path.abspath('../../'))
to sys.path.insert(0, os.path.abspath('.hyperlearn'))
Only the one line is enough to fix the problem!