marimo
marimo copied to clipboard
Cells run infinitely when including import of mpi4py
Describe the bug
When a cell imports mpi4py or any library importing it, the cell will execute but infinitely run on. Interestingly this only happens when importing MPI from mpi4py, not when importing mpi4py alone. Also note that code after the import will still execute, but the cell never stops thus preventing later cells from executing at all.
Now, one might say that this should not be an issue since why would you use mpi with marimo anyways, but the issue is that many libraries offer support for mpi4py, often importing it as follows:
try:
from mpi4py import MPI
except:
MPI = None
and thereby making mpi optional. This works perfectly well outside of marimo, but even the import in the try statement will cause the cell to run forever when executed in marimo.
Version
1.50
Code to reproduce
from mpi4py import MPI
@weidler, thanks for the very thorough bug report — I'll take a look!
Hi @weidler, I was unable to reproduce this issue unfortunately: from mpi4py import MPI works fine for me.
To debug further, it would help to have more information about your environment. Can you run marimo env at your terminal and paste the output here?
I've been unable to reproduce this. @weidler, if you are still encountering this on the latest version of marimo, please re-open
(I dont think I have the permissions to reopen this issue myself)
Hi @akshayka,
sorry for the late follow-up, had to finish a revision.
I reproduced the error on a different system (still Ubuntu, but 23.04 instead of 22.10) under similar conditions. I am running marimo in a conda environment. To isolate the issue I created a new conda environment and freshly installed mpi4py and marimo as follows
conda create --name marimo
conda install -c conda-forge openmpi mpi4py
pip install marimo
When running a marimo notebook inside that conda environment, the issue persists, see the screenshot below:
The stop button is unresponsive.
Conda Environment
The following are the packages installed in the environment (pip list)
Package Version
black 23.11.0 click 8.1.7 importlib-resources 6.1.1 jedi 0.19.1 marimo 0.1.61 Markdown 3.5.1 mpi4py 3.1.5 mypy-extensions 1.0.0 packaging 23.2 parso 0.8.3 pathspec 0.11.2 pip 23.3.1 platformdirs 4.0.0 Pygments 2.17.2 pymdown-extensions 10.5 PyYAML 6.0.1 setuptools 68.2.2 tomlkit 0.12.3 tornado 6.4 typing_extensions 4.8.0 wheel 0.42.0
Software Versions
conda 23.10.0 Python 3.12.0 (though I also reproduced on Python 3.9.17) Ubuntu 23.04
marimo env
{
"marimo": "0.1.61",
"OS": "Linux",
"OS Version": "6.2.0-37-generic",
"Python Version": "3.12.0",
"Binaries": {
"Chrome": "119.0.6045.123",
"Node": "--"
},
"Requirements": {
"black": "23.11.0",
"click": "8.1.7",
"jedi": "0.19.1",
"pymdown-extensions": "10.5",
"tomlkit": "0.12.3",
"tornado": "6.4",
"typing_extensions": "4.8.0"
}
}
@weidler , we hit this issue for other packages, which we've fixed. I was never able to reproduce this issue -- but can you see if it is still affecting you, on the latest version of marimo?