fermiPy/fermipy

Fermipy is not compatible with recent versions of its dependencies

Closed this issue · 3 comments

When just installing fermipy with either conda or even pip one ends up with a non-working installation, because fermipy is not compatible with more recent version of its dependencies, such as numpy>1.22 or gammapy>1.0. It seems there is no sufficient resources to keep fermipy up to date. But in this case it would be good to let the users know which are the latest compatible versions, by either putting upper constraints in setup.py (non ideal but probably hard to avoid for an un-maintained package) or at least provide some conda environment.yml or requirements.txt file with a working environment specification (the one in the base repo does not work...). Otherwise the installation is a version guessing game, which is very frustrating for users.

So my concrete question here is which are the latest compatible versions of the following dependencies:

  "numpy>=1.16",
  "pyyaml",
  "scipy",
  "astropy",
  "matplotlib>=3.3",
  "gammapy>=0.18",
  "healpy",
  "astropy-healpix"

Thanks!

@adonath Could you solve the above said issue. I have the same problem. Running the analysis script for fermipy, i get the following log file :

fermipy version 1.2.0
ScienceTools version 2.2.0
2023-12-30 22:50:12 INFO GTAnalysis.setup(): Running setup.
2023-12-30 22:50:12 INFO GTBinnedAnalysis.setup(): Running setup for component 00
2023-12-30 22:50:12 INFO GTBinnedAnalysis.run_gtapp(): Running gtselect.
2023-12-30 22:50:12 INFO GTBinnedAnalysis.run_gtapp(): time -p gtselect infile=/home/dell/Documents/1H1914-194/evfile_00.txt outfile=/home/dell/Documents/1H1914-194/ft1_00.fits ra=289.4383850097656 dec=-19.36280059814453 rad=7.5710678118654755 tmin=239557417.0 tmax=686188805.0 emin=1000.0 emax=300000.0 zmin=0.0 zmax=90.0 evclass=128 evtype=3 convtype=-1 phasemin=0.0 phasemax=1.0 evtable="EVENTS" chatter=3 clobber=yes debug=no gui=no mode="ql"
2023-12-30 22:50:13 INFO GTBinnedAnalysis.run_gtapp(): This is gtselect version HEAD
2023-12-30 22:50:14 INFO GTBinnedAnalysis.run_gtapp(): Applying filter string: ((EVENT_CLASS&o200) != o0) && angsep(RA,DEC,289.438385,-19.3628006) < 7.571067812 && ((EVENT_TYPE&o3) != o0) && 1000 < ENERGY && ENERGY <= 300000 && 239557417 < TIME && TIME <= 686188805 && 0 < ZENITH_ANGLE && ZENITH_ANGLE <= 90 && gtifilter()
2023-12-30 22:50:20 INFO GTBinnedAnalysis.run_gtapp(): Done.
2023-12-30 22:50:20 INFO GTBinnedAnalysis.run_gtapp(): Finished gtselect. Execution time: 7.89 s
2023-12-30 22:50:20 INFO GTBinnedAnalysis.run_gtapp(): Running gtltcube.
2023-12-30 22:50:20 INFO GTBinnedAnalysis.run_gtapp(): time -p gtltcube evfile="/home/dell/Documents/1H1914-194/ft1_00.fits" evtable="EVENTS" scfile=L2312300759163550A79855_SC00.fits sctable="SC_DATA" outfile=/home/dell/Documents/1H1914-194/ltcube_00.fits dcostheta=0.025 binsz=1.0 phibins=0 tmin=0.0 tmax=0.0 file_version="1" zmin=0.0 zmax=90.0 chatter=2 clobber=yes debug=no gui=no mode="ql"
2023-12-30 22:50:21 INFO GTBinnedAnalysis.run_gtapp(): Working on file L2312300759163550A79855_SC00.fits
2023-12-31 04:35:25 INFO GTBinnedAnalysis.run_gtapp(): .....................!
2023-12-31 04:35:32 INFO GTBinnedAnalysis.run_gtapp(): Finished gtltcube. Execution time: 20712.24 s
2023-12-31 04:35:43 INFO GTBinnedAnalysis.run_gtapp(): Running gtbin.
2023-12-31 04:35:43 INFO GTBinnedAnalysis.run_gtapp(): time -p gtbin evfile=/home/dell/Documents/1H1914-194/ft1_00.fits scfile=L2312300759163550A79855_SC00.fits outfile=/home/dell/Documents/1H1914-194/ccube_00.fits algorithm="ccube" ebinalg="LOG" emin=1000.0 emax=300000.0 enumbins=20 ebinfile=NONE tbinalg="LIN" tbinfile=NONE nxpix=100 nypix=100 binsz=0.1 coordsys="CEL" xref=289.4383850097656 yref=-19.36280059814453 axisrot=0.0 rafield="RA" decfield="DEC" proj="AIT" hpx_ordering_scheme="RING" hpx_order=3 hpx_ebin=yes hpx_region="" evtable="EVENTS" sctable="SC_DATA" efield="ENERGY" tfield="TIME" chatter=3 clobber=yes debug=no gui=no mode="ql"
2023-12-31 04:35:44 INFO GTBinnedAnalysis.run_gtapp(): This is gtbin version HEAD
2023-12-31 04:36:12 INFO GTBinnedAnalysis.run_gtapp(): Finished gtbin. Execution time: 29.55 s
2023-12-31 04:36:12 INFO GTBinnedAnalysis.run_gtapp(): Running gtexpcube2.
2023-12-31 04:36:12 INFO GTBinnedAnalysis.run_gtapp(): time -p gtexpcube2 infile=/home/dell/Documents/1H1914-194/ltcube_00.fits cmap=none outfile=/home/dell/Documents/1H1914-194/bexpmap_00.fits irfs="P8R3_SOURCE_V3" evtype=3 edisp_bins=-1 nxpix=360 nypix=180 binsz=1.0 coordsys="CEL" xref=0.0 yref=0.0 axisrot=0.0 proj="CAR" ebinalg="LOG" emin=1000.0 emax=300000.0 enumbins=20 ebinfile="NONE" hpx_ordering_scheme="RING" hpx_order=6 bincalc="EDGE" ignorephi=no thmax=180.0 thmin=0.0 table="EXPOSURE" chatter=3 clobber=yes debug=no mode="ql"
2023-12-31 04:36:14 INFO GTBinnedAnalysis.run_gtapp(): This is gtexpcube2 version HEAD
2023-12-31 04:36:15 INFO GTBinnedAnalysis.run_gtapp(): Using evtype=3 (i.e., FRONT/BACK irfs)
2023-12-31 04:36:15 INFO GTBinnedAnalysis.run_gtapp(): ResponseFunctions::load: IRF used: P8R3_SOURCE_V3
2023-12-31 04:36:15 INFO GTBinnedAnalysis.run_gtapp(): event_types: 0 1
2023-12-31 04:36:22 INFO GTBinnedAnalysis.run_gtapp(): Computing binned exposure map....................!
2023-12-31 04:36:23 INFO GTBinnedAnalysis.run_gtapp(): Finished gtexpcube2. Execution time: 10.33 s
2023-12-31 04:36:23 INFO GTBinnedAnalysis.run_gtapp(): Running gtexpcube2.
2023-12-31 04:36:23 INFO GTBinnedAnalysis.run_gtapp(): time -p gtexpcube2 infile=/home/dell/Documents/1H1914-194/ltcube_00.fits cmap=none outfile=/home/dell/Documents/1H1914-194/bexpmap_roi_00.fits irfs="P8R3_SOURCE_V3" evtype=3 edisp_bins=0 nxpix=100 nypix=100 binsz=0.1 coordsys="CEL" xref=289.4383850097656 yref=-19.36280059814453 axisrot=0.0 proj="CAR" ebinalg="LOG" emin=1000.0 emax=300000.0 enumbins=20 ebinfile="NONE" hpx_ordering_scheme="RING" hpx_order=6 bincalc="EDGE" ignorephi=no thmax=180.0 thmin=0.0 table="EXPOSURE" chatter=3 clobber=yes debug=no mode="ql"
2023-12-31 04:36:23 INFO GTBinnedAnalysis.run_gtapp(): This is gtexpcube2 version HEAD
2023-12-31 04:36:23 INFO GTBinnedAnalysis.run_gtapp(): Using evtype=3 (i.e., FRONT/BACK irfs)
2023-12-31 04:36:23 INFO GTBinnedAnalysis.run_gtapp(): ResponseFunctions::load: IRF used: P8R3_SOURCE_V3
2023-12-31 04:36:23 INFO GTBinnedAnalysis.run_gtapp(): event_types: 0 1
2023-12-31 04:36:25 INFO GTBinnedAnalysis.run_gtapp(): Computing binned exposure map....................!
2023-12-31 04:36:25 INFO GTBinnedAnalysis.run_gtapp(): Finished gtexpcube2. Execution time: 2.10 s
WARNING: FITSFixedWarning: RADECSYS= 'FK5 '
the RADECSYS keyword is deprecated, use RADESYSa. [astropy.wcs.wcs]
WARNING: FITSFixedWarning: 'datfix' made the change 'Set DATEREF to '2001-01-01T00:01:04.184' from MJDREF.
Set MJD-OBS to 54682.655283 from DATE-OBS.
Set MJD-END to 59852.000000 from DATE-END'. [astropy.wcs.wcs]
Traceback (most recent call last):
File "/home/dell/miniconda3/envs/fermipy/lib/python3.9/site-packages/fermipy/gtanalysis.py", line 5196, in setup
self._bexp = Map.read(self.files['bexpmap'], hdu=hpxhduname)
File "/home/dell/miniconda3/envs/fermipy/lib/python3.9/site-packages/gammapy/maps/core.py", line 240, in read
return Map.from_hdulist(
File "/home/dell/miniconda3/envs/fermipy/lib/python3.9/site-packages/gammapy/maps/core.py", line 308, in from_hdulist
map_type = Map._get_map_type(hdulist, hdu)
File "/home/dell/miniconda3/envs/fermipy/lib/python3.9/site-packages/gammapy/maps/core.py", line 339, in _get_map_type
header = hdu_list[hdu_name].header
File "/home/dell/miniconda3/envs/fermipy/lib/python3.9/site-packages/astropy/io/fits/hdu/hdulist.py", line 390, in getitem
super().getitem, self._positive_index_of(key)
File "/home/dell/miniconda3/envs/fermipy/lib/python3.9/site-packages/astropy/io/fits/hdu/hdulist.py", line 857, in _positive_index_of
index = self.index_of(key)
File "/home/dell/miniconda3/envs/fermipy/lib/python3.9/site-packages/astropy/io/fits/hdu/hdulist.py", line 839, in index_of
raise KeyError(f"Extension {key!r} not found.")
KeyError: "Extension 'HPXEXPOSURES' not found."

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/dell/Documents/1H1914-194/xx.py", line 4, in
gta.setup()
File "/home/dell/miniconda3/envs/fermipy/lib/python3.9/site-packages/fermipy/gtanalysis.py", line 1087, in setup
c.setup(overwrite=overwrite)
File "/home/dell/miniconda3/envs/fermipy/lib/python3.9/site-packages/fermipy/gtanalysis.py", line 5198, in setup
self._bexp = Map.read(self.files['bexpmap'])
File "/home/dell/miniconda3/envs/fermipy/lib/python3.9/site-packages/gammapy/maps/core.py", line 240, in read
return Map.from_hdulist(
File "/home/dell/miniconda3/envs/fermipy/lib/python3.9/site-packages/gammapy/maps/core.py", line 315, in from_hdulist
return cls_out.from_hdulist(
File "/home/dell/miniconda3/envs/fermipy/lib/python3.9/site-packages/gammapy/maps/wcs/core.py", line 142, in from_hdulist
wcs_map = cls.from_hdu(hdu, hdu_bands, format=format)
File "/home/dell/miniconda3/envs/fermipy/lib/python3.9/site-packages/gammapy/maps/wcs/ndmap.py", line 88, in from_hdu
geom = WcsGeom.from_header(hdu.header, hdu_bands, format=format)
File "/home/dell/miniconda3/envs/fermipy/lib/python3.9/site-packages/gammapy/maps/wcs/geom.py", line 485, in from_header
axes = MapAxes.from_table_hdu(hdu_bands, format=format)
File "/home/dell/miniconda3/envs/fermipy/lib/python3.9/site-packages/gammapy/maps/axes.py", line 1962, in from_table_hdu
return cls.from_table(table, format=format)
File "/home/dell/miniconda3/envs/fermipy/lib/python3.9/site-packages/gammapy/maps/axes.py", line 1980, in from_table
from gammapy.irf.io import IRF_DL3_AXES_SPECIFICATION
File "/home/dell/miniconda3/envs/fermipy/lib/python3.9/site-packages/gammapy/irf/init.py", line 6, in
from .background import Background2D, Background3D
File "/home/dell/miniconda3/envs/fermipy/lib/python3.9/site-packages/gammapy/irf/background.py", line 10, in
from .core import IRF
File "/home/dell/miniconda3/envs/fermipy/lib/python3.9/site-packages/gammapy/irf/core.py", line 17, in
from .io import IRF_DL3_HDU_SPECIFICATION, IRF_MAP_HDU_SPECIFICATION, gadf_is_pointlike
File "/home/dell/miniconda3/envs/fermipy/lib/python3.9/site-packages/gammapy/irf/io.py", line 4, in
from gammapy.data.hdu_index_table import HDUIndexTable
File "/home/dell/miniconda3/envs/fermipy/lib/python3.9/site-packages/gammapy/data/init.py", line 3, in
from .data_store import DataStore
File "/home/dell/miniconda3/envs/fermipy/lib/python3.9/site-packages/gammapy/data/data_store.py", line 15, in
from .observations import Observation, ObservationChecker, Observations
File "/home/dell/miniconda3/envs/fermipy/lib/python3.9/site-packages/gammapy/data/observations.py", line 22, in
from .event_list import EventList, EventListChecker
File "/home/dell/miniconda3/envs/fermipy/lib/python3.9/site-packages/gammapy/data/event_list.py", line 8, in
from astropy.coordinates.angle_utilities import angular_separation
ModuleNotFoundError: No module named 'astropy.coordinates.angle_utilities'

@NithyaSathyan This issue come from Gammapy not being compatible with astropy>=6.0. Downgrading to for example astropy=5.3 should fix the problem.