gammapy / gammapy

A Python package for gamma-ray astronomy
https://gammapy.org
BSD 3-Clause "New" or "Revised" License
232 stars 197 forks source link

Fix the sherpa installation #5233

Open bkhelifi opened 7 months ago

bkhelifi commented 7 months ago

Gammapy version gammapy 1.2, under Linux

Bug description The installation of the environment with mamba/conda fails because of sherpa. This has been reported by several users.

      checking dependency style of gcc... gcc3
      checking for bison... no
      checking for byacc... no
      checking for yacc... no
      configure: error: bison/byacc/yacc not found.
                Please install bison
      configure: error: ./configure failed for region-4.14
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for sherpa

Even afterwards after an installation without sherpa, the command pip install sherpa==4.16 fails.

registerrier commented 7 months ago

One option here is to remove the version constraint on sherpa, or use 4.15 instead (in which case conda should work).

Astro-Kirsty commented 7 months ago

Do we know what versions of Linux this happens for? Just curious, because I did not encounter this with Ubuntu 22.04

bkhelifi commented 7 months ago

I have the same ubuntu version. Within the env of the version 1.2, pip install sherpa==4.15 leads to the same error... I have in the output "configure: error: bison/byacc/yacc not found" for the configuration of region-4.14

vmharvey commented 6 months ago

I have the same issue on Ubuntu 22.04.4. I found a bug on the sherpa issue tracker which shows the same problem occurring: https://github.com/sherpa/sherpa/issues/828. From this comment https://github.com/sherpa/sherpa/issues/828#issuecomment-644990512, assuming it's still true after a few years, it appears that installing sherpa via pip triggers a source install, which requires the user to have all the sherpa dependencies, including the build system bison.

Modifying the env file by removing sherpa==4.16 from the pip section and putting sherpa=4.15 in the conda section fixed the problem for me:

  - tqdm
  - sherpa=4.15
  - pip:
    - ray[default]==2.9

It appears that the official sherpa channel on anaconda only has version 4.15, hence the small downgrade required.

Astro-Kirsty commented 6 months ago

Sherpa was initially moved to the pip installation due to both apple and windows systems not being able to install it through this method. https://github.com/gammapy/gammapy/pull/4983#issuecomment-1854379008 As a user of these systems sherpa cannot be installed outside pip, so this line of the environment file needs to be removed.

Not sure how we wish to proceed here? Appears to be some issue with any combination with at least one operating system :(

AtreyeeS commented 2 months ago

This would be good to sort before the 1.3 release. Shall we remove sherpa from the required dependencies and advise people to optionally install it? I recently installed the dev version on Ubuntu 22.04, and had the same problem

bkhelifi commented 2 months ago

It looks to me the most reasonable...

registerrier commented 1 month ago

A new version of sherpa has been released: 4.17. It apparently changes some of the test values. We need to understand this. In the meantime, and to solve the installation issue that appeared with 4.16, I would suggest to force sherpa<=4.15 in the requirements.

bkhelifi commented 1 month ago

It works on unbuntu!