Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(setup): Add torch as install_requires for the installation of torch_scatter #451

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@
import os
import os.path as osp
import platform
import subprocess
import sys
from itertools import product

import torch
from setuptools import find_packages, setup
from torch.__config__ import parallel_info
from torch.utils.cpp_extension import (CUDA_HOME, BuildExtension, CppExtension,
from torch.utils.cpp_extension import (BuildExtension, CppExtension,
CUDAExtension)

CUDA_HOME = os.environ.get("CUDA_HOME")
if not CUDA_HOME:
from torch.utils.cpp_extension import CUDA_HOME

__version__ = '2.1.2'
URL = 'https://github.com/rusty1s/pytorch_scatter'

Expand All @@ -28,6 +33,10 @@
BUILD_DOCS = os.getenv('BUILD_DOCS', '0') == '1'
WITH_SYMBOLS = os.getenv('WITH_SYMBOLS', '0') == '1'

def get_cuda_bare_metal_version(cuda_home):
output = subprocess.check_output([cuda_home + "/bin/nvcc", "-V"], universal_newlines=True).split()
release_idx = output.index("release")
return output[release_idx+1].split(",")[0].replace('.', '')

def get_extensions():
extensions = []
Expand Down Expand Up @@ -107,7 +116,12 @@ def get_extensions():
return extensions


install_requires = []
install_requires = ["torch>=1.8.0"]
extra_index_url = (
["https://download.pytorch.org/whl/cpu"]
if suffices == ["cpu"]
else [f"https://download.pytorch.org/whl/cu{get_cuda_bare_metal_version(CUDA_HOME)}"]
)

test_requires = [
'pytest',
Expand All @@ -130,6 +144,7 @@ def get_extensions():
keywords=['pytorch', 'scatter', 'segment', 'gather'],
python_requires='>=3.8',
install_requires=install_requires,
extra_index_url=extra_index_url,
extras_require={
'test': test_requires,
},
Expand Down
Loading