Skip to content

DeprecationWarning when import monai #8060

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
KumoLiu opened this issue Sep 2, 2024 · 4 comments
Open

DeprecationWarning when import monai #8060

KumoLiu opened this issue Sep 2, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@KumoLiu
Copy link
Contributor

KumoLiu commented Sep 2, 2024

/usr/local/lib/python3.10/dist-packages/ignite/handlers/checkpoint.py:16: DeprecationWarning: `TorchScript` support for functional optimizers is deprecated and will be removed in a future PyTorch release. Consider using the `torch.compile` optimizer instead.
  from torch.distributed.optim import ZeroRedundancyOptimizer
/usr/local/lib/python3.10/dist-packages/modelopt/torch/quantization/tensor_quant.py:92: FutureWarning: `torch.library.impl_abstract` was renamed to `torch.library.register_fake`. Please use that instead; we will remove `torch.library.impl_abstract` in a future version of PyTorch.
  scaled_e4m3_abstract = torch.library.impl_abstract("trt::quantize_fp8")(
WARNING:py.warnings:`np.bool8` is a deprecated alias for `np.bool_`.  (Deprecated NumPy 1.24)

WARNING:py.warnings:`np.object0` is a deprecated alias for ``np.object0` is a deprecated alias for `np.object_`. `object` can be used instead.  (Deprecated NumPy 1.24)`.  (Deprecated NumPy 1.24)

WARNING:py.warnings:`np.int0` is a deprecated alias for `np.intp`.  (Deprecated NumPy 1.24)

WARNING:py.warnings:`np.uint0` is a deprecated alias for `np.uintp`.  (Deprecated NumPy 1.24)

WARNING:py.warnings:`np.void0` is a deprecated alias for `np.void`.  (Deprecated NumPy 1.24)

WARNING:py.warnings:`np.bytes0` is a deprecated alias for `np.bytes_`.  (Deprecated NumPy 1.24)

WARNING:py.warnings:`np.str0` is a deprecated alias for `np.str_`.  (Deprecated NumPy 1.24)

WARNING:py.warnings:Implicitly cleaning up <TemporaryDirectory '/tmp/tmpwhzwfrqi'>
@KumoLiu KumoLiu added the bug Something isn't working label Sep 3, 2024
@KumoLiu
Copy link
Contributor Author

KumoLiu commented Sep 4, 2024

Some new warning:

WARNING:py.warnings:pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html

WARNING:py.warnings:Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.7/migration/

WARNING:py.warnings:Pydantic V1 style `@root_validator` validators are deprecated. You should migrate to Pydantic V2 style `@model_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.7/migration/

WARNING:py.warnings:Support for class-based `config` is deprecated, use ConfigDict instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.7/migration/

WARNING:torch_tensorrt.dynamo.conversion.aten_ops_converters:Unable to import quantization op. Please install modelopt library (https://github.com/NVIDIA/TensorRT-Model-Optimizer?tab=readme-ov-file#installation) to add support for compiling quantized models

WARNING:py.warnings:Implicitly cleaning up <TemporaryDirectory '/tmp/tmpi_trmfs_'>

KumoLiu added a commit to KumoLiu/MONAI that referenced this issue Sep 5, 2024
KumoLiu added a commit that referenced this issue Sep 6, 2024
- add packaging in setup.cfg
- fix test_gdsdataset.py issue
- add test_matshow3d to the skip list for min test
- suppress deprecated warning when import monai (workaround for #8060)

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: YunLiu <[email protected]>
Co-authored-by: Eric Kerfoot <[email protected]>
hjmjohnson pushed a commit to hjmjohnson/MONAI that referenced this issue Sep 8, 2024
- add packaging in setup.cfg
- fix test_gdsdataset.py issue
- add test_matshow3d to the skip list for min test
- suppress deprecated warning when import monai (workaround for Project-MONAI#8060)

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: YunLiu <[email protected]>
Co-authored-by: Eric Kerfoot <[email protected]>
@ericspod
Copy link
Member

Hi @KumoLiu are these still current warnings that we need to look at? I think the Numpy related ones are obsolete now.

@KumoLiu
Copy link
Contributor Author

KumoLiu commented Apr 1, 2025

Hi @ericspod, in this PR I've suppressed these warnings, so it should be fine for now. Since these warnings are not originating from the MONAI core itself, let's keep the suppression as it is for now. What do you think? We can close this ticket or leave it as a reminder. Both should be fine to me.

# TODO: remove this workaround after upstream fixed the warning

@ericspod
Copy link
Member

ericspod commented Apr 9, 2025

I think we leave things as they are with the warnings suppressed and we will revisit this later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants