ml-explore / mlx

MLX: An array framework for Apple silicon
https://ml-explore.github.io/mlx/
MIT License
14.83k stars 845 forks source link

No module named 'mlx.core'; 'mlx' is not a package #1069

Closed hawkheimmer closed 2 weeks ago

hawkheimmer commented 2 weeks ago

Describe the bug I used pip install mlx to install mlx in a new conda environment, and I had problem with import mlx.core as mx

Include code snippet

Traceback (most recent call last):
  File "/Users/cc/Documents/uvm/mlx.py", line 1, in <module>
    import mlx.core as mx
  File "/Users/cc/Documents/uvm/mlx.py", line 1, in <module>
    import mlx.core as mx
ModuleNotFoundError: No module named 'mlx.core'; 'mlx' is not a package

Desktop (please complete the following information):

Additional context I tried python -c "import platform; print(platform.processor())" in my conda environment as well, and it returned arm.

awni commented 2 weeks ago

You can't name the file with your source code the same name as a package. You should change /Users/cc/Documents/uvm/mlx.py to something else.

hawkheimmer commented 2 weeks ago

oh thank you, the problem was fixed.