Skip to content

Commit c540e76

Browse files
kyamagufacebook-github-bot
authored andcommitted
Use packaging instead of deprecated distutils for version handling (#3191)
Summary: This PR replaces deprecated `distutils.version.LooseVersion` with [`packaging.version.Version`](https://packaging.pypa.io/en/stable/index.html). This change is needed to support CPython 3.12+. Pull Request resolved: #3191 Reviewed By: algoriddle Differential Revision: D52872218 Pulled By: mlomeli1 fbshipit-source-id: 336b2a618fde0a65d70b53c7d8a27aef3b62ece1
1 parent 091f344 commit c540e76

File tree

5 files changed

+6
-3
lines changed

5 files changed

+6
-3
lines changed

conda/faiss-gpu-raft/meta.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ outputs:
8484
run:
8585
- python {{ python }}
8686
- numpy >=1.19,<2
87+
- packaging
8788
- {{ pin_subpackage('libfaiss', exact=True) }}
8889
test:
8990
requires:

conda/faiss-gpu/meta.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ outputs:
8282
run:
8383
- python {{ python }}
8484
- numpy >=1.19,<2
85+
- packaging
8586
- {{ pin_subpackage('libfaiss', exact=True) }}
8687
test:
8788
requires:

conda/faiss/meta.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ outputs:
7878
run:
7979
- python {{ python }}
8080
- numpy >=1.19,<2
81+
- packaging
8182
- {{ pin_subpackage('libfaiss', exact=True) }}
8283
test:
8384
requires:

faiss/python/loader.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This source code is licensed under the MIT license found in the
44
# LICENSE file in the root directory of this source tree.
55

6-
from distutils.version import LooseVersion
6+
from packaging.version import Version
77
import platform
88
import subprocess
99
import logging
@@ -25,7 +25,7 @@ def supported_instruction_sets():
2525
{"NEON", "ASIMD", ...}
2626
"""
2727
import numpy
28-
if LooseVersion(numpy.__version__) >= "1.19":
28+
if Version(numpy.__version__) >= Version("1.19"):
2929
# use private API as next-best thing until numpy/numpy#18058 is solved
3030
from numpy.core._multiarray_umath import __cpu_features__
3131
# __cpu_features__ is a dictionary with CPU features

faiss/python/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
license='MIT',
7070
keywords='search nearest neighbors',
7171

72-
install_requires=['numpy'],
72+
install_requires=['numpy', 'packaging'],
7373
packages=['faiss', 'faiss.contrib'],
7474
package_data={
7575
'faiss': ['*.so', '*.pyd'],

0 commit comments

Comments
 (0)