mirror of
https://github.com/termux/termux-packages
synced 2024-06-23 16:19:48 +00:00
python-torch does not build against Python 3.11. python-torchvision depends on python-torch.
107 lines
3.7 KiB
Diff
107 lines
3.7 KiB
Diff
diff -uNr vision/setup.py vision.mod/setup.py
|
|
--- vision/setup.py 2022-10-07 23:30:59.696293602 +0900
|
|
+++ vision.mod/setup.py 2022-10-08 01:16:59.594996000 +0900
|
|
@@ -6,10 +6,9 @@
|
|
import subprocess
|
|
import sys
|
|
|
|
-import torch
|
|
from pkg_resources import parse_version, get_distribution, DistributionNotFound
|
|
from setuptools import setup, find_packages
|
|
-from torch.utils.cpp_extension import BuildExtension, CppExtension, CUDAExtension, CUDA_HOME
|
|
+from setuptools import Extension as CppExtension
|
|
|
|
|
|
def read(*names, **kwargs):
|
|
@@ -141,11 +140,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
|
|
|
|
@@ -182,10 +176,8 @@
|
|
|
|
define_macros = []
|
|
|
|
- extra_compile_args = {"cxx": []}
|
|
- if (torch.cuda.is_available() and ((CUDA_HOME is not None) or is_rocm_pytorch)) or os.getenv(
|
|
- "FORCE_CUDA", "0"
|
|
- ) == "1":
|
|
+ extra_compile_args = []
|
|
+ if False:
|
|
extension = CUDAExtension
|
|
sources += source_cuda
|
|
if not is_rocm_pytorch:
|
|
@@ -308,11 +300,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
|
|
|
|
print(f"NVJPEG found: {nvjpeg_found}")
|
|
image_macros += [("NVJPEG_FOUND", str(int(nvjpeg_found)))]
|
|
@@ -340,7 +328,7 @@
|
|
)
|
|
)
|
|
|
|
- ffmpeg_exe = shutil.which("ffmpeg")
|
|
+ ffmpeg_exe = "@TERMUX_PREFIX@/bin/ffmpeg"
|
|
has_ffmpeg = ffmpeg_exe is not None
|
|
# FIXME: Building torchvision with ffmpeg on MacOS or with Python 3.9
|
|
# FIXME: causes crash. See the following GitHub issues for more details.
|
|
@@ -348,13 +336,6 @@
|
|
# 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:
|
|
- try:
|
|
- # This is to check if ffmpeg is installed properly.
|
|
- subprocess.check_output(["ffmpeg", "-version"])
|
|
- except subprocess.CalledProcessError:
|
|
- print("Error fetching ffmpeg version, ignoring ffmpeg.")
|
|
- has_ffmpeg = False
|
|
|
|
print(f"FFmpeg found: {has_ffmpeg}")
|
|
|
|
@@ -435,13 +416,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
|
|
|
|
print(f"video codec found: {video_codec_found}")
|
|
|
|
@@ -525,14 +500,9 @@
|
|
packages=find_packages(exclude=("test",)),
|
|
package_data={package_name: ["*.dll", "*.dylib", "*.so"]},
|
|
zip_safe=False,
|
|
- install_requires=requirements,
|
|
extras_require={
|
|
"scipy": ["scipy"],
|
|
},
|
|
ext_modules=get_extensions(),
|
|
python_requires=">=3.7",
|
|
- cmdclass={
|
|
- "build_ext": BuildExtension.with_options(no_python_abi_suffix=True),
|
|
- "clean": clean,
|
|
- },
|
|
)
|