Skip to content

Commit 4b0e00c

Browse files
feisuzhulin-hitonami
authored andcommitted
[misc] Fix manylinux2014 warning not printing (#7270)
Issue: # ### Brief Summary
1 parent dff4d2f commit 4b0e00c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

python/taichi/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from taichi._funcs import *
44
from taichi._lib import core as _ti_core
5+
from taichi._lib.utils import warn_restricted_version
56
from taichi._logging import *
67
from taichi._snode import *
78
from taichi.lang import * # pylint: disable=W0622 # TODO(archibate): It's `taichi.lang.core` overriding `taichi.core`
@@ -93,3 +94,6 @@ def __getattr__(attr):
9394

9495
del sys
9596
del _ti_core
97+
98+
warn_restricted_version()
99+
del warn_restricted_version

python/taichi/_lib/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import platform
33
import re
44
import sys
5+
import warnings
56

67
from colorama import Fore, Style
78

@@ -202,7 +203,9 @@ def try_get_loaded_libc_version():
202203

203204
def try_get_pip_version():
204205
try:
205-
import pip # pylint: disable=import-outside-toplevel
206+
with warnings.catch_warnings():
207+
warnings.simplefilter("ignore")
208+
import pip # pylint: disable=import-outside-toplevel
206209
return tuple([int(v) for v in pip.__version__.split('.')])
207210
except ImportError:
208211
return None
@@ -244,6 +247,3 @@ def warn_restricted_version():
244247
)
245248
except Exception:
246249
pass
247-
248-
249-
warn_restricted_version()

0 commit comments

Comments
 (0)