How to install apex
I always meet this error.Can someone help me?
Hi, I am also facing the exact same issue. Did anyone find a fix?
It seems you should install "torch" before installing apex.
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" ./
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
try this one 试试这个?apex wheels
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.
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.
File "
× 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>怎么样才能把版本搞一致啊?
ModuleNotFoundError: No module named 'torch'
python -c "import torch;print(torch.version)"
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!!!!!
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
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!!!!
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.
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.
-
Can NVIDIA/apex (cuda ext and cpp ext) be built on Windows OS successfully under Visual Studio 2022 Community Version?
-
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 ./
-
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" ./
-
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
-
But solving Python.h lead to missing pyconfig.h and unistd.h
-
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?