diff --git a/Dockerfile.310p b/Dockerfile.310p index f0a44c6241c5..04b35dafa6b8 100644 --- a/Dockerfile.310p +++ b/Dockerfile.310p @@ -55,8 +55,7 @@ RUN export PIP_EXTRA_INDEX_URL=https://mirrors.huaweicloud.com/ascend/repos/pypi source /usr/local/Ascend/nnal/atb/set_env.sh && \ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/devlib && \ python3 -m pip install -v -e /vllm-workspace/vllm-ascend/ --extra-index https://download.pytorch.org/whl/cpu/ && \ - python3 -m pip uninstall -y triton triton-ascend && \ - python3 -m pip install -v triton-ascend==3.2.0 && \ + python3 -m pip uninstall -y triton triton-ascend || true && \ python3 -m pip cache purge # Append `libascend_hal.so` path (devlib) to LD_LIBRARY_PATH diff --git a/Dockerfile.310p.openEuler b/Dockerfile.310p.openEuler index 207186e6bf12..dff5ba7eed5f 100644 --- a/Dockerfile.310p.openEuler +++ b/Dockerfile.310p.openEuler @@ -54,8 +54,7 @@ RUN export PIP_EXTRA_INDEX_URL=https://mirrors.huaweicloud.com/ascend/repos/pypi export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/devlib && \ export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/include/c++/12:/usr/include/c++/12/`uname -i`-openEuler-linux && \ python3 -m pip install -v -e /vllm-workspace/vllm-ascend/ --extra-index https://download.pytorch.org/whl/cpu/ && \ - python3 -m pip uninstall -y triton triton-ascend && \ - python3 -m pip install -v triton-ascend==3.2.0 && \ + python3 -m pip uninstall -y triton triton-ascend || true && \ python3 -m pip cache purge RUN echo "export LD_PRELOAD=/usr/lib64/libjemalloc.so.2:$LD_PRELOAD" >> ~/.bashrc diff --git a/pyproject.toml b/pyproject.toml index f44307cd644d..e04fd39ca034 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,6 @@ [build-system] -# Should be mirrored in requirements.txt +# Should be mirrored in requirements.txt, except triton-ascend. +# triton-ascend is handled in setup.py and skipped for 310P SOC versions. requires = [ "attrs", "cmake>=3.26", @@ -29,8 +30,7 @@ requires = [ "fastapi<0.124.0", "opencv-python-headless<=4.11.0.86", # Required to avoid numpy version conflict with vllm "compressed_tensors>=0.11.0", - "arctic-inference==0.1.1", - "triton-ascend==3.2.0" + "arctic-inference==0.1.1" ] build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index af17586488c7..445d35dd3bde 100644 --- a/setup.py +++ b/setup.py @@ -459,14 +459,21 @@ def read_readme() -> str: def get_requirements() -> list[str]: """Get Python package dependencies from requirements.txt.""" + soc_version = (envs.SOC_VERSION or "").lower() + # Align with CMakeLists.txt: if(SOC_VERSION MATCHES "ascend310p.*") + skip_triton_ascend = soc_version.startswith("ascend310p") + def _read_requirements(filename: str) -> list[str]: with open(get_path(filename)) as f: - requirements = f.read().strip().split("\n") + requirements = f.read().splitlines() resolved_requirements = [] for line in requirements: + line = line.strip() + if not line or line.startswith("#"): + continue if line.startswith("-r "): resolved_requirements += _read_requirements(line.split()[1]) - elif line.startswith("--"): + elif line.startswith("--") or skip_triton_ascend and line.startswith("triton-ascend"): continue else: resolved_requirements.append(line)