1 diff --git a/spectral_cube/conftest.py b/spectral_cube/conftest.py
2 index 0d7c158..6fac9b4 100644
3 --- a/spectral_cube/conftest.py
4 +++ b/spectral_cube/conftest.py
6 from __future__ import print_function, absolute_import, division
9 -from distutils.version import LooseVersion
10 +from looseversion import LooseVersion
11 from astropy.units.equivalencies import pixel_scale
13 # Import casatools and casatasks here if available as they can otherwise
14 diff --git a/spectral_cube/lower_dimensional_structures.py b/spectral_cube/lower_dimensional_structures.py
15 index f0e3745..1b1e1f8 100644
16 --- a/spectral_cube/lower_dimensional_structures.py
17 +++ b/spectral_cube/lower_dimensional_structures.py
18 @@ -526,7 +526,7 @@ class Projection(LowerDimensionalObject, SpatialCoordMixinClass,
21 # Need version > 0.2 to work with cubes
22 - from distutils.version import LooseVersion
23 + from looseversion import LooseVersion
24 if LooseVersion(version) < "0.3":
25 raise Warning("Requires version >=0.3 of reproject. The current "
26 "version is: {}".format(version))
27 diff --git a/spectral_cube/np_compat.py b/spectral_cube/np_compat.py
28 index ed4a134..39aa320 100644
29 --- a/spectral_cube/np_compat.py
30 +++ b/spectral_cube/np_compat.py
32 from __future__ import print_function, absolute_import, division
35 -from distutils.version import LooseVersion
36 +from looseversion import LooseVersion
38 def allbadtonan(function):
40 diff --git a/spectral_cube/spectral_cube.py b/spectral_cube/spectral_cube.py
41 index 771a2d4..af752b4 100644
42 --- a/spectral_cube/spectral_cube.py
43 +++ b/spectral_cube/spectral_cube.py
44 @@ -57,7 +57,7 @@ from .spectral_axis import (determine_vconv_from_ctype, get_rest_value_from_wcs,
45 doppler_beta, doppler_gamma, doppler_z)
46 from .io.core import SpectralCubeRead, SpectralCubeWrite
48 -from distutils.version import LooseVersion
49 +from looseversion import LooseVersion
52 __all__ = ['BaseSpectralCube', 'SpectralCube', 'VaryingResolutionSpectralCube']
53 @@ -2659,7 +2659,7 @@ class BaseSpectralCube(BaseNDClass, MaskableArrayMixinClass,
55 reproj_kwargs = kwargs
56 # Need version > 0.2 to work with cubes, >= 0.5 for memmap
57 - from distutils.version import LooseVersion
58 + from looseversion import LooseVersion
59 if LooseVersion(version) < "0.5":
60 raise Warning("Requires version >=0.5 of reproject. The current "
61 "version is: {}".format(version))
62 diff --git a/spectral_cube/tests/test_masks.py b/spectral_cube/tests/test_masks.py
63 index c38ba27..1d6895d 100644
64 --- a/spectral_cube/tests/test_masks.py
65 +++ b/spectral_cube/tests/test_masks.py
66 @@ -14,7 +14,7 @@ from .. import (BooleanArrayMask, LazyMask, LazyComparisonMask,
67 FunctionMask, CompositeMask)
68 from ..masks import is_broadcastable_and_smaller, dims_to_skip, view_of_subset
70 -from distutils.version import LooseVersion
71 +from looseversion import LooseVersion
74 def test_spectral_cube_mask():
75 diff --git a/spectral_cube/tests/test_moments.py b/spectral_cube/tests/test_moments.py
76 index 3043dd5..7e05c5b 100644
77 --- a/spectral_cube/tests/test_moments.py
78 +++ b/spectral_cube/tests/test_moments.py
80 from __future__ import print_function, absolute_import, division
83 -from distutils.version import LooseVersion
84 +from looseversion import LooseVersion
88 diff --git a/spectral_cube/tests/test_performance.py b/spectral_cube/tests/test_performance.py
89 index bdee040..a778abc 100644
90 --- a/spectral_cube/tests/test_performance.py
91 +++ b/spectral_cube/tests/test_performance.py
92 @@ -20,7 +20,7 @@ except ImportError:
94 # The comparison of Quantities in test_memory_usage
95 # fail with older versions of numpy
96 -from distutils.version import LooseVersion
97 +from looseversion import LooseVersion
99 NPY_VERSION_CHECK = LooseVersion(np.version.version) >= "1.13"
101 diff --git a/spectral_cube/tests/test_regrid.py b/spectral_cube/tests/test_regrid.py
102 index 496ddd5..5b1fec7 100644
103 --- a/spectral_cube/tests/test_regrid.py
104 +++ b/spectral_cube/tests/test_regrid.py
105 @@ -18,7 +18,7 @@ except ImportError:
107 # The comparison of Quantities in test_memory_usage
108 # fail with older versions of numpy
109 -from distutils.version import LooseVersion
110 +from looseversion import LooseVersion
112 NPY_VERSION_CHECK = LooseVersion(np.version.version) >= "1.13"
114 diff --git a/spectral_cube/tests/test_spectral_cube.py b/spectral_cube/tests/test_spectral_cube.py
115 index 9ebeb7d..93e5647 100644
116 --- a/spectral_cube/tests/test_spectral_cube.py
117 +++ b/spectral_cube/tests/test_spectral_cube.py
118 @@ -6,7 +6,7 @@ import operator
122 -from distutils.version import LooseVersion
123 +from looseversion import LooseVersion
127 diff --git a/spectral_cube/tests/test_subcubes.py b/spectral_cube/tests/test_subcubes.py
128 index 6f74f68..217c324 100644
129 --- a/spectral_cube/tests/test_subcubes.py
130 +++ b/spectral_cube/tests/test_subcubes.py
132 from __future__ import print_function, absolute_import, division
135 -from distutils.version import LooseVersion
136 +from looseversion import LooseVersion
138 from astropy import units as u
139 from astropy import wcs
140 diff --git a/spectral_cube/tests/test_visualization.py b/spectral_cube/tests/test_visualization.py
141 index 85ea038..0ac8d58 100644
142 --- a/spectral_cube/tests/test_visualization.py
143 +++ b/spectral_cube/tests/test_visualization.py
145 from __future__ import print_function, absolute_import, division
148 -from distutils.version import LooseVersion
149 +from looseversion import LooseVersion
151 from .test_spectral_cube import cube_and_raw