How to install pytorch with pip?

I use homebrew. Since it is inconflict with conda, so I can not use conda to install pytorch. But when I tried pip to install pytorch, I got the following error. Could anybody show me how to resolve this problem? Thanks.

$ pip install pytorch
Collecting pytorch
Downloading pytorch-0.1.2.tar.gz
Building wheels for collected packages: pytorch
Running bdist_wheel for pytorch … error
Complete output from command /usr/local/opt/python/bin/python2.7 -u -c “import setuptools, tokenize;file=’/private/var/folders/r7/bvmh1vvx41d63snvgbdz7bl40000gr/T/pip-build-nTG0jM/pytorch/’;f=getattr(tokenize, ‘open’, open)(file);’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” bdist_wheel -d /var/folders/r7/bvmh1vvx41d63snvgbdz7bl40000gr/T/tmpMDyh7Upip-wheel- --python-tag cp27:
Traceback (most recent call last):
File “”, line 1, in
File “/private/var/folders/r7/bvmh1vvx41d63snvgbdz7bl40000gr/T/pip-build-nTG0jM/pytorch/”, line 17, in
raise Exception(message)
Exception: You should install pytorch from

Another question is why did pip try installing version 0.1.2 when the stable version is 0.3.0.

If you go to and scroll down a little you can select your OS, installation method, python version and cuda version, and it will give you the proper commands to install the current stable version.

1 Like

1st thing … using conda and pip in parallel will most likely break your installation.

2nd thing … conda install pytorch torchvision -c pytorch … command should do the job.

1 Like

Great job not actually reading, rohit. Huge help.

The command now is actually pip install torch, as best I can find. Unfortunately, at time of writing this is completely broken:

You may be able to find a workaround in that thread.