NVIDIA / apex

A PyTorch Extension: Tools for easy mixed precision and distributed training in Pytorch
BSD 3-Clause "New" or "Revised" License
8.2k stars 1.36k forks source link

Fail to install apex #1702

Closed DIY-Z closed 12 months ago

DIY-Z commented 12 months ago

Describe the Bug

WARNING: Implying --no-binary=:all: due to the presence of --build-option / --global-option / --install-option. Consider using --config-settings for more flexibility.
DEPRECATION: --no-binary currently disables reading from the cache of locally built wheels. In the future --no-binary will not influence the wheel cache. pip 23.1 will enforce this behaviour change. A possible replacement is to use the --no-cache-dir option. You can use the flag --use-feature=no-binary-enable-wheel-cache to test the upcoming behaviour. Discussion can be found at https://github.com/pypa/pip/issues/11453
Processing /home/username/apex
  Running command Preparing metadata (pyproject.toml)

  torch.__version__  = 2.0.1+cu118

  Traceback (most recent call last):
    File "/home/username/anaconda3/envs/pytorch2.0.1/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/home/username/anaconda3/envs/pytorch2.0.1/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/home/username/anaconda3/envs/pytorch2.0.1/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 149, in prepare_metadata_for_build_wheel
      return hook(metadata_directory, config_settings)
    File "/home/username/anaconda3/envs/pytorch2.0.1/lib/python3.8/site-packages/setuptools/build_meta.py", line 380, in prepare_metadata_for_build_wheel
      self.run_setup()
    File "/home/username/anaconda3/envs/pytorch2.0.1/lib/python3.8/site-packages/setuptools/build_meta.py", line 338, in run_setup
      exec(code, locals())
    File "<string>", line 137, in <module>
    File "<string>", line 24, in get_cuda_bare_metal_version
  TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) 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: /home/username/anaconda3/envs/pytorch2.0.1/bin/python /home/username/anaconda3/envs/pytorch2.0.1/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpmu4m1bvb
  cwd: /home/username/apex
  Preparing metadata (pyproject.toml) ... error
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Minimal Steps/Code to Reproduce the Bug

I attempted to install Apex using the following commands: ```sh git clone https://github.com/NVIDIA/apex cd apex pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --global-option="--cpp_ext" --global-option="--cuda_ext" ./ ``` **Expected Behavior**

Environment

OS: Ubuntu 22.04.2 LTS (x86_64) Python version: 3.8.16 PyTorch version: 2.0.1+cu118

DIY-Z commented 12 months ago

Describe the Bug

WARNING: Implying --no-binary=:all: due to the presence of --build-option / --global-option / --install-option. Consider using --config-settings for more flexibility.
DEPRECATION: --no-binary currently disables reading from the cache of locally built wheels. In the future --no-binary will not influence the wheel cache. pip 23.1 will enforce this behaviour change. A possible replacement is to use the --no-cache-dir option. You can use the flag --use-feature=no-binary-enable-wheel-cache to test the upcoming behaviour. Discussion can be found at https://github.com/pypa/pip/issues/11453
Processing /home/username/apex
  Running command Preparing metadata (pyproject.toml)

  torch.__version__  = 2.0.1+cu118

  Traceback (most recent call last):
    File "/home/username/anaconda3/envs/pytorch2.0.1/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/home/username/anaconda3/envs/pytorch2.0.1/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/home/username/anaconda3/envs/pytorch2.0.1/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 149, in prepare_metadata_for_build_wheel
      return hook(metadata_directory, config_settings)
    File "/home/username/anaconda3/envs/pytorch2.0.1/lib/python3.8/site-packages/setuptools/build_meta.py", line 380, in prepare_metadata_for_build_wheel
      self.run_setup()
    File "/home/username/anaconda3/envs/pytorch2.0.1/lib/python3.8/site-packages/setuptools/build_meta.py", line 338, in run_setup
      exec(code, locals())
    File "<string>", line 137, in <module>
    File "<string>", line 24, in get_cuda_bare_metal_version
  TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) 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: /home/username/anaconda3/envs/pytorch2.0.1/bin/python /home/username/anaconda3/envs/pytorch2.0.1/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpmu4m1bvb
  cwd: /home/username/apex
  Preparing metadata (pyproject.toml) ... error
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Minimal Steps/Code to Reproduce the Bug

I attempted to install Apex using the following commands:

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

Expected Behavior

Environment

OS: Ubuntu 22.04.2 LTS (x86_64) Python version: 3.8.16 PyTorch version: 2.0.1+cu118

I find the solution to the problem is shown as below:

conda install -c nvidia cuda-nvcc
pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --global-option="--cpp_ext" --global-option="--cuda_ext" ./
jiaduob commented 11 months ago

Thanks a lot, I also solve this problem by this way.

Fanyuekun commented 9 months ago

Describe the Bug

WARNING: Implying --no-binary=:all: due to the presence of --build-option / --global-option / --install-option. Consider using --config-settings for more flexibility.
DEPRECATION: --no-binary currently disables reading from the cache of locally built wheels. In the future --no-binary will not influence the wheel cache. pip 23.1 will enforce this behaviour change. A possible replacement is to use the --no-cache-dir option. You can use the flag --use-feature=no-binary-enable-wheel-cache to test the upcoming behaviour. Discussion can be found at https://github.com/pypa/pip/issues/11453
Processing /home/username/apex
  Running command Preparing metadata (pyproject.toml)

  torch.__version__  = 2.0.1+cu118

  Traceback (most recent call last):
    File "/home/username/anaconda3/envs/pytorch2.0.1/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/home/username/anaconda3/envs/pytorch2.0.1/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/home/username/anaconda3/envs/pytorch2.0.1/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 149, in prepare_metadata_for_build_wheel
      return hook(metadata_directory, config_settings)
    File "/home/username/anaconda3/envs/pytorch2.0.1/lib/python3.8/site-packages/setuptools/build_meta.py", line 380, in prepare_metadata_for_build_wheel
      self.run_setup()
    File "/home/username/anaconda3/envs/pytorch2.0.1/lib/python3.8/site-packages/setuptools/build_meta.py", line 338, in run_setup
      exec(code, locals())
    File "<string>", line 137, in <module>
    File "<string>", line 24, in get_cuda_bare_metal_version
  TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) 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: /home/username/anaconda3/envs/pytorch2.0.1/bin/python /home/username/anaconda3/envs/pytorch2.0.1/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpmu4m1bvb
  cwd: /home/username/apex
  Preparing metadata (pyproject.toml) ... error
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Minimal Steps/Code to Reproduce the Bug I attempted to install Apex using the following commands:

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

Expected Behavior Environment OS: Ubuntu 22.04.2 LTS (x86_64) Python version: 3.8.16 PyTorch version: 2.0.1+cu118

I find the solution to the problem is shown as below:

conda install -c nvidia cuda-nvcc
pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --global-option="--cpp_ext" --global-option="--cuda_ext" ./

thanks ! have solved

Minna786646 commented 8 months ago

I follow this solution, but it still reports the following error the bug: $ pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --global-option="--cpp_ext" --global-option="--cuda_ext" ./ Using pip 23.3.1 from D:\Program Files\Python39\lib\site-packages\pip (python 3.9) DEPRECATION: --build-option and --global-option are deprecated. pip 24.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. Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Processing d:\apex-master\apex Running command Preparing metadata (pyproject.toml) Traceback (most recent call last): File "D:\Program Files\Python39\lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in main() File "D:\Program Files\Python39\lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "D:\Program Files\Python39\lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 149, in prepare_metadata_for_build_wheel return hook(metadata_directory, config_settings) File "D:\Program Files\Python39\lib\site-packages\setuptools\build_meta.py", line 166, in prepare_metadata_for_build_wheel self.run_setup() File "D:\Program Files\Python39\lib\site-packages\setuptools\build_meta.py", line 150, in run_setup exec(compile(code, file, 'exec'), locals()) File "setup.py", line 5, in from packaging.version import parse, Version ModuleNotFoundError: No module named 'packaging' error: subprocess-exited-with-error

× Preparing metadata (pyproject.toml) 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:\Program Files\Python39\python.exe' 'D:\Program Files\Python39\lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\12725\AppData\Local\Temp\tmpk8l9bnmy' cwd: D:\apex-master\apex Preparing metadata (pyproject.toml) ... error error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details.

zhangxin-xd commented 8 months ago

Thanks! It works!!! conda install -c nvidia cuda-nvcc pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --global-option="--cpp_ext" --global-option="--cuda_ext" ./