Using a clean docker container, I did a simple test using this example.
The test result is shown below. Looks fine.
(base) tang@ea1847c729c7:~/mpi4py$ mpirun -n 20 python mpi4.py
Controller @ MPI Rank 0: Input 3826176844
Worker at MPI Rank 1: Output 3826176845 is OK (from ea1847c729c7)
Worker at MPI Rank 2: Output 3826176846 is OK (from ea1847c729c7)
Worker at MPI Rank 3: Output 3826176847 is OK (from ea1847c729c7)
Worker at MPI Rank 4: Output 3826176848 is OK (from ea1847c729c7)
Worker at MPI Rank 5: Output 3826176849 is OK (from ea1847c729c7)
Worker at MPI Rank 6: Output 3826176850 is OK (from ea1847c729c7)
Worker at MPI Rank 7: Output 3826176851 is OK (from ea1847c729c7)
Worker at MPI Rank 8: Output 3826176852 is OK (from ea1847c729c7)
Worker at MPI Rank 9: Output 3826176853 is OK (from ea1847c729c7)
Worker at MPI Rank 10: Output 3826176854 is OK (from ea1847c729c7)
Worker at MPI Rank 11: Output 3826176855 is OK (from ea1847c729c7)
Worker at MPI Rank 12: Output 3826176856 is OK (from ea1847c729c7)
Worker at MPI Rank 13: Output 3826176857 is OK (from ea1847c729c7)
Worker at MPI Rank 14: Output 3826176858 is OK (from ea1847c729c7)
Worker at MPI Rank 15: Output 3826176859 is OK (from ea1847c729c7)
Worker at MPI Rank 16: Output 3826176860 is OK (from ea1847c729c7)
Worker at MPI Rank 17: Output 3826176861 is OK (from ea1847c729c7)
Worker at MPI Rank 18: Output 3826176862 is OK (from ea1847c729c7)
Worker at MPI Rank 19: Output 3826176863 is OK (from ea1847c729c7)