-
Notifications
You must be signed in to change notification settings - Fork 132
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
Astropy & Photutils Libraries #812
Comments
As the README says, the tool only runs on Linux, not Mac. |
The "version 0.0.0" issue was caused by build-wheel currently disabling PEP 517, which astropy depends on in order to get its version number from setuptools-scm. I was able to work around this using the following meta.yaml:
And the following patch, which you should put in astropy/patches/chaquopy.patch:
This allowed the build to complete, though I haven't tested it. It looks like the build used NumPy headers from the build environment, which may cause problems. If so, you may need to follow the example in packages/pandas by adding |
I was not able to reproduce your last error:
|
I did not use any patch while trying to build it. What is the patch for and is your example enough for me?
In fact, astropy requires NumPy, extension-helpers and pyerfa. I tried to add NumPy and extension-helpers in my requirements.txt file and I was able to pass Gradle build without any error. However, I need to export a whl for Pyerfa too. Therefore while trying to build the whl file, I installed Numpy, extension-helpers and pyerfa using pip beforehand to overcome errors. My aim is to utilize photutils (https://photutils.readthedocs.io/en/stable/install.html) library which depends on Numpy and Astropy. I will try your meta.yml file and your patch and share the results. Thank you for your help and your detailed reply! |
Also, I checked the requirements for astropy and saw that the Numpy version should be higher (>1.20) than the original one for Python 3.8 (1.19.5.0). If I want to work with Python 3.9 or Python 3.10 (totally fine for me), then I have a problem with SciPy since it does not have any version for Python 3.9 or Python 3.10. What do you think I should do? Should I work to generate a 3.9 version for SciPy or another way around? Is this achievable? Thank you |
I tried to build scipy with the existing meta.yml file and patches with Python 3.9: The log I got: |
It's not possible to build SciPy with the current version of the tool, because it doesn't have Fortran support yet. However, we actually do have some newer NumPy wheels for Python 3.8: see pypi-extra. The reason they're not in the main repository is because they're incompatible with our old version of TensorFlow (#559 (comment)), but they're otherwise fine, so you should be able to use them for this. I'm starting to lose track of all the different things you're building, so if you need any more help, please make a GitHub fork of this repository and push your changes to it, so I can see them all in one place. |
Thank you for sharing! These NumPy whl files will be fine for me. I will try to create whls for these libraries:
This is my aim. I will try to build android versions of these libraries. I will let you know with my GitHub fork soon. Thank you again |
I tried to build this for astropy but which ABI did you use? |
You can find my fork here: This is the error I encountered:
|
I've created a pull request #846 based on your fork, with an additional change to add numpy to the requirements file. With this recipe, I was able to complete the build for Python 3.8 on all 4 ABIs, though I still haven't tested the result. See above for where to get the numpy wheel files: #812 (comment) If you have any more problems, please save the FULL build log to a file, and attach it by dragging it into the comment box. |
It is good to know! I will try it as soon as possible. I will also need pyerfa and photutils libraries to complete my system. After trying astropy, I will try to compile these libraries. Thank you for your help |
I encountered errors while trying to build astropy on my own. I tried Armeabi, arm64 and other versions but did not solve it. Is it related to my NDK version? I am using: 22.1.7171670 |
Could you share the whl files so that I can test the astropy |
Sorry, I'm very busy at the moment so I won't have time to look at this for the next few weeks. |
I see thank you for your help. I will try to utilize different NDK versions maybe I can solve it |
The cause of the failure is probably the Anyway, I've copied the wheels I built to https://chaquo.com/pypi-test/, so you can use them by adding an |
Thank you for your reply! I will test those and will let you know about the outcome. In addition, I want to build Photutils that is based on Astropy |
Sorry for the late reply, I tried to test build Astropy, but encountered this error: "Failed to install pyerfa>=2.0 from https://files.pythonhosted.org/packages/a7/51/b1b8770853d82726dfa5d1079de29c32f144e10eb65b3852b1cd2b39f341/pyerfa-2.0.0.3.tar.gz#sha256=d77fbbfa58350c194ccb99e5d93aa05d3c2b14d5aad8b662d93c6ad9fff41f39 (from astropy==5.1.0)." The error comes from the dependency of astropy, namely pyerfa. Is there an active development on pyerfa? I tried to build pyerfa on my fork This is the error I got pyerfa.log I do not what I should add like you did in previous ones so that I cannot bother you. My goal is to test the wheel's status by attempting one of the samples provided by the Astropy package. |
I solved it, I forgot to remove 0 original version was 5.1. Updated error log can be found: |
Your pyerfa log contains the same error message as astropy ("is incompatible with elf64-x86-64"), and probably has the same cause ( I don't know why this is happening to you, but it may have something to do with this:
In general, you should not The only packages that need to be available at build time are those which are listed in So before you continue, please delete your virtual environment and re-create it from server/pypi/requirements.txt. Meanwhile, I've updated #846 to add numpy as a I've copied my (untested) pyerfa wheels to https://chaquo.com/pypi-test/. |
I believe pyerfa works well after I used your wheels. I tried to delete and recreate a new environment based on server/pypi/requirements.txt and I did not install any dependent library such as numpy etc, but could not solve the problem. Still, I got the same errors. I tried to build photutils as you explained but still got same errors. I updated my fork to add host, build and a similar patch to astropy Apart from that, I tried to test astropy on mobile but encountered such error: The code that I used original was from here import astropy.coordinates as coord
import astropy.units as u
def rv_to_gsr(c, v_sun=None):
"""Transform a barycentric radial velocity to the Galactic Standard of Rest
(GSR).
The input radial velocity must be passed in as a
Parameters
----------
c : `~astropy.coordinates.BaseCoordinateFrame` subclass instance
The radial velocity, associated with a sky coordinates, to be
transformed.
v_sun : `~astropy.units.Quantity`, optional
The 3D velocity of the solar system barycenter in the GSR frame.
Defaults to the same solar motion as in the
`~astropy.coordinates.Galactocentric` frame.
Returns
-------
v_gsr : `~astropy.units.Quantity`
The input radial velocity transformed to a GSR frame.
"""
if v_sun is None:
v_sun = coord.Galactocentric().galcen_v_sun.to_cartesian()
gal = c.transform_to(coord.Galactic)
cart_data = gal.data.to_cartesian()
unit_vector = cart_data / cart_data.norm()
v_proj = v_sun.dot(unit_vector)
return c.radial_velocity + v_proj
def main():
coord.galactocentric_frame_defaults.set("latest")
icrs = coord.SkyCoord(
ra=258.58356362 * u.deg,
dec=14.55255619 * u.deg,
radial_velocity=-16.1 * u.km / u.s,
frame="icrs",
)
v_sun = coord.Galactocentric().galcen_v_sun.to_cartesian()
gal = icrs.transform_to(coord.Galactic)
cart_data = gal.data.to_cartesian()
unit_vector = cart_data / cart_data.norm()
v_proj = v_sun.dot(unit_vector)
rv_gsr = icrs.radial_velocity + v_proj
print(rv_gsr)
rv_gsr = rv_to_gsr(icrs)
print(rv_gsr)
return rv_gsr I encountered such error, I checked but could not find the error. It seems the error is based on Astropy, but although I checked the mentioned file I did not find the error.
It would be great if you are able to build Photutils for me. Although I am not sure about Astropy code, I have more experience and knowledge about Photutils. Thank you for your support |
It looks like the Astropy error is caused by it attempting to read its own Python code. This can be worked around by adding |
Your photutils recipe worked first time for me, although, as I explained here, there's no need for I've updated #846, and copied my (untested) wheels to https://chaquo.com/pypi-test/. Looking at your photutils build log, it doesn't mention applying the patch. Are you sure you've tried to build it since adding the patch file? Without the patch, the numpy include directory will be silently omitted because of this code in extension-helpers. |
Hi @mhsmith, I tested astropy and after adding After running it I encountered such error:
As it can be seen, this is the problem:
The function that I utilized inside photutils using Convolution and I need to utilize convolution. Did you encounter such error or do you have any suggestions to overcome? Thank you in advance |
I did not encounter such error while trying to run everything on the same environment on my local machine. |
Thanks for the report: I've created #892 to track the general issue. Meanwhile, you can work around it by running the following before you import photutils:
|
It is working right now! Thank you for your support and your help! I believe after some testing, you can add Astropy and Photutils libraries to package repository as well! |
These were both caused by #909, which is fixed in the current version of build-wheel. |
Based on astropy/astropy#14035, it looks like this might no longer be a problem in Astropy 5.2, so I'll try building 5.2.2, which is the last version to support Python 3.8. |
Unfortunately Astropy 5.2 requires NumPy 1.20, so we can't release it into the main repository for Python 3.8. So I'll go back to Astropy 5.1.1 and patch it in the same way as |
The Photutils tutorial, which I'm using to write the tests, requires SciPy. So that means I can only release it for Python 3.8, and to be compatible with our current SciPy version, I'll have to go back to Photutils 1.1.0. I'll leave the builds of Photutils 1.8.0 in pypi-extra, but I have not tested them. |
The following packages are now in the public repository:
As mentioned above, to use astropy you must add the line |
I am trying to build Astropy (https://pypi.org/project/astropy/5.0/#files) and Photutils (https://pypi.org/project/photutils/) libraries for my Android application. I am trying to follow the steps on this webpage (https://github.com/chaquo/chaquopy/tree/master/server/pypi) to create android based whl files for my libraries.
I am trying to build whl files, but I saw this warning. I am not sure about the version 0.0.0 statement. Is it not going to create whl file? Or is the whl output corrupted? What should I do to create versions for my Android app?
Thank you.
My setup:
The text was updated successfully, but these errors were encountered: