1

I'm new to the MacOS and I have recently downloaded PyCharm on it. I was able to successfully install some packages like numpy, matplotlib, sympy, etc. However, Pytorch won't get installed; not through PyCharm nor through the Terminal. These are the commands I tried in the Terminal (other than attempting to install them directly from PyCharm):

  • pip install torch
  • pip install torch torchvision torchaudio

I could post the error messages but some are quite lengthy :(

I'm using Python 3.9 interpreter with pip on the latest version (20.2.4) (everything else is also up to date). Running this on the new Mac Mini (running the M1 chip).

Any ideas on what I should do? Thanks!!!

Omar AlSuwaidi
  • 1,187
  • 2
  • 6
  • 26
  • 1
    Pytorch may be missing some libs compiled for ARM M1 (just guess). Maybe paste the error message. – hans Nov 25 '20 at 17:58
  • 1
    You may also try to install `miniconda` from [here](https://docs.conda.io/en/latest/miniconda.html) and then create an env and install pytorch inside: `conda create -n myenv python=3.9; conda activate myenv; conda install -c pytorch pytorch` – hans Nov 25 '20 at 18:00
  • That's a brilliant idea! Though is python 3.9 available on conda, or is the latest version 3.8.5? – Omar AlSuwaidi Nov 27 '20 at 19:41
  • I guess it should available for now, at least in `-c conda-forge` as suggested [here](https://stackoverflow.com/questions/63216201/how-to-install-python3-9-with-conda) – hans Nov 29 '20 at 21:20

2 Answers2

3

Try building from the source code, run these commands

  1. git clone https://github.com/pytorch/pytorch.git
  2. cd pytorch
  3. git submodule update --init --recursive
  4. python3 setup.py build
  5. python3 setup.py install
  • 1
    Can I ask how does building from source works? I have posed a question too but haven't got an answer. I will be very happy if you can help out, Varun. Also I have the M1 MacBook Air. – Fuzzyy Mar 10 '21 at 17:53
0

Are you using a venv? If so you could try checking the box "install to user's site packages directory" in the Project Interpreter settings when you add a package.

LetsdothisEpic
  • 126
  • 1
  • 6
  • I'm using the system interpreter. However, I still tried checking the box you referred to, and I was getting almost the same error :( – Omar AlSuwaidi Nov 22 '20 at 09:05