Files
termux-packages/packages/python-torchvision/setup.py.patch
termux-pacman-bot cef74b4e03 chore(main/python-{torch,torchaudio,torchvision}) Move to main
Move pytorch from x11 to main after removal of opencv dependencies
in #21764.
2024-10-12 13:10:02 +00:00

121 lines
4.2 KiB
Diff

diff -u -r ../cache/tmp-checkout/setup.py ./setup.py
--- ../cache/tmp-checkout/setup.py 2024-10-03 18:27:11.540911181 +0000
+++ ./setup.py 2024-10-04 12:09:20.737925352 +0000
@@ -6,10 +6,9 @@
import subprocess
import sys
-import torch
from pkg_resources import DistributionNotFound, get_distribution, parse_version
from setuptools import find_packages, setup
-from torch.utils.cpp_extension import BuildExtension, CppExtension, CUDA_HOME, CUDAExtension
+from setuptools import Extension as CppExtension
def read(*names, **kwargs):
@@ -163,11 +162,6 @@
is_rocm_pytorch = False
- if torch.__version__ >= "1.5":
- from torch.utils.cpp_extension import ROCM_HOME
-
- is_rocm_pytorch = (torch.version.hip is not None) and (ROCM_HOME is not None)
-
if is_rocm_pytorch:
from torch.utils.hipify import hipify_python
@@ -190,8 +184,8 @@
define_macros = []
- extra_compile_args = {"cxx": []}
- if (torch.cuda.is_available() and ((CUDA_HOME is not None) or is_rocm_pytorch)) or force_cuda:
+ extra_compile_args = {}
+ if False:
extension = CUDAExtension
sources += source_cuda
if not is_rocm_pytorch:
@@ -204,8 +198,6 @@
define_macros += [("WITH_HIP", None)]
nvcc_flags = []
extra_compile_args["nvcc"] = nvcc_flags
- elif torch.backends.mps.is_available() or force_mps:
- sources += source_mps
if sys.platform == "win32":
define_macros += [("torchvision_EXPORTS", None)]
@@ -221,9 +213,6 @@
extra_compile_args["nvcc"] = [f for f in nvcc_flags if not ("-O" in f or "-g" in f)]
extra_compile_args["nvcc"].append("-O0")
extra_compile_args["nvcc"].append("-g")
- else:
- print("Compiling with debug mode OFF")
- extra_compile_args["cxx"].append("-g0")
sources = [os.path.join(extensions_dir, s) for s in sources]
@@ -254,7 +243,7 @@
image_link_flags = []
# Locating libPNG
- libpng = shutil.which("libpng-config")
+ libpng = "@TERMUX_PREFIX@/bin/libpng-config"
pngfix = shutil.which("pngfix")
png_found = libpng is not None or pngfix is not None
@@ -313,11 +302,7 @@
# Locating nvjpeg
# Should be included in CUDA_HOME for CUDA >= 10.1, which is the minimum version we have in the CI
- nvjpeg_found = (
- extension is CUDAExtension
- and CUDA_HOME is not None
- and os.path.exists(os.path.join(CUDA_HOME, "include", "nvjpeg.h"))
- )
+ nvjpeg_found = False
use_nvjpeg = use_nvjpeg and nvjpeg_found
if use_nvjpeg:
@@ -354,7 +339,7 @@
)
# Locating ffmpeg
- ffmpeg_exe = shutil.which("ffmpeg")
+ ffmpeg_exe = "@TERMUX_PREFIX@/bin/ffmpeg"
has_ffmpeg = ffmpeg_exe is not None
ffmpeg_version = None
# FIXME: Building torchvision with ffmpeg on MacOS or with Python 3.9
@@ -363,7 +348,7 @@
# FIXME: https://github.com/pytorch/vision/issues/3367
if sys.platform != "linux" or (sys.version_info.major == 3 and sys.version_info.minor == 9):
has_ffmpeg = False
- if has_ffmpeg:
+ if False:
try:
# This is to check if ffmpeg is installed properly.
ffmpeg_version = subprocess.check_output(["ffmpeg", "-version"])
@@ -455,13 +440,7 @@
# CUDA_HOME should be set to the cuda root directory.
# TORCHVISION_INCLUDE and TORCHVISION_LIBRARY should include the location to
# video codec header files and libraries respectively.
- video_codec_found = (
- extension is CUDAExtension
- and CUDA_HOME is not None
- and any([os.path.exists(os.path.join(folder, "cuviddec.h")) for folder in vision_include])
- and any([os.path.exists(os.path.join(folder, "nvcuvid.h")) for folder in vision_include])
- and any([os.path.exists(os.path.join(folder, "libnvcuvid.so")) for folder in library_dirs])
- )
+ video_codec_found = False
use_video_codec = use_video_codec and video_codec_found
if (
@@ -560,7 +539,6 @@
ext_modules=get_extensions(),
python_requires=">=3.8",
cmdclass={
- "build_ext": BuildExtension.with_options(no_python_abi_suffix=True),
"clean": clean,
},
)