mlx: 'pip install mlx' does not seem to work correctly

Seems like the pip install does not install the correct package on my env

>> pip install mlx
Collecting mlx
  Using cached mlx-0.0.0-py3-none-any.whl.metadata (505 bytes)
Using cached mlx-0.0.0-py3-none-any.whl (2.1 kB)
Installing collected packages: mlx
Successfully installed mlx-0.0.0

If you trace the installed package it gives

>> cd ~/opt/anaconda3/envs/test/lib/python3.9/site-packages/mlx
>> ls
__init__.py __pycache__
>> cat __init__.py
print("HELLO WORLD!")

Environment: M1 Mac Air + Miniconda

About this issue

  • Original URL
  • State: closed
  • Created 7 months ago
  • Reactions: 6
  • Comments: 48 (20 by maintainers)

Most upvoted comments

My problem is fixed. I was running iTerm on rosetta and Homebrew and all the installed packages (including python versions) were all i386 versions. I now switched completely to arm builds and pip install mlx installs correctly and imports just fine. Thank you all πŸ˜ƒ

To summarize on how to install MLX currently using the PyPI packages:

  • You need a machine with an M-series chip
  • OS >= 13.0
  • Python between 3.8-3.11

If you meet those requirements and it still doesn’t work, make sure you are using a native python. The output of: python -c "import platform; print(platform.processor())" should be arm.

python -c β€œimport platform; print(platform.processor())”

This seems like something that should be mentioned in the readme/docs in BOLD. I didn’t use a native Python, but the following worked for me:

CONDA_SUBDIR=osx-arm64 conda create -n AppleMLX python=3.11

I’ve created a new conda env and now i’m getting the following error message pip install mlx ERROR: Could not find a version that satisfies the requirement mlx (from versions: none) ERROR: No matching distribution found for mlx Even tried pip install mlx==0.0.3 ERROR: Could not find a version that satisfies the requirement mlx==0.0.3 (from versions: none) ERROR: No matching distribution found for mlx==0.0.3

Python version: 3.10.13 Pip version: 23.3.1 Macbook air M1 2020 with 8GB memory running Sonoma 14.0 Build version: 23A344

I am having the same issue on a Macbook Air 2020 M1 with a fresh python 3.11 virtual environment. pip only downloads v.0.0.0 of mlx.

tried the following commands after upgrading pip as pip install --upgrade pip (not in this order): pip install mlx pip --force-reinstall --no-cache-dir --upgrade mlx pip install mlx==0.0.3

all of the above commands somehow downloads the v0.0.0.

ProductName: macOS ProductVersion: 13.5.1 BuildVersion: 22G90

I was hitting this and then realized it was because my pyenv/python/pip were all running under rosetta. You can check this with:

python -c "import platform; print(platform.processor())"

If you get back arm it’s the non-rosetta version. If you get back i386 it is and you will have to use a non-rosetta python/pip.

If you’re in deep with pyenv and pyenv-virtualenv I recommend setting a new PYENV_ROOT for your non-rosetta python versions and venvs and then re-evalling the pyenv init and pyenv virtualenv-inits.

I’ve created a new conda env and now i’m getting the following error message pip install mlx ERROR: Could not find a version that satisfies the requirement mlx (from versions: none) ERROR: No matching distribution found for mlx Even tried pip install mlx==0.0.3 ERROR: Could not find a version that satisfies the requirement mlx==0.0.3 (from versions: none) ERROR: No matching distribution found for mlx==0.0.3 Python version: 3.10.13 Pip version: 23.3.1 Macbook air M1 2020 with 8GB memory running Sonoma 14.0 Build version: 23A344

Can you also try using pip3 install mlx or python3.10 -m pip install mlx and let me know if that helps ?

Nope still getting the same error

Just another (positive) data point: I had no issue with pip install -U mlx on a fresh conda environment.

pip install -U mlx
Collecting mlx
  Downloading mlx-0.0.3-cp311-cp311-macosx_13_0_arm64.whl.metadata (212 bytes)
Downloading mlx-0.0.3-cp311-cp311-macosx_13_0_arm64.whl (9.4 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.4/9.4 MB 4.7 MB/s eta 0:00:00
Installing collected packages: mlx
Successfully installed mlx-0.0.3
Python 3.11.6 | packaged by conda-forge | (main, Oct  3 2023, 10:37:07) [Clang 15.0.7 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import mlx.core as mx
>>> a = mx.array([1, 2, 3, 4])
>>> a.shape
[4]
>>> a.dtype
int32

OS: macOS 13.5.2 Host: MacBookPro17,1 Kernel: 22.6.0 CPU: Apple M1 GPU: Apple M1 Python 3.11.6 conda 23.9.0

It looks like we don’t have a wheel for python 12. So for now you can do:

conda create -n myenv python=3.11
conda activate myenv
pip install mlx

We will add a wheel for python 12 ASAP

I found an easy fix to this issue:

if you see i386 when you run this command: python3 -c "import platform; print(platform.processor())"

Just Download & install macOS 64-bit universal2 installer

Once done, you should see arm now when you rerun: python3 -c "import platform; print(platform.processor())

Now try pip install mlx , it should work.

Hmm very weird, it looks like it might have been a problem with VSCode. I was importing mlx on a jupyter notebook in VSCode and I was getting the above error I mentioned. I moved out of VSCode, and opened a notebook with the conda environment I initially created with an arm arch. I was able to successfully import mlx and I was even able to import mlx using Python in the terminal so it seems like a VSCode issue.

Update: I got it to work on VSCode by following @awni your steps to create a fresh env, thanks for the help πŸ˜ƒ

The install docs are updated to include the issues brought up in this thread. I am going to close this for now, but feel free to reopen if there are new issues with installation.

@oliverks your OS is below the supported versions. Your best bet is to update to macOS 13 or 14.

I was hitting this and then realized it was because my pyenv/python/pip were all running under rosetta. You can check this with:

python -c "import platform; print(platform.processor())"
y@u x[main*] $ python -c "import platform; print(platform.processor())"
arm

As I learned, the problem on my side in OSX version, I’m still on Big Sur, but you have build only for 13.x and 14.x.

This seems to have worked for me python3.10 -m pip install mlx, installed the right package.

It looks like we don’t have a wheel for python 12. So for now you can do:

conda create -n myenv python=3.11
conda activate myenv
pip install mlx

We will add a wheel for python 12 ASAP

Your solution works for me. Thanks!

I did but that doesn’t seem to work either