readthedocs.org: Unexpected issue with package import, using cython and numpy
Details
- Read the Docs project URL: https://freud.readthedocs.io/
- Build URL (if applicable): https://readthedocs.org/projects/freud/builds/8431508/ and https://readthedocs.org/projects/freud/builds/8452348/
- Read the Docs username (if applicable): bdice
Expected Result
Build passes, documentation shows module info.
Actual Result
Build passes but doesn’t actually contain module documentation. Builds should show as failing.
Expected result is on stable: https://freud.readthedocs.io/en/stable/box.html Failing result is on latest: https://freud.readthedocs.io/en/latest/box.html
The package appears to build correctly, but we think there is something going wrong with Cython or NumPy and we can’t get enough info to debug it ourselves. When RTD installs on top of our environment.yml
file, it changes some package versions, specifically numpy
from the openblas
to mkl
variants. I don’t think that openblas/mkl is the problem, but changing numpy versions may very well invalidate something we rely on. We’ve seen two different error messages but it’s not clear what causes either one.
This failure began appearing about simultaneously with our switch from Bitbucket (https://bitbucket.org/glotzer/freud.git) to GitHub (https://github.com/glotzerlab/freud.git) so we’re not sure what to blame. However, I think I ruled out the repo URL change as a cause. I tried changing the URL back to Bitbucket and the issue can be reproduced. Also I created a fresh RTD project with the GitHub URL and it fails in the same way.
Most recent error (https://readthedocs.org/projects/freud/builds/8452348/):
/home/docs/checkouts/readthedocs.org/user_builds/freud/checkouts/awesome-readme/doc/source/box.rst:7: WARNING: failed to import freud.box.Box
/home/docs/checkouts/readthedocs.org/user_builds/freud/checkouts/awesome-readme/doc/source/box.rst:7: WARNING: failed to import freud.box.ParticleBuffer
WARNING: autodoc: failed to import module 'box' from module 'freud'; the following exception was raised:
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/freud/conda/awesome-readme/lib/python3.7/site-packages/sphinx/ext/autodoc/importer.py", line 154, in import_module
__import__(modname)
File "/home/docs/checkouts/readthedocs.org/user_builds/freud/conda/awesome-readme/lib/python3.7/site-packages/freud/__init__.py", line 5, in <module>
from . import box
File "freud/box.pyx", line 37, in init freud.box
AttributeError: type object 'freud.box.Box' has no attribute '__reduce_cython__'
Previous error from earlier in the month (https://readthedocs.org/projects/freud/builds/8431508/):
/home/docs/checkouts/readthedocs.org/user_builds/freud/checkouts/latest/doc/source/box.rst:7: WARNING: failed to import freud.box.Box
/home/docs/checkouts/readthedocs.org/user_builds/freud/checkouts/latest/doc/source/box.rst:7: WARNING: failed to import freud.box.ParticleBuffer
WARNING: autodoc: failed to import module 'box' from module 'freud'; the following exception was raised:
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/freud/conda/latest/lib/python3.6/site-packages/sphinx/ext/autodoc/importer.py", line 154, in import_module
__import__(modname)
File "/home/docs/checkouts/readthedocs.org/user_builds/freud/conda/latest/lib/python3.6/site-packages/freud/__init__.py", line 7, in <module>
from . import common
File "/home/docs/checkouts/readthedocs.org/user_builds/freud/conda/latest/lib/python3.6/site-packages/freud/common.py", line 7, in <module>
import numpy as np
File "/home/docs/checkouts/readthedocs.org/user_builds/freud/conda/latest/lib/python3.6/site-packages/numpy/__init__.py", line 142, in <module>
from . import core
File "/home/docs/checkouts/readthedocs.org/user_builds/freud/conda/latest/lib/python3.6/site-packages/numpy/core/__init__.py", line 59, in <module>
from . import numeric
File "/home/docs/checkouts/readthedocs.org/user_builds/freud/conda/latest/lib/python3.6/site-packages/numpy/core/numeric.py", line 3093, in <module>
from . import fromnumeric
File "/home/docs/checkouts/readthedocs.org/user_builds/freud/conda/latest/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 17, in <module>
from . import _methods
File "/home/docs/checkouts/readthedocs.org/user_builds/freud/conda/latest/lib/python3.6/site-packages/numpy/core/_methods.py", line 158, in <module>
_NDARRAY_ARRAY_FUNCTION = mu.ndarray.__array_function__
AttributeError: type object 'numpy.ndarray' has no attribute '__array_function__'
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (7 by maintainers)
@bdice thanks for the extensive testing and the final update on this! Appreciated!
@stsewd @humitos It seems that I’ve been able to solve the problem by circumventing
pip
entirely. I discovered that I was running v1 of thereadthedocs.yml
schema, so I upgraded that to v2. (I’m not sure if upgrading this was necessary.) I created a fresh conda environment with all requirements and installed the package withsetuptools
, and it seems to build. I may have been able to fix this by just usingsetuptools
with config v1, but I’m not sure. I had tried usingsetuptools
via the web interface earlier but I think I must not have realized that the web interface buttons didn’t affect my build at all (the config file is the primary source of truth, in my understanding).I think there is still an underlying bug with how
pip
was being used by RTD, since usingpip
instead ofsetuptools
should still detect all the packages I installed (namelycython
and the proper version ofnumpy
). This used to work fine withpip
until the recent changes mentioned above. I’ll close this issue for now - thanks again to both of you for the helpful suggestions and support. 🎉🎉🎉Working build: https://readthedocs.org/projects/freud/builds/8531307/