filipstrand / mflux

A MLX port of FLUX based on the Huggingface Diffusers implementation.
MIT License
1.03k stars 61 forks source link

Info about Python 3.13 compatibility #74

Open anthonywu opened 1 month ago

anthonywu commented 1 month ago

I expect people will use the newest Python 3.13 and try to install mflux and fail. Sharing the latest compat info that I gathered.

Known blockers

As of October 10, torch nightly builds shows *cp312-none-mac* as the latest matches. We need to wait for cp313-none-mac to be available then can test with pip install --pre torch --index-url https://download.pytorch.org/whl

  × No solution found when resolving dependencies:
  ╰─▶ Because only the following versions of torch are available:
          torch==1.0.0
... snipped ...
          torch==2.4.1
      and torch<=1.5.0 has no wheels with a matching Python implementation tag, we can conclude that torch<1.0.1 cannot be used.
      And because torch>=1.5.1 has no wheels with a matching Python ABI tag and you require torch, we can conclude that your requirements are unsatisfiable.

I expect torch to update within a month.


As of Oct 10, https://github.com/search?q=repo%3Aml-explore%2Fmlx%203.12&type=code shows 3.12 as the newest python versions accounted for.

  × No solution found when resolving dependencies:
  ╰─▶ Because mlx==0.18.0 has no wheels with a matching Python ABI tag and you require mlx==0.18.0, we can conclude that your requirements are unsatisfiable.

I have a local git clone of mlx that I compiled with python3.13 and I can get it to install, so I expect this to be resolved soon upstream.


other libraries

these other libraries do not pip install as of Oct 10, but I did not investigate how ready these upstream projects are for 3.13

Unknown blockers

there may be transitive dependencies that also need to distribute wheels for 3.13 before mflux project can advertise 3.13 support

anthonywu commented 3 weeks ago

https://github.com/ml-explore/mlx/commit/9bd3a7102fc1dccb10e2a93c320e77f4d32c01de adds Python 3.13 to the CI, so am expecting a Python 3.13 mlx wheel in coming days.

anthonywu commented 2 weeks ago

solved (for devs to preview) in #90

  1. mlx is now available for 3.13
  2. tokenizers now has a new build for 3.13
  3. sentencepiece not upgraded but not required by tokenizers anymore after update
  4. torch preview builds via pip install --dev can be found on nightly builds (been available for at least a week)

Not good enough to close issue for now, but all developer types can be unblocked to move forward.

anthonywu commented 2 weeks ago

sentencepiece can be built from source and become pip installable by Python 3.13

the build instructions from the original repo works as is! https://github.com/google/sentencepiece/blob/master/python/README.md#build-and-install-sentencepiece

% git clone https://github.com/google/sentencepiece.git /your/path/sentencepiece
% cd sentencepiece
% mkdir build
% cd build
% cmake .. -DSPM_ENABLE_SHARED=OFF -DCMAKE_INSTALL_PREFIX=./root
% make install
% cd ../python
% python setup.py bdist_wheel
% pip install dist/sentencepiece*.whl

This produces an artifact to uv pip install /your/path/sentencepiece/python into the Python 3.13 env.

The trick is, can this be packaged reasonably for intermediate users while Google takes its time updating the 3.13 wheel for the library...