apex icon indicating copy to clipboard operation
apex copied to clipboard

How to install apex

Open Zerycii opened this issue 1 year ago • 17 comments

Image I always meet this error.Can someone help me?

Zerycii avatar Oct 19 '24 10:10 Zerycii

Hi, I am also facing the exact same issue. Did anyone find a fix?

akshaypn avatar Oct 19 '24 13:10 akshaypn

It seems you should install "torch" before installing apex.

XYkong-CS avatar Oct 21 '24 06:10 XYkong-CS

Hi,Maybe you could try command: pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --global-option="--cpp_ext" --global-option="--cuda_ext" ./

rensiyingying avatar Oct 21 '24 12:10 rensiyingying

git clone https://github.com/NVIDIA/apex
cd apex
# if pip >= 23.1 
pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" ./

# otherwise
pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --global-option="--cpp_ext" --global-option="--cuda_ext" ./

And you should make sure your torch cuda version must match the /usr/local/cuda/bin/nvcc

lix19937 avatar Oct 23 '24 05:10 lix19937

try this one 试试这个?apex wheels

AlongWY avatar Nov 20 '24 05:11 AlongWY

try this one 试试这个?apex wheels

Is there a version that supports Windows?

zslefour avatar Nov 20 '24 08:11 zslefour

try this one 试试这个?apex wheels

Is there a version that supports Windows?

Only Linux

gontz avatar Nov 21 '24 16:11 gontz

DEPRECATION: --build-option and --global-option are deprecated. pip 25.0 will enforce this behaviour change. A possible replacement is to use --config-settings. Discussion can be found at https://github.com/pypa/pip/issues/11859 WARNING: Implying --no-binary=:all: due to the presence of --build-option / --global-option.

rzw520 avatar Nov 22 '24 16:11 rzw520

I believe the problem is the use of import torch inside setup.py that together with pip build isolation makes torch not visible in some set-ups. In my case it was having torch installed as a system package and then trying to install apex in a virtualenv --system-site-packages. I could work around this by disabling the build-isolation https://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-no-build-isolation but there should be another solution.

VRehnberg avatar Dec 03 '24 16:12 VRehnberg

File "", line 10, in ModuleNotFoundError: No module named 'torch' error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip. full command: 'D:\Anaconda3\envs\comfyui\python.exe' 'D:\Anaconda3\envs\comfyui\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py' get_requires_for_build_wheel 'C:\Users\ADMINI~1\AppData\Local\Temp\tmp04f7t541' cwd: D:\apex Getting requirements to build wheel ... error error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip. (comfyui) PS D:\apex>怎么样才能把版本搞一致啊?

rzw520 avatar Dec 17 '24 02:12 rzw520

ModuleNotFoundError: No module named 'torch'

python -c "import torch;print(torch.version)"

lix19937 avatar Dec 17 '24 02:12 lix19937

Hi,Maybe you could try command: pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --global-option="--cpp_ext" --global-option="--cuda_ext" ./

Awesome!!!!!

halo-cn avatar Jan 13 '25 14:01 halo-cn

Hi,Maybe you could try command: pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --global-option="--cpp_ext" --global-option="--cuda_ext" ./

Awesome!!!!!

It worked....What is the different with the original command

zhangxb1989 avatar Apr 04 '25 15:04 zhangxb1989

Hi,Maybe you could try command: pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --global-option="--cpp_ext" --global-option="--cuda_ext" ./

thanks a lot!!!!

Tyyds-ai avatar Apr 09 '25 08:04 Tyyds-ai

pip install -v --disable-pip-version-check --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" --no-build-isolation . I've done it.

josephxie1 avatar Apr 15 '25 11:04 josephxie1

cheng@CHENG:~$ cd apex
cheng@CHENG:~/apex$ pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" ./
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.

    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.

    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.

    See /usr/share/doc/python3.12/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

snowbedding avatar Apr 17 '25 12:04 snowbedding

  1. Can NVIDIA/apex (cuda ext and cpp ext) be built on Windows OS successfully under Visual Studio 2022 Community Version?

  2. As mentioned above, DEPRECATION --build-option and --global-option are deprecated, the command suggested above actually build without any extension, as if you are running without triggering the CUDA and CPP extension building

pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation ./

  1. I use the following to trigger the extension building and with lots of errors. pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings="--global-option=--cpp_ext" --config-settings="--global-option=--cuda_ext" ./

  2. I started the build with x64 Native Tools Command Prompt for VS 2022, since am using python_embeded from ComfyUI portable, i face with missing file, Python.h

  3. But solving Python.h lead to missing pyconfig.h and unistd.h

  4. I define DISUTILS_USE_SD=1 and TORCH_DONT_CHECK_COMPILER_ABI=1

I just want to confirm if NVIDIA/apex (cpp and cuda) is never supposed to be built under Windows OS so that everybody can save they hours and move on.

Btw, does ComfyUI (pytorch) utilize cuda & cpp extensions? or a python build is more than enough?

homelab33 avatar Sep 03 '25 01:09 homelab33