From 3420c0db2fe49d81bf3caf673e4e1302153a2c49 Mon Sep 17 00:00:00 2001 From: Tai Le Manh <49281946+tlm365@users.noreply.github.com> Date: Thu, 8 Aug 2024 16:37:00 +0700 Subject: [PATCH] GH-43532: [Python] Remove usage of deprecated pkg_resources in setup.py (#43602) ### Rationale for this change Closes #43532. ### What changes are included in this PR? Remove deprecated `pkg_resources.resource_filename('numpy', 'core/include')`, replace with `numpy.get_include()` ### Are these changes tested? Test by CI. ### Are there any user-facing changes? No * GitHub Issue: #43532 Authored-by: Tai Le Manh Signed-off-by: Antoine Pitrou --- python/setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/setup.py b/python/setup.py index 2cef1c2d31cf1..d3ef3a091467c 100755 --- a/python/setup.py +++ b/python/setup.py @@ -32,7 +32,6 @@ # Get correct EXT_SUFFIX on Windows (https://bugs.python.org/issue39825) from distutils import sysconfig -import pkg_resources from setuptools import setup, Extension, Distribution, find_namespace_packages from Cython.Distutils import build_ext as _build_ext @@ -106,7 +105,8 @@ class build_ext(_build_ext): _found_names = () def build_extensions(self): - numpy_incl = pkg_resources.resource_filename('numpy', 'core/include') + import numpy + numpy_incl = numpy.get_include() self.extensions = [ext for ext in self.extensions if ext.name != '__dummy__']