Closed jcgoble3 closed 3 years ago
As an additional note, pyfits contains a C component, but it is optional and we are intending to use it without that component, i.e. as a pure Python package.
setup.py scripts can't import other packages being installed at the same time. There's no way that could work anyway, because those packages contain native components built for Android, not for your build machine.
If the extension is truly optional, then you can probably work around this by making a small change to the pyfits source code:
numpy_extension_hook
. You might also have to remove the [extension=pyfits.compression]
block.setup.py bdist_wheel
, copy the resulting wheel into your app source tree, and change your build.gradle file to install it using a local filename, as shown in the documentation; ORsetup.py sdist
, and use the resulting sdist in the same way.numpy and the optional C component inside pyfits (i.e. compression
) are independent of each other. numpy IS needed, but the compression
component is not.
I'll give this a try next week (I'm off work for the weekend), but I can't guarantee it will work if numpy_extension_hook
is removed (I haven't investigated what it does).
It looks like the only thing numpy_extension_hook
does is locate the native Numpy header files. Once you remove the extension, I don't think those headers will be required anymore. Of course, Numpy will still be needed at runtime, but that's no problem.
Yep, that looks right. I have another project for today and am off tomorrow but will try this later this week unless I get bored today.
I hope you managed to solve your problem. If you need more help, please reopen this issue and give details.
Apologies for failing to check back. I ultimately cloned the pyfits repo from GitHub, checked out the 3.4 tag, removed the C files and the numpy_extension_hook
, and created a local wheel to install from. That ended up being successful, and everything is now working. Thanks for the help!
As a temporary (and potentially permanent) workaround for astropy (#349), we are attempting to use pyfits for part of our project. We also need numpy and scipy, so my build.gradle currently contains this:
The Chaquopy plugin correctly fetches the native wheels from your repo for numpy and scipy, and the sdist of pyfits from pypi.org. The next thing it tries to do is run
setup.py bdist_wheel
for pyfits, which fails because the setup.py contains a functionnumpy_extension_hook
that requires numpy to already be installed, which it isn't because Chaquopy has only downloaded the wheel.How do I force Chaquopy to completely install numpy before attempting to process pyfits? I have tried removing pyfits from build.gradle, building, and then re-adding it, but the installation is run anew each time. I have also tried removing numpy from build.gradle and letting it be installed as a dependency of pyfits, but that also fails in the same manner. I basically need a two-stage installation, where I install numpy completely in the first stage and then begin the second stage where pyfits is installed.
Any ideas?
Here is the complete output of
gradlew.bat build
(produced with Gradle plugin 4.0.1, but fails identically with 4.0.0):