mito-ds / mito

The mitosheet package, trymito.io, and other public Mito code.
https://trymito.io
Other
2.3k stars 158 forks source link

Mito does not support Python 3.12 #1000

Open aarondr77 opened 1 year ago

aarondr77 commented 1 year ago

Two users I worked with today ran into errors installing Mito because we don't support Python 3.12

Trying to install Mito with Python 3.12 causes this error: ERROR: Failed building wheel for pyzmq

From pyzmq's release notes we can see that, Python 3.12 support was only added in 25.1.1

We do not have a direct dependency on pyzmq, so we should: Figure out which of our dependencies relies on it and alert them.

naterush commented 1 year ago

There's at least one:

  1. JupyterLab needs jupyterlab_server: https://github.com/jupyterlab/jupyterlab/blob/main/pyproject.toml
  2. jupyterlab needs pyzmq: https://github.com/jupyter-server/jupyter_server/blob/main/pyproject.toml

But the requirement is >=24, so I'm not sure why it's not resolving to 25. My guess is that there is some other dependency that has more explicit requirements on pyzmq.

naterush commented 1 year ago

Here's our full dependency tree:

out.txt

JupyterLab requires notebook < 7, which requires pyzmq < 25. I tracked it to this specific issue: https://github.com/jupyter/notebook/pull/6749

Notably, this was a temporary fix / workaround, and should be removed in upcoming versions of notebook. If you just pip install "notebook<7" -- you get the pyzmq error here.

naterush commented 1 year ago

While this is getting fixed, we should just add a conditional dependency: if Python >= 3.12, then pyzmq >=25.

naterush commented 1 year ago

This doesn't work. For some reason, it still tries to resolve both >=25 as well as version <25... it doesn't look it's actually the notebook<7 dependency like I thought, but rather jupyter_server? Still digging in.

naterush commented 1 year ago

Yeah, so jupyterlab<4 doesn't work on Python 3.12. Opened an issue here: https://github.com/jupyterlab/jupyterlab/issues/15332

naterush commented 1 year ago

Notably:

  1. You can install JupyterLab > 4.0 on Python 3.12
  2. Even if you pip install pyzmq manually, and then try and install jupyterlab<4, it still errors.

Solutions wise, we have a few options:

Option 1: Wait until JupyterLab fixes this

This might happen, it might not -- 3.x version of JLab appears to be actively maintained (with a release in the past month) -- but it's not clear if/when this bug would be fixed. You can see the issue here.

Option 2: Move to JupyterLab 4.0 support

Since JupyterLab 4.0 works, we could just move to support it. But we have many folks on 3.x, we probably want to maintain support for this still.

I don't know how to do this, though. I'm not sure if 3.x support and 4.x support are possible in the same package... it's maybe possible but feels like it needs some investigation on the order of days.

Option 3: Remove JupyterLab as a default dependency of Mito

Move to install instructions that are closer to that of Streamlit and Dash. This would have the benefit of unblocking Python 3.12 users who are attempting to use streamlit or dash -- which may be a fair portion at this point.

aarondr77 commented 1 year ago

I vote we go with option 1 until we hear back from the JupyterLab team about timelines of adding support and in the meantime, we add a message in the docs + a common error issue in the docs that explains the workaround of using a different version of Python with a conda virtual environment like: conda create -n mitoenv python=3.10

In addition, let's prioritize JupyterLab 4 support soon?

naterush commented 1 year ago

Both of these are added to the docs. +1 on JupyterLab 4 support. Hopefully it's possible to support 3.x and 4.x in the same repo (but maybe won't be, given how data_files kinda work statically...)

AdeelK93 commented 6 months ago

Though pip is unable to install mitosheet on 3.12, poetry is able to do it just fine

DarkCTO commented 3 months ago

Seemingly fixed, but due to no module named disutils had to install setuptools maybe add to required packages since disutils removed in 3.12 @naterush @aarondr77