Error importing PyTorch - Python
I have tried to install PyTorch using the following command in terminal:

pip install http://download.pytorch.org/whl/torch-0.2.0.post1-cp27-none-macosx_10_7_x86_64.whl 


I then run the following code in python:

import torch
torch.__file__


and get the following error:

 File "/Users/brian/anaconda/lib/python2.7/site-packages/torch/__init__.py", line 48, in &lt;module&gt;
import torch._dl as _dl_flags

AttributeError: 'module' object has no attribute '_dl'


I have attempted to research the issue but cannot find a clear answer. any help would be appreciated.

EDIT: 
These are the results from trying to re-install PyTorch using the following commands:

pip install http://download.pytorch.org/whl/torch-0.2.0.post1-cp27-none-macosx_10_7_x86_64.whl 
pip install torchvision 


Results:

Requirement already satisfied: pyyaml in ./anaconda/lib/python2.7/site-packages (from torch==0.2.0.post1)
Requirement already satisfied: numpy in ./anaconda/lib/python2.7/site-packages (from torch==0.2.0.post1)


Requirement already satisfied: torchvision in ./anaconda/lib/python2.7/site-packages
Requirement already satisfied: pillow in ./anaconda/lib/python2.7/site-packages (from torchvision)
Requirement already satisfied: torch in ./anaconda/lib/python2.7/site-packages (from torchvision)
Requirement already satisfied: numpy in ./anaconda/lib/python2.7/site-packages (from torchvision)
Requirement already satisfied: six in ./anaconda/lib/python2.7/site-packages (from torchvision)
Requirement already satisfied: olefile in ./anaconda/lib/python2.7/site-packages (from pillow-&gt;torchvision)
Requirement already satisfied: pyyaml in ./anaconda/lib/python2.7/site-packages (from torch-&gt;torchvision)


EDIT II

The following command:

conda install pytorch torchvision cuda80 -c soumith


yields this result: 

Fetching package metadata ...........

PackageNotFoundError: Packages missing in current channels:

   - cuda80

We have searched for the packages in the following channels:

  - https://conda.anaconda.org/soumith/osx-64
  - https://conda.anaconda.org/soumith/noarch
  - https://repo.continuum.io/pkgs/free/osx-64
  - https://repo.continuum.io/pkgs/free/noarch
  - https://repo.continuum.io/pkgs/r/osx-64
  - https://repo.continuum.io/pkgs/r/noarch
  - https://repo.continuum.io/pkgs/pro/osx-64
  - https://repo.continuum.io/pkgs/pro/noarch


On http://pytorch.org/ With:


OS: OSX
Package Manager: pip
Python: 2.7
CUDA: None


I've got:

pip install http://download.pytorch.org/whl/torch-0.2.0.post1-cp27-none-macosx_10_7_x86_64.whl 
pip install torchvision 
# OSX Binaries dont support CUDA, install from source if CUDA is needed



Are you sure you select all correct options?
Have you try the second command, pip install torchvision?


Edit

It seems in your log that you have anaconda installed on your mac, that mean you should have select Package manager: conda rather than pip.

In that case, you should remove the Package installed using pip:

pip uninstall torch


And use the command using anaconda instead:


OS: OSX
Package Manager: conda
Python: 2.7
CUDA: None


run the command:

conda install pytorch torchvision -c soumith

