imr-framework / pypulseq

Pulseq in Python
https://pypulseq.readthedocs.io
GNU Affero General Public License v3.0
111 stars 58 forks source link

Numpy float error when importing pypulseq #174

Closed mkulam closed 1 month ago

mkulam commented 1 month ago

I get the following error when I import pypulseq.

AttributeError Traceback (most recent call last) Cell In[1], line 2 1 import numpy as np ----> 2 import pypulseq as pp

File ~/anaconda3/envs/NMRpython/lib/python3.11/site-packages/pypulseq-1.4.0-py3.11.egg/pypulseq/init.py:33 31 from pypulseq.calc_rf_center import calc_rf_center 32 from pypulseq.make_adc import make_adc ---> 33 from pypulseq.make_adiabatic_pulse import make_adiabatic_pulse 34 from pypulseq.make_arbitrary_grad import make_arbitrary_grad 35 from pypulseq.make_arbitrary_rf import make_arbitrary_rf

File ~/anaconda3/envs/NMRpython/lib/python3.11/site-packages/pypulseq-1.4.0-py3.11.egg/pypulseq/make_adiabatic_pulse.py:7 5 import numpy as np 6 import math ----> 7 from sigpy.mri.rf import hypsec, wurst 9 from pypulseq import eps 10 from pypulseq.calc_duration import calc_duration

File ~/anaconda3/envs/NMRpython/lib/python3.11/site-packages/sigpy/init.py:12 1 """The core module contains functions and classes for signal processing. 2 3 SigPy provides simple interfaces to commonly used signal processing functions, (...) 9 10 """ 11 from .version import version # noqa ---> 12 from sigpy import alg, app, config, linop, prox 14 from sigpy import (backend, block, conv, interp, 15 fourier, pytorch, sim, thresh, 16 util, wavelet) 17 from sigpy.backend import * # noqa

File ~/anaconda3/envs/NMRpython/lib/python3.11/site-packages/sigpy/alg.py:8 6 import numpy as np 7 import sigpy as sp ----> 8 from sigpy import backend, util 11 class Alg(object): 12 """Abstraction for iterative algorithms. 13 14 The standard way of using an :class:Alg object, say alg, is as follows: (...) 45 46 """

File ~/anaconda3/envs/NMRpython/lib/python3.11/site-packages/sigpy/util.py:236 231 output[slc] = input 233 return output --> 236 def dirac(shape, dtype=np.float, device=backend.cpu_device): 237 """Create Dirac delta. 238 239 Args: (...) 245 array: Dirac delta array. 246 """ 248 device = backend.Device(device)

File ~/anaconda3/envs/NMRpython/lib/python3.11/site-packages/numpy/init.py:324, in getattr(attr) 319 warnings.warn( 320 f"In the future np.{attr} will be defined as the " 321 "corresponding NumPy scalar.", FutureWarning, stacklevel=2) 323 if attr in former_attrs: --> 324 raise AttributeError(former_attrs[attr]) 326 if attr == 'testing': 327 import numpy.testing as testing

AttributeError: module 'numpy' has no attribute 'float'. np.float was a deprecated alias for the builtin float. To avoid this error in existing code, use float by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.float64 here. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

Additional context I installed pypulseq directly from GitHub

btasdelen commented 1 month ago

This issue is solved long ago. See #122. Please make sure that you installed latest commit from dev branch on GitHub.