ucl-exoplanets / TauREx3_public

Public release of TauREx3
https://taurex3-public.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
20 stars 11 forks source link

Update Numpy: np.asscalar -> numpy.ndarray.item() instead #29

Open royforestano opened 1 year ago

royforestano commented 1 year ago

This error arises upon:

import taurex


AttributeError Traceback (most recent call last)

in 5 import sys 6 ----> 7 import taurex 8 taurex.log.disableLogging() /opt/anaconda3/lib/python3.8/site-packages/taurex/__init__.py in 1 2 from ._version import __version__ ----> 3 from ._citation import __citations__ 4 from .taurexdefs import OutputSize /opt/anaconda3/lib/python3.8/site-packages/taurex/_citation.py in ----> 1 from taurex.core import Citable 2 3 4 class TauREXCitations(Citable): 5 /opt/anaconda3/lib/python3.8/site-packages/taurex/core/__init__.py in ----> 1 from taurex.data.fittable import fitparam, Fittable, derivedparam 2 from taurex.data.citation import Citable, unique_citations_only, to_bibtex 3 from taurex.output.output import Output 4 5 /opt/anaconda3/lib/python3.8/site-packages/taurex/data/__init__.py in ----> 1 from .planet import Planet /opt/anaconda3/lib/python3.8/site-packages/taurex/data/planet.py in 1 from taurex.log import Logger ----> 2 from taurex.constants import G, RJUP, MJUP, AU 3 from .fittable import fitparam, Fittable, derivedparam 4 from taurex.output.writeable import Writeable 5 import math /opt/anaconda3/lib/python3.8/site-packages/taurex/constants.py in 2 from taurex.util.util import conversion_factor 3 import numpy as np ----> 4 import astropy.constants as c 5 6 AMU = conversion_factor('u', 'kg') /opt/anaconda3/lib/python3.8/site-packages/astropy/constants/__init__.py in 21 22 # Hack to make circular imports with units work ---> 23 from astropy import units 24 del units 25 /opt/anaconda3/lib/python3.8/site-packages/astropy/units/__init__.py in 15 # where most time is spent (e.g., using python -X importtime). 16 from .core import * ---> 17 from .quantity import * 18 19 from . import si /opt/anaconda3/lib/python3.8/site-packages/astropy/units/quantity.py in 27 from astropy.utils.data_info import ParentDtypeInfo 28 from astropy import config as _config ---> 29 from .quantity_helper import (converters_and_unit, can_have_arbitrary_unit, 30 check_output) 31 from .quantity_helper.function_helpers import ( /opt/anaconda3/lib/python3.8/site-packages/astropy/units/quantity_helper/__init__.py in 8 # By importing helpers, all the unit conversion functions needed for 9 # numpy ufuncs and functions are defined. ---> 10 from . import helpers, function_helpers 11 # For scipy.special and erfa, importing the helper modules ensures 12 # the definitions are added as modules to UFUNC_HELPERS, to be loaded /opt/anaconda3/lib/python3.8/site-packages/astropy/units/quantity_helper/function_helpers.py in 125 IGNORED_FUNCTIONS = { 126 # Deprecated --> 127 np.asscalar, 128 # I/O - useless for Quantity, since no way to store the unit. 129 np.save, np.savez, np.savetxt, np.savez_compressed, /opt/anaconda3/lib/python3.8/site-packages/numpy/__init__.py in __getattr__(attr) 309 return Tester 310 --> 311 raise AttributeError("module {!r} has no attribute " 312 "{!r}".format(__name__, attr)) 313 ---------------------------------------------------------------------------- AttributeError: module 'numpy' has no attribute 'asscalar' This function, numpy.asscalar needs to be changed to numpy.ndarray.item() instead. I cannot seem to do this manually or from source. For now, I will open up a new environment and install the version of numpy that is compatible.