transientskp / pyse

Python Source Extractor
BSD 2-Clause "Simplified" License
11 stars 5 forks source link

Troubles with assscalar #42

Closed mbehiri closed 4 months ago

mbehiri commented 1 year ago

Hello. I am getting this error when running pyse:

Traceback (most recent call last):
  File "/Users/meriembehiri/anaconda3/bin/pyse", line 32, in <module>
    from sourcefinder.accessors import open as open_accessor
  File "/Users/meriembehiri/anaconda3/lib/python3.8/site-packages/sourcefinder/accessors/__init__.py", line 13, in <module>
    from sourcefinder.accessors import detection
  File "/Users/meriembehiri/anaconda3/lib/python3.8/site-packages/sourcefinder/accessors/detection.py", line 9, in <module>
    from sourcefinder.accessors.aartfaaccasaimage import AartfaacCasaImage
  File "/Users/meriembehiri/anaconda3/lib/python3.8/site-packages/sourcefinder/accessors/aartfaaccasaimage.py", line 5, in <module>
    from sourcefinder.accessors.casaimage import CasaImage
  File "/Users/meriembehiri/anaconda3/lib/python3.8/site-packages/sourcefinder/accessors/casaimage.py", line 8, in <module>
    from sourcefinder.utility.coordinates import WCS
  File "/Users/meriembehiri/anaconda3/lib/python3.8/site-packages/sourcefinder/utility/coordinates.py", line 13, in <module>
    from astropy import wcs as pywcs
  File "/Users/meriembehiri/anaconda3/lib/python3.8/site-packages/astropy/wcs/__init__.py", line 26, in <module>
    from .wcs import *
  File "/Users/meriembehiri/anaconda3/lib/python3.8/site-packages/astropy/wcs/wcs.py", line 50, in <module>
    from astropy import units as u
  File "/Users/meriembehiri/anaconda3/lib/python3.8/site-packages/astropy/units/__init__.py", line 17, in <module>
    from .quantity import *
  File "/Users/meriembehiri/anaconda3/lib/python3.8/site-packages/astropy/units/quantity.py", line 28, in <module>
    from .quantity_helper import (converters_and_unit, can_have_arbitrary_unit,
  File "/Users/meriembehiri/anaconda3/lib/python3.8/site-packages/astropy/units/quantity_helper/__init__.py", line 10, in <module>
    from . import helpers, function_helpers
  File "/Users/meriembehiri/anaconda3/lib/python3.8/site-packages/astropy/units/quantity_helper/function_helpers.py", line 119, in <module>
    np.asscalar,
  File "/Users/meriembehiri/anaconda3/lib/python3.8/site-packages/numpy/__init__.py", line 320, in __getattr__
    raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'asscalar'

What could it be? I looked for the asscalar in the pyse files and related to replace it but I didn't find any. Tell me if you have any clue please. Thanks, Meriem

jdswinbank commented 1 year ago

Hi Meriem —

The call to numpy.asscalar is coming from within Astropy. It looks like asscalar was removed in Numpy version 1.23. Recent versions of Astropy (>= 5) should work with modern versions of Numpy, but older versions will fail.

My best guess, therefore, is that you've somehow got an old Astropy combined with a modern Numpy on your system. Can you try upgrading the former?

HannoSpreeuw commented 1 year ago

Thanks John. Indeed most likely an expired deprecation from an incompatibility issue between astropy and numpy. Not from TraP source code, to be extra sure I ran grep -rniI . -e "*asscalar*" within the tkp repo, it gives no hits.

I am currently running TraP with Python 3.11 and I would like you to invite you to do the same, because the compatibility issue will likely vanish.

Please run, from your conda base environment, i.e. you may have to run conda deactivate first.

conda create -n py311 python=3.11 anaconda
conda activate py311
pip install -e .

Next the usual steps to get your postgresql daemon running and database setup. You might find this a useful gist.

HannoSpreeuw commented 11 months ago

@mbehiri Please let us know if you were able to fix this using an updated Astropy.

suvayu commented 4 months ago

Closing this since not a PySE issue, and it's been a year since OP responded.