Skip to content

Commit

Permalink
[Fix] Fix AssertionError when importing pip before setuptools (#198)
Browse files Browse the repository at this point in the history
* fix AssertionError when importing pip before setuptools

* refine comments
  • Loading branch information
ice-tong authored Feb 4, 2023
1 parent 213f1b2 commit 959f9c9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions mim/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
# Copyright (c) OpenMMLab. All rights reserved.

# NOTE: We could got AssertionError when importing pip before
# setuptools. A workaround is to import setuptools first and filter
# warnings that are caused by setuptools replacing distutils.
# Related issues:
# - https://github.com/pypa/setuptools/issues/3621
# - https://github.com/open-mmlab/mmclassification/issues/1343
try:
import setuptools # noqa: F401
import warnings
warnings.filterwarnings('ignore', 'Setuptools is replacing distutils')
except ImportError:
pass

from .commands import (
download,
get_model_info,
Expand Down

0 comments on commit 959f9c9

Please sign in to comment.