-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected issue with package import, using cython and numpy #5181
Comments
This issue may be related, it could be a problem with I tried to build our
This seems to reproduce one sequence of events that the issue linked above describes as causing the bug. This may resolve itself with a bugfix release of numpy, but I don't know what I can do as an RTD user to run my own commands that would prevent this problem. I can't forcibly uninstall packages, and I can't get |
What I can see is conda installing a new version of python now (3.7 instead of 3.6), maybe some incompatible packages? |
Also, looks like the same problem as #3829 |
@stsewd Good idea, I'll try rebuilding a new |
I am still seeing these issues. As before, all of these builds report to ReadTheDocs as "passing." Here is what I've tried. 1. Made new environment.ymlFollowing @stsewd's idea, I built a new conda create --yes -n freud-rtd python=3.6 cython tbb tbb-devel numpy scipy sphinx sphinx_rtd_theme mock pillow
conda activate freud-rtd
conda install --yes -c conda-forge nbsphinx
conda env export > environment.yml
Result: https://readthedocs.org/projects/freud/builds/8482593/ Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/freud/conda/fix-rtd/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/fix-rtd/lib/python3.6/site-packages/freud/__init__.py", line 5, in <module>
from . import box
File "freud/box.pyx", line 36, in init freud.box
AttributeError: type object 'freud.box.Box' has no attribute '__reduce_cython__' 2. Tried downgrading Cython to 0.28.5 (known to work previously)
Result: https://readthedocs.org/projects/freud/builds/8482819/ Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/freud/conda/fix-rtd/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/fix-rtd/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/fix-rtd/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/fix-rtd/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/fix-rtd/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/fix-rtd/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/fix-rtd/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/fix-rtd/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__' This seems to be the bug from numpy 1.16 (pip) failing to coexist with numpy 1.15.4 (conda). 3. Forced setup.py to use 1.15.4I edited
Result: https://readthedocs.org/projects/freud/builds/8483033/ Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/freud/conda/fix-rtd/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/fix-rtd/lib/python3.6/site-packages/freud/__init__.py", line 14, in <module>
from . import order
File "__init__.pxd", line 872, in init freud.order
ValueError: numpy.ufunc has the wrong size, try recompiling. Expected 192, got 216 4. Remove install_requires from setup.pyI removed numpy from the
Result: https://readthedocs.org/projects/freud/builds/8483144/ Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/freud/conda/fix-rtd/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/fix-rtd/lib/python3.6/site-packages/freud/__init__.py", line 14, in <module>
from . import order
File "__init__.pxd", line 872, in init freud.order
ValueError: numpy.ufunc has the wrong size, try recompiling. Expected 192, got 216 Seems like this is still using a conflicting numpy installation, but from where? I have a Currently, I have "Use system packages: Give the virtual environment access to the global site-packages dir." disabled in the Advanced Settings. I will keep this issue updated if I am able to find a different error message or a working configuration. Other ideas to try:
|
Continuing to test... 5. Minimal (tbb + cython) conda environment (conda-forge)It might be possible to use only TBB and Cython from
Result: https://readthedocs.org/projects/freud/builds/8519670/ Processing /home/docs/checkouts/readthedocs.org/user_builds/freud/checkouts/fix-rtd
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'error'
Complete output from command /home/docs/checkouts/readthedocs.org/user_builds/freud/conda/fix-rtd/bin/python /home/docs/checkouts/readthedocs.org/user_builds/freud/conda/fix-rtd/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpipwqys9e:
Traceback (most recent call last):
File "setup.py", line 168, in <module>
from Cython.Build import cythonize
ModuleNotFoundError: No module named 'Cython'
... # and then our setup script catches this and raises a user-friendly exception |
@stsewd I think I need to know more about how the actual ReadTheDocs image works to fix this problem. Using a Docker container ( Specifically, when does the conda environment get activated? It doesn't show that step in the build output, but surely it has to happen. cd ~
git clone --no-single-branch --depth 50 https://github.com/glotzerlab/freud.git
cd freud
git checkout --force origin/fix-rtd
git clean -d -f -f
git submodule update --init
conda env create --name fix-rtd --file environment.yml
conda install --yes --name fix-rtd mock pillow sphinx sphinx_rtd_theme
source activate fix-rtd
python -m pip install -U recommonmark readthedocs-sphinx-ext
python -m pip install --ignore-installed .
cd ~ # so that we don't import the local, un-built package
python -c "import freud" # succeeds |
We don't call activate, we just execute the commands with the python binary from conda. Maybe we are losing something when skipping the activate step? |
@stsewd I tried installing The first failing build was Jan. 22: https://readthedocs.org/projects/freud/builds/8431508/ I see some commits (by you) over that time span that change the handling of |
I tried enabling the option to use I also tried creating a new |
We have this issue #2776, isn't clear for me why we don't install requirements in conda |
How should we proceed with testing the |
Sorry, wrong button, I'll try to replicate this locally in the next days. If it was working before, I have some guess |
Awesome, @stsewd. I got pretty far with installing RTD locally. I got it to start running Docker containers to build the software but the containers fail when they get to conda commands for some reason. I have not had time to debug that yet. I look forward to your tests, hopefully we can identify the cause and get this resolved soon. Thanks again for your help. |
I didn't read the whole thread. Why do you need to install conda dependencies from If you want to install things with |
@humitos Good idea, I hadn't considered using that approach in the conda environment. My current understanding of the problem(s) is that conflicting versions of numpy were being installed (>=1.16 and <1.16 can't coexist, it seems). This may have been due to a change in the way packages are installed and detected in the environment (RTD switched from |
@stsewd @humitos It seems that I've been able to solve the problem by circumventing I think there is still an underlying bug with how Working build: https://readthedocs.org/projects/freud/builds/8531307/ |
@bdice thanks for the extensive testing and the final update on this! Appreciated! |
Details
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, specificallynumpy
from theopenblas
tomkl
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/):
Previous error from earlier in the month (https://readthedocs.org/projects/freud/builds/8431508/):
The text was updated successfully, but these errors were encountered: