NVIDIA / NVIDIA/apex

Suitable for: "VS2022" "CUDA126" "Python 3.12" "ComfyUI: - v0.3.40" APEX edited "setup. py" code“

Open
#1,908 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

windows
Dominant language
Python
Stars
9k
Forks
1.5k
Avg merge
2d 4h
Merged PRs (30d)
3

Description

先说明:我是小白一个,在网上看了不少安装教程都没搞定,我试着用 DeepSeek 修改了代码,在我自己的环境中测度通过,暂时没有发现有什么问题!

用法:用这人文件替换原有的 setup.py 文件即可:

随便一个位置打开CMD下载APEX:git clone https://github.com/NVIDIA/apex

然后打开 APEX 文件夹,按住 SHIFT+右键 打开 CMD ,在ComfyUI 的 python_embeded 文件内把 python.exe 拖到 CMD 内
编辑命令:-m pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" .

我自己编辑时,除了VSC++外的问题,在 DeepSeek 的回答中解决了!

这是我在编辑时的依赖错误:

pip._vendor.pyproject_hooks._impl.BackendUnavailable: Cannot import 'flit_core.buildapi'
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 2
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
full command: 'F:\ComfyUI_windows_portable\python_embeded\python.exe' 'F:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\pip_pip-runner_.py' install --ignore-installed --no-user --prefix 'D:\Temp\pip-build-env-z5e_lo_2\overlay' --no-warn-script-location --disable-pip-version-check --no-compile --target '' -v --no-binary :all: --only-binary :none: -i https://pypi.tuna.tsinghua.edu.cn/simple/ -- setuptools wheel
cwd: [inherit]
Installing build dependencies ... error
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 2
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

这个错误表明在安装构建依赖项时出现了问题,特别是与 flit_core.buildapi 相关的导入失败。以下是解决这个问题的步骤:

1.可能的原因和解决方案:
pip版本过旧:
运行以下命令升级pip:

python -m pip install --upgrade setuptools wheel

2.缺少构建工具:
确保已安装 setuptools 和 wheel
升级或安装:python -m pip install --upgrade setuptools wheel

3。flit_core包问题:
尝试单独安装 flit_core:
python -m pip install flit_core

4.虚拟环境问题:

如果使用虚拟环境,尝试创建一个新的虚拟环境:

python -m venv new_env
source new_env/bin/activate # Linux/Mac
new_env\Scripts\activate # Windows

5.使用清华镜像源安装:

明确指定使用清华镜像源:

python -m pip install --index-url https://pypi.tuna.tsinghua.edu.cn/simple/ --upgrade pip setuptools wheel flit_core
检查Python环境:

  1. 确保你使用的是正确的Python解释器路径,特别是当系统中有多个Python安装时。
    清理缓存并重试:

    python -m pip cache purge python -m pip install --force-reinstall --no-cache-dir

7.如果问题仍然存在:
尝试使用 --no-use-pep517 标志:

python -m pip install --no-use-pep517

8.或者直接下载whl文件手动安装:

python -m pip download -d . python -m pip install .whl

9.这个错误通常与构建环境配置有关,按照上述步骤操作后应该能够解决问题。如果仍有疑问,可以提供更多上下文信息以便进一步诊断。

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with setup.py and reproduce the reported pip build failure using the embedded Python 3.12 environment and the install command shown in the issue. Check the --cpp_ext and --cuda_ext path and the flit_core build-dependency error. Done means Apex installs successfully in the stated VS2022, CUDA 12.6 and ComfyUI environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
build-system, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.