Skip to content
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

MyPy 1.7.0 typing errors #7230

Closed
Shadow-Devil opened this issue Nov 13, 2023 · 0 comments · Fixed by #7231
Closed

MyPy 1.7.0 typing errors #7230

Shadow-Devil opened this issue Nov 13, 2023 · 0 comments · Fixed by #7231

Comments

@Shadow-Devil
Copy link
Contributor

Describe the bug
When running runtests.sh --mypy there are some errors and deprecations that are issued.
The reason is probably the newly released mypy 1.7.0.

Warning: --strict-concatenate is deprecated; use --extra-checks instead
monai\transforms\io\array.py:272:28: error: Value of type Never is not indexable  [index]
monai\metrics\utils.py:396:22: error: Incompatible types in assignment (expression has type "Tuple[Any, ...]", variable has type "List[Any]")  [assignment]
monai\apps\deepgrow\interaction.py:85:37: error: "Sequence[Callable[..., Any]]" not callable  [operator]
monai\apps\auto3dseg\data_analyzer.py:15:1: error: Module "multiprocessing.context" has no attribute "ForkServerContext"  [attr-defined]
Found 5 errors in 5 files (checked 1109 source files)

To Reproduce
Run runtests.sh --mypy

Expected behavior
No errors/issues found.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment`

================================
Printing MONAI config...
================================
MONAI version: 1.3.0+25.gfec7cf17
Numpy version: 1.24.4
Pytorch version: 2.1.0+cpu
MONAI flags: HAS_EXT = False, USE_COMPILED = False, USE_META_DICT = False
MONAI rev id: fec7cf176740efcd3edb6ced6f18bbbc3b775852
MONAI __file__: E:\Programming\open-source\MONAI\monai\__init__.py

Optional dependencies:
Pytorch Ignite version: 0.4.11
ITK version: 5.3.0
Nibabel version: 5.1.0
scikit-image version: 0.21.0
scipy version: 1.10.1
Pillow version: 10.0.1
Tensorboard version: 2.14.0
gdown version: 4.7.1
TorchVision version: 0.16.0+cpu
tqdm version: 4.66.1
lmdb version: 1.4.1
psutil version: 5.9.6
pandas version: 2.0.3
einops version: 0.7.0
transformers version: 4.21.3
mlflow version: 2.8.0
pynrrd version: 1.0.0
clearml version: 1.13.2

For details about installing the optional dependencies, please visit:
    https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies


================================
Printing system config...
================================
System: Windows
Win32 version: ('10', '10.0.19041', 'SP0', 'Multiprocessor Free')
Win32 edition: Core
Platform: Windows-10-10.0.19041-SP0
Processor: Intel64 Family 6 Model 94 Stepping 3, GenuineIntel
Machine: AMD64
Python version: 3.8.6
Process name: python.exe
Command: ['C:\\Users\\fschn\\AppData\\Local\\Programs\\Python\\Python38\\python.exe', '-c', 'import monai; monai.config.print_debug_info()']
Open files: [popenfile(path='C:\\Windows\\System32\\en-US\\kernel32.dll.mui', fd=-1), popenfile(path='C:\\Program Files\\WindowsApps\\Microsoft.LanguageExperiencePacken-GB_19041.52.174.0_neutral__8wekyb
3d8bbwe\\Windows\\System32\\en-GB\\tzres.dll.mui', fd=-1), popenfile(path='C:\\Windows\\System32\\en-US\\KernelBase.dll.mui', fd=-1)]
Num physical CPUs: 4
Num logical CPUs: 8
Num usable CPUs: 8
CPU usage (%): [36.5, 11.6, 17.4, 8.1, 16.8, 18.6, 22.2, 30.3]
CPU freq. (MHz): 4001
Load avg. in last 1, 5, 15 mins (%): [0.0, 0.0, 0.0]
Disk usage (%): 7.2
Avg. sensor temp. (Celsius): UNKNOWN for given OS
Total physical memory (GB): 31.9
Available memory (GB): 17.4
Used memory (GB): 14.5

================================
Printing GPU config...
================================
Num GPUs: 0
Has CUDA: False
cuDNN enabled: False
NVIDIA_TF32_OVERRIDE: None
TORCH_ALLOW_TF32_CUBLAS_OVERRIDE: None

Additional context
I would like to contribute the fixes myself.

ericspod pushed a commit that referenced this issue Nov 16, 2023
Fixes #7230.

### Description

Fix the typing issues and the deprecation.

Also always run type checking with Linux environment, since
ForkServerContext is not available on Windows.

### Types of changes
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).

---------

Signed-off-by: Felix Schnabel <f.schnabel@tum.de>
marksgraham pushed a commit to marksgraham/MONAI that referenced this issue Jan 30, 2024
Fixes Project-MONAI#7230.

### Description

Fix the typing issues and the deprecation.

Also always run type checking with Linux environment, since
ForkServerContext is not available on Windows.

### Types of changes
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).

---------

Signed-off-by: Felix Schnabel <f.schnabel@tum.de>
Signed-off-by: Mark Graham <markgraham539@gmail.com>
juampatronics pushed a commit to juampatronics/MONAI that referenced this issue Mar 25, 2024
Fixes Project-MONAI#7230.

### Description

Fix the typing issues and the deprecation.

Also always run type checking with Linux environment, since
ForkServerContext is not available on Windows.

### Types of changes
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).

---------

Signed-off-by: Felix Schnabel <f.schnabel@tum.de>
Signed-off-by: Juan Pablo de la Cruz Gutiérrez <juampatronics@gmail.com>
Yu0610 pushed a commit to Yu0610/MONAI that referenced this issue Apr 11, 2024
Fixes Project-MONAI#7230.

### Description

Fix the typing issues and the deprecation.

Also always run type checking with Linux environment, since
ForkServerContext is not available on Windows.

### Types of changes
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).

---------

Signed-off-by: Felix Schnabel <f.schnabel@tum.de>
Signed-off-by: Yu0610 <612410030@alum.ccu.edu.tw>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant