simonsobs / pixell

A rectangular pixel map manipulation and harmonic analysis library derived from Sigurd Naess' enlib.
Other
40 stars 30 forks source link

macOS deployment problems #217

Closed ickc closed 1 week ago

ickc commented 1 year ago

What I Did

See the PR in https://github.com/conda-forge/staged-recipes/pull/22976

And the build failure in https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=746884&view=logs&j=e35d4f76-8ff2-5536-d795-df91e63eb9f7&t=fa7b4b17-b6ff-5c9c-8cfc-15f888c92310

Basically it is related to this part https://github.com/simonsobs/pixell/blob/master/setup.py#L31-L56 that implements discovery of gcc. I think it should (perhaps with helpful messages) use the gcc from the environment, not auto-discovering all available gccs and choose by itself.

JBorrow commented 10 months ago

Hi @ickc, I have tried to address this in #235 that now uses a unified environment for MacOS and Linux builds, and checks if the compilers have the required features. Let me know if you think this will help (my experience with conda is limited), or if we need more.

msyriac commented 8 months ago

@ickc does your PR get us on conda feedstock correctly?

ickc commented 8 months ago

It is still failing at https://github.com/conda-forge/staged-recipes/pull/22976/checks?check_run_id=19330248847

Because you are assuming gcc but

On macOS, only LLVM’s OpenMP implementation llvm-openmp is supported. This implementation is used even in Fortran code compiled using GNU’s gfortran. From https://conda-forge.org/docs/maintainer/knowledge_base.html#switching-openmp-implementation

JBorrow commented 8 months ago

Right... Is this because of our flags? We should be using something other than -fopenmp?

ickc commented 8 months ago

Unfortunately the flag -fopenmp is not the problem. CC, CXX, etc. are not problems either as you only override it when not available (but in conda-forge build stage it is already set and point to clang).

The problem is somehow it cannot locate omp.h.

I no longer have access to Intel macOS so it is very difficult to trouble shot from my side (only through CI so it is slow). Also, realistically is there anyone who is using this with Intel macOS anymore? May be we can just support conda with Linux only?

msyriac commented 8 months ago

I have no insight on what is happening here, but I'm fairly certain there is and will continue to be a large number of users who would prefer to install pixell on an Intel Mac with conda.

ickc commented 8 months ago

I opened a draft PR to drive discussion. That PR doesn't completely fix it yet: #243

Others who possess an Intel Mac can help by running conda build locally which has faster turn-around to see why fails.

My suggestion is to release the Linux build on conda-forge only for now, thoughts?

msyriac commented 8 months ago

That sounds good to me as a start.

defjaf commented 8 months ago

I agree that it probably isn't the root cause of the issue, but just to record this somewhere (I suspect it's generally known, but just in case):

To use openmp under clang (on Apple silicon or intel), you have to

  1. Have openmp installed (by conda or homebrew)
  2. add -Xclang -fopenmp to CPPFLAGS, add -lomp to LIBS (or equivalent)
JBorrow commented 8 months ago

Another complication here is that we will need to change the build tool to Meson soon. So... This may all be nullified by that change. I don't know very well how Meson works...

ickc commented 8 months ago

Interesting, can I ask if other solutions are explored, including poetry, CMake, etc.? And about Cython used here, is pybind11 explored? Feel free to point me to links where this is already discussed.

I am glad the build tool here will be changed.

JBorrow commented 8 months ago

We want the build system to be one that is used within the scientific python community, so we were looking at what numpy and scipy are transitioning to now that distutils is deprecated: https://github.com/simonsobs/pixell/issues/198

JBorrow commented 8 months ago

AFAIK Poetry does not support fortran extensions nicely.

ickc commented 8 months ago

We want the build system to be one that is used within the scientific python community, so we were looking at what numpy and scipy are transitioning to now that distutils is deprecated: #198

In the "scientific Python community", the most important build system is conda which is solving some non-trivial distribution problem for non-pure Python stack. In this sense whichever the Python build system is used, it is an intermediate step towards building the conda package.

(I have no experience on Meson and I'm not against that choice without knowing more, but I just want to make sure conda is in the picture when making that choice.)

For example, CMake is known to work well there: https://conda-forge.org/docs/maintainer/knowledge_base.html#using-cmake

On the other hand, it seems people distributing both to PyPI and conda with CMake often have 2 different built systems (setup.py magic and then plain old CMake), so it would be nice if using Meson would make that easier.

It would be interesting to see this roll out with Meson. Do you have an approximate timeline for the transition to be done?

samueldmcdermott commented 4 months ago

+1 for making this visible on conda, though I am now having issues on Mac with pip install pixell and a GitHub workflow for a different repo that includes python -m pip install pixell has also started failing recently. Both of these cite a ModuleNotFoundError: No module named 'numpy.distutils'

JBorrow commented 4 months ago

Please use python < 3.12

JBorrow commented 1 week ago

@samueldmcdermott you should now have no problem installing.

samueldmcdermott commented 1 week ago

I forgot to post here but yes I checked the other day and the new version does seem to resolve this -- thanks!