NVIDIA / apex

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

关于解决ModuleNotFoundError: No module named 'torch'导致安装失败 #1852

Open Eikwang opened 1 month ago

Eikwang commented 1 month ago

尝试了很多此,成功安装。环境为:win10,python3.111,torch2.4.1,cuda12.4 使用CMD powershell会失败,不清楚原因。 将储存库clone到本地,然后运行cmd,进入仓库目录

执行 git checkout apex_no_distributed

执行 pip install -v --no-cache-dir ./

终于成功安装

SkybuckFlying commented 1 month ago

I have same problem:

(base) G:\Environments\Anaconda>dir
 Volume in drive G is APPLICATION HARDDISK
 Volume Serial Number is 0AE8-C66D

 Directory of G:\Environments\Anaconda

24/10/2024  22:48    <DIR>          .
24/10/2024  22:34    <DIR>          ..
24/10/2024  22:36                 0 .conda_envs_dir_test
24/10/2024  22:45    <DIR>          apex
24/10/2024  22:41    <DIR>          nemo
               1 File(s)              0 bytes
               4 Dir(s)  10,257,359,077,376 bytes free

(base) G:\Environments\Anaconda>conda activate nemo

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda>cd apex

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" .
Using pip 24.2 from G:\Environments\Anaconda\nemo\lib\site-packages\pip (python 3.10)
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.
Processing g:\environments\anaconda\apex
  Running command pip subprocess to install build dependencies
  Using pip 24.2 from G:\Environments\Anaconda\nemo\Lib\site-packages\pip (python 3.10)
  Collecting setuptools
    Using cached setuptools-75.2.0-py3-none-any.whl
  Collecting wheel
    Using cached wheel-0.44.0-py3-none-any.whl
  Installing collected packages: wheel, setuptools
    Creating G:\Temp\pip-build-env-g9c7o8b5\overlay\Scripts
  Successfully installed setuptools-75.2.0 wheel-0.44.0
  Installing build dependencies ... done
  Running command Getting requirements to build wheel
  Traceback (most recent call last):
    File "G:\Environments\Anaconda\nemo\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
      main()
    File "G:\Environments\Anaconda\nemo\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 "G:\Environments\Anaconda\nemo\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
    File "G:\Temp\pip-build-env-g9c7o8b5\overlay\Lib\site-packages\setuptools\build_meta.py", line 332, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=[])
    File "G:\Temp\pip-build-env-g9c7o8b5\overlay\Lib\site-packages\setuptools\build_meta.py", line 302, in _get_build_requires
      self.run_setup()
    File "G:\Temp\pip-build-env-g9c7o8b5\overlay\Lib\site-packages\setuptools\build_meta.py", line 318, in run_setup
      exec(code, locals())
    File "<string>", line 10, in <module>
  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: 'G:\Environments\Anaconda\nemo\python.exe' 'G:\Environments\Anaconda\nemo\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py' get_requires_for_build_wheel 'G:\Temp\tmpise3elvp'
  cwd: G:\Environments\Anaconda\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.

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>cd..

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda>pip install numpy
Requirement already satisfied: numpy in g:\environments\anaconda\nemo\lib\site-packages (1.23.5)

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda>pip install setuptools
Requirement already satisfied: setuptools in g:\environments\anaconda\nemo\lib\site-packages (75.1.0)

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda>cd apex

Bing co-pilot AI recommends following possible solution, not tried yet:

If torch still isn't recognized, let's add it manually to the build environment:

Modify Setup Script:

Open the setup.py file in the apex directory and ensure it includes torch in its requirements.

Example of Adding PyTorch to setup.py
python

Copy
import setuptools
from torch.utils.cpp_extension import BuildExtension, CUDAExtension

setuptools.setup(
    name='apex',
    ext_modules=[
        CUDAExtension('apex', [
            'apex.cpp',
        ]),
    ],
    cmdclass={
        'build_ext': BuildExtension
    },
    install_requires=[
        'torch>=1.0',  # Ensure the version matches your installed version
    ]
)
Finally, retry the installation:

sh

Copy
pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" .
These steps should help get everything in order. Let's see if this fixes the issue! 🚀 How's it looking now?
SkybuckFlying commented 1 month ago

Problem remains:

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>pip install -v --no-cache-dir --config-settings=--cpp_ext
--config-settings=--cuda_ext .

Usage:
  pip install [options] <requirement specifier> [package-index-options] ...
  pip install [options] -r <requirements file> [package-index-options] ...
  pip install [options] [-e] <vcs project url> ...
  pip install [options] [-e] <local project path> ...
  pip install [options] <archive url/path> ...

Arguments to --config-settings must be of the form KEY=VAL

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>pip install -v --no-cache-dir --config-settings cpp_ext=True --config-settings cuda_ext=True .
Using pip 24.2 from G:\Environments\Anaconda\nemo\lib\site-packages\pip (python 3.10)
Processing g:\environments\anaconda\apex
  Running command pip subprocess to install build dependencies
  Using pip 24.2 from G:\Environments\Anaconda\nemo\Lib\site-packages\pip (python 3.10)
  Collecting setuptools
    Obtaining dependency information for setuptools from https://files.pythonhosted.org/packages/31/2d/90165d51ecd38f9a02c6832198c13a4e48652485e2ccf863ebb942c531b6/setuptools-75.2.0-py3-none-any.whl.metadata
    Downloading setuptools-75.2.0-py3-none-any.whl.metadata (6.9 kB)
  Collecting wheel
    Obtaining dependency information for wheel from https://files.pythonhosted.org/packages/1b/d1/9babe2ccaecff775992753d8686970b1e2755d21c8a63be73aba7a4e7d77/wheel-0.44.0-py3-none-any.whl.metadata
    Using cached wheel-0.44.0-py3-none-any.whl.metadata (2.3 kB)
  Downloading setuptools-75.2.0-py3-none-any.whl (1.2 MB)
     ---------------------------------------- 1.2/1.2 MB 21.0 MB/s eta 0:00:00
  Using cached wheel-0.44.0-py3-none-any.whl (67 kB)
  Installing collected packages: wheel, setuptools
    Creating G:\Temp\pip-build-env-e_kqcffv\overlay\Scripts
  Successfully installed setuptools-75.2.0 wheel-0.44.0
  Installing build dependencies ... done
  Running command Getting requirements to build wheel
  Traceback (most recent call last):
    File "G:\Environments\Anaconda\nemo\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
      main()
    File "G:\Environments\Anaconda\nemo\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 "G:\Environments\Anaconda\nemo\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
    File "G:\Temp\pip-build-env-e_kqcffv\overlay\Lib\site-packages\setuptools\build_meta.py", line 332, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=[])
    File "G:\Temp\pip-build-env-e_kqcffv\overlay\Lib\site-packages\setuptools\build_meta.py", line 302, in _get_build_requires
      self.run_setup()
    File "G:\Temp\pip-build-env-e_kqcffv\overlay\Lib\site-packages\setuptools\build_meta.py", line 318, in run_setup
      exec(code, locals())
    File "<string>", line 10, in <module>
  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: 'G:\Environments\Anaconda\nemo\python.exe' 'G:\Environments\Anaconda\nemo\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py' get_requires_for_build_wheel 'G:\Temp\tmpq_cjx67r'
  cwd: G:\Environments\Anaconda\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.

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>pip install torch torchvision torchaudio
Requirement already satisfied: torch in g:\environments\anaconda\nemo\lib\site-packages (2.5.0)
Requirement already satisfied: torchvision in g:\environments\anaconda\nemo\lib\site-packages (0.20.0)
Requirement already satisfied: torchaudio in g:\environments\anaconda\nemo\lib\site-packages (2.5.0)
Requirement already satisfied: filelock in g:\environments\anaconda\nemo\lib\site-packages (from torch) (3.13.1)
Requirement already satisfied: typing-extensions>=4.8.0 in g:\environments\anaconda\nemo\lib\site-packages (from torch) (4.11.0)
Requirement already satisfied: networkx in g:\environments\anaconda\nemo\lib\site-packages (from torch) (3.2.1)
Requirement already satisfied: jinja2 in g:\environments\anaconda\nemo\lib\site-packages (from torch) (3.1.4)
Requirement already satisfied: fsspec in g:\environments\anaconda\nemo\lib\site-packages (from torch) (2024.10.0)
Requirement already satisfied: sympy==1.13.1 in g:\environments\anaconda\nemo\lib\site-packages (from torch) (1.13.1)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in g:\environments\anaconda\nemo\lib\site-packages (from sympy==1.13.1->torch) (1.3.0)
Requirement already satisfied: numpy in g:\environments\anaconda\nemo\lib\site-packages (from torchvision) (1.23.5)
Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in g:\environments\anaconda\nemo\lib\site-packages (from torchvision) (10.4.0)
Requirement already satisfied: MarkupSafe>=2.0 in g:\environments\anaconda\nemo\lib\site-packages (from jinja2->torch) (2.1.3)

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>python -c "import torch; print(torch.__version__)"
2.5.0

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>pip install -v --no-cache-dir --config-settings cpp_ext=True --config-settings cuda_ext=True .
Using pip 24.2 from G:\Environments\Anaconda\nemo\lib\site-packages\pip (python 3.10)
Processing g:\environments\anaconda\apex
  Running command pip subprocess to install build dependencies
  Using pip 24.2 from G:\Environments\Anaconda\nemo\Lib\site-packages\pip (python 3.10)
  Collecting setuptools
    Obtaining dependency information for setuptools from https://files.pythonhosted.org/packages/31/2d/90165d51ecd38f9a02c6832198c13a4e48652485e2ccf863ebb942c531b6/setuptools-75.2.0-py3-none-any.whl.metadata
    Using cached setuptools-75.2.0-py3-none-any.whl.metadata (6.9 kB)
  Collecting wheel
    Obtaining dependency information for wheel from https://files.pythonhosted.org/packages/1b/d1/9babe2ccaecff775992753d8686970b1e2755d21c8a63be73aba7a4e7d77/wheel-0.44.0-py3-none-any.whl.metadata
    Using cached wheel-0.44.0-py3-none-any.whl.metadata (2.3 kB)
  Using cached setuptools-75.2.0-py3-none-any.whl (1.2 MB)
  Using cached wheel-0.44.0-py3-none-any.whl (67 kB)
  Installing collected packages: wheel, setuptools
    Creating G:\Temp\pip-build-env-jsfp9wdz\overlay\Scripts
  Successfully installed setuptools-75.2.0 wheel-0.44.0
  Installing build dependencies ... done
  Running command Getting requirements to build wheel
  Traceback (most recent call last):
    File "G:\Environments\Anaconda\nemo\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
      main()
    File "G:\Environments\Anaconda\nemo\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 "G:\Environments\Anaconda\nemo\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
    File "G:\Temp\pip-build-env-jsfp9wdz\overlay\Lib\site-packages\setuptools\build_meta.py", line 332, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=[])
    File "G:\Temp\pip-build-env-jsfp9wdz\overlay\Lib\site-packages\setuptools\build_meta.py", line 302, in _get_build_requires
      self.run_setup()
    File "G:\Temp\pip-build-env-jsfp9wdz\overlay\Lib\site-packages\setuptools\build_meta.py", line 318, in run_setup
      exec(code, locals())
    File "<string>", line 10, in <module>
  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: 'G:\Environments\Anaconda\nemo\python.exe' 'G:\Environments\Anaconda\nemo\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py' get_requires_for_build_wheel 'G:\Temp\tmpwfikc2lc'
  cwd: G:\Environments\Anaconda\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.

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>python -m pip install --upgrade pip setuptools
Requirement already satisfied: pip in g:\environments\anaconda\nemo\lib\site-packages (24.2)
Requirement already satisfied: setuptools in g:\environments\anaconda\nemo\lib\site-packages (75.1.0)
Collecting setuptools
  Using cached setuptools-75.2.0-py3-none-any.whl.metadata (6.9 kB)
Using cached setuptools-75.2.0-py3-none-any.whl (1.2 MB)
Installing collected packages: setuptools
  Attempting uninstall: setuptools
    Found existing installation: setuptools 75.1.0
    Uninstalling setuptools-75.1.0:
      Successfully uninstalled setuptools-75.1.0
Successfully installed setuptools-75.2.0

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>pip install -v --no-cache-dir --config-settings cpp_ext=True --config-settings cuda_ext=True .
Using pip 24.2 from G:\Environments\Anaconda\nemo\lib\site-packages\pip (python 3.10)
Processing g:\environments\anaconda\apex
  Running command pip subprocess to install build dependencies
  Using pip 24.2 from G:\Environments\Anaconda\nemo\Lib\site-packages\pip (python 3.10)
  Collecting setuptools
    Obtaining dependency information for setuptools from https://files.pythonhosted.org/packages/31/2d/90165d51ecd38f9a02c6832198c13a4e48652485e2ccf863ebb942c531b6/setuptools-75.2.0-py3-none-any.whl.metadata
    Using cached setuptools-75.2.0-py3-none-any.whl.metadata (6.9 kB)
  Collecting wheel
    Obtaining dependency information for wheel from https://files.pythonhosted.org/packages/1b/d1/9babe2ccaecff775992753d8686970b1e2755d21c8a63be73aba7a4e7d77/wheel-0.44.0-py3-none-any.whl.metadata
    Using cached wheel-0.44.0-py3-none-any.whl.metadata (2.3 kB)
  Using cached setuptools-75.2.0-py3-none-any.whl (1.2 MB)
  Using cached wheel-0.44.0-py3-none-any.whl (67 kB)
  Installing collected packages: wheel, setuptools
    Creating G:\Temp\pip-build-env-2xq524py\overlay\Scripts
  Successfully installed setuptools-75.2.0 wheel-0.44.0
  Installing build dependencies ... done
  Running command Getting requirements to build wheel
  Traceback (most recent call last):
    File "G:\Environments\Anaconda\nemo\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
      main()
    File "G:\Environments\Anaconda\nemo\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 "G:\Environments\Anaconda\nemo\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
    File "G:\Temp\pip-build-env-2xq524py\overlay\Lib\site-packages\setuptools\build_meta.py", line 332, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=[])
    File "G:\Temp\pip-build-env-2xq524py\overlay\Lib\site-packages\setuptools\build_meta.py", line 302, in _get_build_requires
      self.run_setup()
    File "G:\Temp\pip-build-env-2xq524py\overlay\Lib\site-packages\setuptools\build_meta.py", line 318, in run_setup
      exec(code, locals())
    File "<string>", line 10, in <module>
  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: 'G:\Environments\Anaconda\nemo\python.exe' 'G:\Environments\Anaconda\nemo\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py' get_requires_for_build_wheel 'G:\Temp\tmpdllp9e99'
  cwd: G:\Environments\Anaconda\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.

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>
SkybuckFlying commented 1 month ago

Maybe this will help:

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>python setup.py install --cpp_ext --cuda_ext

torch.__version__  = 2.5.0

Traceback (most recent call last):
  File "G:\Environments\Anaconda\apex\setup.py", line 137, in <module>
    _, bare_metal_version = get_cuda_bare_metal_version(CUDA_HOME)
  File "G:\Environments\Anaconda\apex\setup.py", line 24, in get_cuda_bare_metal_version
    raw_output = subprocess.check_output([cuda_dir + "/bin/nvcc", "-V"], universal_newlines=True)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>
Answer | Phind-70B Model
Based on the error message and search results provided, it appears that the issue is related to the CUDA_HOME environment variable not being set correctly. Here's an analysis of the problem and some potential solutions:

Error Analysis
The main error encountered is:

TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
This occurs in the get_cuda_bare_metal_version function, specifically when trying to concatenate cuda_dir (which is None) with "/bin/nvcc".

Key Points to Consider
CUDA_HOME environment variable: The error suggests that the CUDA_HOME environment variable is not set or not recognized.
PyTorch installation: Despite PyTorch being installed, the CUDA-related components seem to be inaccessible.
Build process: The error occurs during the build process of Apex, indicating that the build environment doesn't have access to CUDA tools.
Potential Solutions
Set CUDA_HOME environment variable: Explicitly set the CUDA_HOME environment variable before running the installation:
set CUDA_HOME=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4
Replace the path with your actual CUDA installation directory.

Verify CUDA installation: Ensure that CUDA is properly installed on your system. You can check this by running:
nvcc --version
Use Conda to install Apex: Instead of using pip, try installing Apex using Conda:
conda install -c nvidia apex
Specify CUDA_HOME in setup.py: Modify the setup.py file in the Apex directory to explicitly set CUDA_HOME:
import os
os.environ['CUDA_HOME'] = r'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4'
Add this at the beginning of the setup.py file.

Check PyTorch installation: Verify that PyTorch was installed with CUDA support:
python -c "import torch; print(torch.cuda.is_available())"
This should return True if CUDA is properly configured.

Reinstall PyTorch with CUDA support: If the above command returns False, reinstall PyTorch with CUDA support:
pip uninstall torch torchvision torchaudio
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
Replace cu117 with the appropriate CUDA version for your system.

Update PATH: Ensure that the CUDA bin directory is in your system PATH:
setx PATH "%PATH%;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\bin"
Summary
The primary issue appears to be related to the CUDA_HOME environment variable not being recognized during the Apex installation process. Try setting the CUDA_HOME variable explicitly, verifying your CUDA installation, and ensuring that PyTorch was installed with CUDA support. If problems persist, consider modifying the setup.py file or using Conda to install Apex. Remember to replace the paths with your actual CUDA installation directories.
SkybuckFlying commented 1 month ago

Going to install CUDA toolkit, it makes kinda sense :)

https://developer.nvidia.com/cuda-downloads

SkybuckFlying commented 1 month ago

After cuda install, following command works, after restarting anaconda prompt:

(base) C:\Users\skybu>nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Thu_Sep_12_02:55:00_Pacific_Daylight_Time_2024
Cuda compilation tools, release 12.6, V12.6.77
Build cuda_12.6.r12.6/compiler.34841621_0

(base) C:\Users\skybu>
SkybuckFlying commented 1 month ago

Hmm still some problems:

(base) C:\Users\skybu>conda activate nemo

(G:\Environments\Anaconda\nemo) C:\Users\skybu>cd..

(G:\Environments\Anaconda\nemo) C:\Users>cd..

(G:\Environments\Anaconda\nemo) C:\>g:

(G:\Environments\Anaconda\nemo) G:\>cd Environments

(G:\Environments\Anaconda\nemo) G:\Environments>cd Anaconda

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda>dir
 Volume in drive G is APPLICATION HARDDISK
 Volume Serial Number is 0AE8-C66D

 Directory of G:\Environments\Anaconda

24/10/2024  23:27    <DIR>          .
24/10/2024  22:34    <DIR>          ..
24/10/2024  22:36                 0 .conda_envs_dir_test
24/10/2024  22:45    <DIR>          apex
24/10/2024  22:41    <DIR>          nemo
               1 File(s)              0 bytes
               4 Dir(s)  10,250,682,040,320 bytes free

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda>cd apex

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>cd..

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda>pip install --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" nvidia-apex
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.
ERROR: Could not find a version that satisfies the requirement nvidia-apex (from versions: none)
ERROR: No matching distribution found for nvidia-apex

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda>cd apex

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>python setup.py install --cpp_ext --cuda_ext

torch.__version__  = 2.5.0

Compiling cuda extensions with
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Thu_Sep_12_02:55:00_Pacific_Daylight_Time_2024
Cuda compilation tools, release 12.6, V12.6.77
Build cuda_12.6.r12.6/compiler.34841621_0
from G:\Tools\CUDA\version12.6/bin

Traceback (most recent call last):
  File "G:\Environments\Anaconda\apex\setup.py", line 178, in <module>
    check_cuda_torch_binary_vs_bare_metal(CUDA_HOME)
  File "G:\Environments\Anaconda\apex\setup.py", line 40, in check_cuda_torch_binary_vs_bare_metal
    raise RuntimeError(
RuntimeError: Cuda extensions are being compiled with a version of Cuda that does not match the version used to compile Pytorch binaries.  Pytorch binaries were compiled with Cuda 11.8.
In some cases, a minor-version mismatch will not cause later errors:  https://github.com/NVIDIA/apex/pull/323#discussion_r287021798.  You can try commenting out this check (at your own risk).

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>
SkybuckFlying commented 1 month ago

Weird:


(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>cd..

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda>conda install -c nvidia apex
Channels:
 - nvidia
 - defaults
 - pytorch
Platform: win-64
Collecting package metadata (repodata.json): done
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  - apex

Current channels:

  - https://conda.anaconda.org/nvidia
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - https://repo.anaconda.com/pkgs/msys2
  - https://conda.anaconda.org/pytorch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.
SkybuckFlying commented 1 month ago

Funny problem remains:


(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda>cd apex

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>python -m pip install -v --no-cache-dir --config-settings cpp_ext=True --config-settings cuda_ext=True .
Using pip 24.2 from G:\Environments\Anaconda\nemo\lib\site-packages\pip (python 3.10)
Processing g:\environments\anaconda\apex
  Running command pip subprocess to install build dependencies
  Using pip 24.2 from G:\Environments\Anaconda\nemo\Lib\site-packages\pip (python 3.10)
  Collecting setuptools
    Obtaining dependency information for setuptools from https://files.pythonhosted.org/packages/31/2d/90165d51ecd38f9a02c6832198c13a4e48652485e2ccf863ebb942c531b6/setuptools-75.2.0-py3-none-any.whl.metadata
    Using cached setuptools-75.2.0-py3-none-any.whl.metadata (6.9 kB)
  Collecting wheel
    Obtaining dependency information for wheel from https://files.pythonhosted.org/packages/1b/d1/9babe2ccaecff775992753d8686970b1e2755d21c8a63be73aba7a4e7d77/wheel-0.44.0-py3-none-any.whl.metadata
    Using cached wheel-0.44.0-py3-none-any.whl.metadata (2.3 kB)
  Using cached setuptools-75.2.0-py3-none-any.whl (1.2 MB)
  Using cached wheel-0.44.0-py3-none-any.whl (67 kB)
  Installing collected packages: wheel, setuptools
    Creating G:\Temp\pip-build-env-7yk09ewz\overlay\Scripts
  Successfully installed setuptools-75.2.0 wheel-0.44.0
  Installing build dependencies ... done
  Running command Getting requirements to build wheel
  Traceback (most recent call last):
    File "G:\Environments\Anaconda\nemo\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
      main()
    File "G:\Environments\Anaconda\nemo\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 "G:\Environments\Anaconda\nemo\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
    File "G:\Temp\pip-build-env-7yk09ewz\overlay\Lib\site-packages\setuptools\build_meta.py", line 332, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=[])
    File "G:\Temp\pip-build-env-7yk09ewz\overlay\Lib\site-packages\setuptools\build_meta.py", line 302, in _get_build_requires
      self.run_setup()
    File "G:\Temp\pip-build-env-7yk09ewz\overlay\Lib\site-packages\setuptools\build_meta.py", line 318, in run_setup
      exec(code, locals())
    File "<string>", line 10, in <module>
  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: 'G:\Environments\Anaconda\nemo\python.exe' 'G:\Environments\Anaconda\nemo\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py' get_requires_for_build_wheel 'G:\Temp\tmp0pgsqysr'
  cwd: G:\Environments\Anaconda\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.

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>
SkybuckFlying commented 1 month ago

Now I try your method:

git checkout apex_no_distributed pip install -v --no-cache-dir ./

Hmm still problem:


(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>git checkout apex_no_distributed
error: pathspec 'apex_no_distributed' did not match any file(s) known to git

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>dir
 Volume in drive G is APPLICATION HARDDISK
 Volume Serial Number is 0AE8-C66D

 Directory of G:\Environments\Anaconda\apex

24/10/2024  22:45    <DIR>          .
24/10/2024  23:27    <DIR>          ..
24/10/2024  22:45    <DIR>          .github
24/10/2024  22:45             2,331 .gitignore
24/10/2024  22:45               313 .gitmodules
24/10/2024  22:45                 0 .nojekyll
24/10/2024  22:45    <DIR>          apex
24/10/2024  22:45    <DIR>          csrc
24/10/2024  22:45    <DIR>          docs
24/10/2024  22:45    <DIR>          examples
24/10/2024  22:45             1,459 LICENSE
24/10/2024  22:45               107 pyproject.toml
24/10/2024  22:45             9,902 README.md
24/10/2024  22:45                90 requirements.txt
24/10/2024  22:45                49 requirements_dev.txt
24/10/2024  22:45            35,961 setup.py
24/10/2024  22:45    <DIR>          tests
               9 File(s)         50,212 bytes
               8 Dir(s)  10,250,682,040,320 bytes free

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>git checkout apex_no_distributed
error: pathspec 'apex_no_distributed' did not match any file(s) known to git

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>pip install -v --no-cache-dir ./
Using pip 24.2 from G:\Environments\Anaconda\nemo\lib\site-packages\pip (python 3.10)
Processing g:\environments\anaconda\apex
  Running command pip subprocess to install build dependencies
  Using pip 24.2 from G:\Environments\Anaconda\nemo\Lib\site-packages\pip (python 3.10)
  Collecting setuptools
    Obtaining dependency information for setuptools from https://files.pythonhosted.org/packages/31/2d/90165d51ecd38f9a02c6832198c13a4e48652485e2ccf863ebb942c531b6/setuptools-75.2.0-py3-none-any.whl.metadata
    Using cached setuptools-75.2.0-py3-none-any.whl.metadata (6.9 kB)
  Collecting wheel
    Obtaining dependency information for wheel from https://files.pythonhosted.org/packages/1b/d1/9babe2ccaecff775992753d8686970b1e2755d21c8a63be73aba7a4e7d77/wheel-0.44.0-py3-none-any.whl.metadata
    Using cached wheel-0.44.0-py3-none-any.whl.metadata (2.3 kB)
  Using cached setuptools-75.2.0-py3-none-any.whl (1.2 MB)
  Using cached wheel-0.44.0-py3-none-any.whl (67 kB)
  Installing collected packages: wheel, setuptools
    Creating G:\Temp\pip-build-env-5abw94vi\overlay\Scripts
  Successfully installed setuptools-75.2.0 wheel-0.44.0
  Installing build dependencies ... done
  Running command Getting requirements to build wheel
  Traceback (most recent call last):
    File "G:\Environments\Anaconda\nemo\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
      main()
    File "G:\Environments\Anaconda\nemo\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 "G:\Environments\Anaconda\nemo\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
    File "G:\Temp\pip-build-env-5abw94vi\overlay\Lib\site-packages\setuptools\build_meta.py", line 332, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=[])
    File "G:\Temp\pip-build-env-5abw94vi\overlay\Lib\site-packages\setuptools\build_meta.py", line 302, in _get_build_requires
      self.run_setup()
    File "G:\Temp\pip-build-env-5abw94vi\overlay\Lib\site-packages\setuptools\build_meta.py", line 318, in run_setup
      exec(code, locals())
    File "<string>", line 10, in <module>
  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: 'G:\Environments\Anaconda\nemo\python.exe' 'G:\Environments\Anaconda\nemo\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py' get_requires_for_build_wheel 'G:\Temp\tmpscaeflbw'
  cwd: G:\Environments\Anaconda\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.

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>
SkybuckFlying commented 1 month ago

Probably not all branches cloned:

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>git branch
* master

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>
SkybuckFlying commented 1 month ago

CUDA_HOME environment variables still not setup on Windows 11. I notice this with other installation tools as well, it's kinda strange. Maybe it's a windows 11 bug or protection feature:

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda>echo %CUDA_HOME% %CUDA_HOME%

Must add it manually it seems.

SkybuckFlying commented 1 month ago

CUDA_PATH is added, but it's different from CUDA_HOME... CUDA_HOME is missing.

SkybuckFlying commented 1 month ago

Problem remains... hmmmm:

(base) G:\>cd Environments

(base) G:\Environments>cd Anaconda

(base) G:\Environments\Anaconda>dir
 Volume in drive G is APPLICATION HARDDISK
 Volume Serial Number is 0AE8-C66D

 Directory of G:\Environments\Anaconda

24/10/2024  23:27    <DIR>          .
24/10/2024  22:34    <DIR>          ..
24/10/2024  22:36                 0 .conda_envs_dir_test
24/10/2024  22:45    <DIR>          apex
24/10/2024  22:41    <DIR>          nemo
               1 File(s)              0 bytes
               4 Dir(s)  10,250,682,040,320 bytes free

(base) G:\Environments\Anaconda>conda activate nemo

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda>echo %CUDA_HOME%
G:\Tools\CUDA\version12.6

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda>cd apex

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>pip install --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" nvidia-apex
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.
ERROR: Could not find a version that satisfies the requirement nvidia-apex (from versions: none)
ERROR: No matching distribution found for nvidia-apex

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>python setup.py install --cpp_ext --cuda_ext

torch.__version__  = 2.5.0

Compiling cuda extensions with
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Thu_Sep_12_02:55:00_Pacific_Daylight_Time_2024
Cuda compilation tools, release 12.6, V12.6.77
Build cuda_12.6.r12.6/compiler.34841621_0
from G:\Tools\CUDA\version12.6/bin

Traceback (most recent call last):
  File "G:\Environments\Anaconda\apex\setup.py", line 178, in <module>
    check_cuda_torch_binary_vs_bare_metal(CUDA_HOME)
  File "G:\Environments\Anaconda\apex\setup.py", line 40, in check_cuda_torch_binary_vs_bare_metal
    raise RuntimeError(
RuntimeError: Cuda extensions are being compiled with a version of Cuda that does not match the version used to compile Pytorch binaries.  Pytorch binaries were compiled with Cuda 11.8.
In some cases, a minor-version mismatch will not cause later errors:  https://github.com/NVIDIA/apex/pull/323#discussion_r287021798.  You can try commenting out this check (at your own risk).

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" .
Using pip 24.2 from G:\Environments\Anaconda\nemo\lib\site-packages\pip (python 3.10)
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.
Processing g:\environments\anaconda\apex
  Running command pip subprocess to install build dependencies
  Using pip 24.2 from G:\Environments\Anaconda\nemo\Lib\site-packages\pip (python 3.10)
  Collecting setuptools
    Using cached setuptools-75.2.0-py3-none-any.whl
  Collecting wheel
    Using cached wheel-0.44.0-py3-none-any.whl
  Installing collected packages: wheel, setuptools
    Creating G:\Temp\pip-build-env-v1yr1vlf\overlay\Scripts
  Successfully installed setuptools-75.2.0 wheel-0.44.0
  Installing build dependencies ... done
  Running command Getting requirements to build wheel
  Traceback (most recent call last):
    File "G:\Environments\Anaconda\nemo\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
      main()
    File "G:\Environments\Anaconda\nemo\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 "G:\Environments\Anaconda\nemo\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
    File "G:\Temp\pip-build-env-v1yr1vlf\overlay\Lib\site-packages\setuptools\build_meta.py", line 332, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=[])
    File "G:\Temp\pip-build-env-v1yr1vlf\overlay\Lib\site-packages\setuptools\build_meta.py", line 302, in _get_build_requires
      self.run_setup()
    File "G:\Temp\pip-build-env-v1yr1vlf\overlay\Lib\site-packages\setuptools\build_meta.py", line 318, in run_setup
      exec(code, locals())
    File "<string>", line 10, in <module>
  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: 'G:\Environments\Anaconda\nemo\python.exe' 'G:\Environments\Anaconda\nemo\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py' get_requires_for_build_wheel 'G:\Temp\tmpiav1bn5j'
  cwd: G:\Environments\Anaconda\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.

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda\apex>
SkybuckFlying commented 1 month ago

Trying new cuda enabled environment:

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda>conda create --name apex_env python=3.12.7 pytorch cudatoolkit=
11.8

Channels:
 - defaults
Platform: win-64
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: G:\Environments\Anaconda\apex_env

  added / updated specs:
    - cudatoolkit=11.8
    - python=3.12.7
    - pytorch

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    cudatoolkit-11.8.0         |       hd77b12b_0       639.8 MB
    pytorch-2.3.0              |cpu_py312h443c98c_1       114.4 MB
    ------------------------------------------------------------
                                           Total:       754.2 MB

The following NEW packages will be INSTALLED:

  blas               pkgs/main/win-64::blas-1.0-mkl
  bzip2              pkgs/main/win-64::bzip2-1.0.8-h2bbff1b_6
  ca-certificates    pkgs/main/win-64::ca-certificates-2024.9.24-haa95532_0
  cudatoolkit        pkgs/main/win-64::cudatoolkit-11.8.0-hd77b12b_0
  expat              pkgs/main/win-64::expat-2.6.3-h5da7b33_0
  filelock           pkgs/main/win-64::filelock-3.13.1-py312haa95532_0
  fsspec             pkgs/main/win-64::fsspec-2024.6.1-py312haa95532_0
  intel-openmp       pkgs/main/win-64::intel-openmp-2023.1.0-h59b6b97_46320
  jinja2             pkgs/main/win-64::jinja2-3.1.4-py312haa95532_0
  libffi             pkgs/main/win-64::libffi-3.4.4-hd77b12b_1
  libuv              pkgs/main/win-64::libuv-1.48.0-h827c3e9_0
  markupsafe         pkgs/main/win-64::markupsafe-2.1.3-py312h2bbff1b_0
  mkl                pkgs/main/win-64::mkl-2023.1.0-h6b88ed4_46358
  mkl-service        pkgs/main/win-64::mkl-service-2.4.0-py312h2bbff1b_1
  mkl_fft            pkgs/main/win-64::mkl_fft-1.3.10-py312h827c3e9_0
  mkl_random         pkgs/main/win-64::mkl_random-1.2.7-py312h0158946_0
  mpmath             pkgs/main/win-64::mpmath-1.3.0-py312haa95532_0
  networkx           pkgs/main/win-64::networkx-3.3-py312haa95532_0
  numpy              pkgs/main/win-64::numpy-1.26.4-py312hfd52020_0
  numpy-base         pkgs/main/win-64::numpy-base-1.26.4-py312h4dde369_0
  openssl            pkgs/main/win-64::openssl-3.0.15-h827c3e9_0
  pip                pkgs/main/win-64::pip-24.2-py312haa95532_0
  python             pkgs/main/win-64::python-3.12.7-h14ffc60_0
  pytorch            pkgs/main/win-64::pytorch-2.3.0-cpu_py312h443c98c_1
  setuptools         pkgs/main/win-64::setuptools-75.1.0-py312haa95532_0
  sqlite             pkgs/main/win-64::sqlite-3.45.3-h2bbff1b_0
  sympy              pkgs/main/win-64::sympy-1.13.2-py312haa95532_0
  tbb                pkgs/main/win-64::tbb-2021.8.0-h59b6b97_0
  tk                 pkgs/main/win-64::tk-8.6.14-h0416ee5_0
  typing_extensions  pkgs/main/win-64::typing_extensions-4.11.0-py312haa95532_0
  tzdata             pkgs/main/noarch::tzdata-2024b-h04d1e81_0
  vc                 pkgs/main/win-64::vc-14.40-h2eaa2aa_1
  vs2015_runtime     pkgs/main/win-64::vs2015_runtime-14.40.33807-h98bb1dd_1
  wheel              pkgs/main/win-64::wheel-0.44.0-py312haa95532_0
  xz                 pkgs/main/win-64::xz-5.4.6-h8cc25b3_1
  zlib               pkgs/main/win-64::zlib-1.2.13-h8cc25b3_1

Proceed ([y]/n)? y

Downloading and Extracting Packages:

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate apex_env
#
# To deactivate an active environment, use
#
#     $ conda deactivate
SkybuckFlying commented 1 month ago

Bizar:

(G:\Environments\Anaconda\nemo) G:\Environments\Anaconda>conda activate apex_env

(G:\Environments\Anaconda\apex_env) G:\Environments\Anaconda>conda install -c nvidia apex
Channels:
 - nvidia
 - defaults
Platform: win-64
Collecting package metadata (repodata.json): done
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  - apex

Current channels:

  - https://conda.anaconda.org/nvidia
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - https://repo.anaconda.com/pkgs/msys2

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

(G:\Environments\Anaconda\apex_env) G:\Environments\Anaconda>
SkybuckFlying commented 1 month ago

Also not work:


(G:\Environments\Anaconda\apex_env) G:\Environments\Anaconda>pip install apex
Collecting apex
  Downloading apex-0.9.10dev.tar.gz (36 kB)
  Preparing metadata (setup.py) ... done
Collecting cryptacular (from apex)
  Downloading cryptacular-1.6.2.tar.gz (75 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 2
  ╰─> [4 lines of output]
      scons: Reading SConscript files ...
      ModuleNotFoundError: No module named 'distutils.msvccompiler':
        File "G:\Temp\pip-install-u1o0boll\cryptacular_4a05eab54984421481a2fc8206dd5a75\SConstruct", line 21:
          import distutils.msvccompiler
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
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.

(G:\Environments\Anaconda\apex_env) G:\Environments\Anaconda>
SkybuckFlying commented 1 month ago

Also fail:

(G:\Environments\Anaconda\apex_env) G:\Environments\Anaconda\apex>pip install packaging
Collecting packaging
  Using cached packaging-24.1-py3-none-any.whl.metadata (3.2 kB)
Using cached packaging-24.1-py3-none-any.whl (53 kB)
Installing collected packages: packaging
Successfully installed packaging-24.1

(G:\Environments\Anaconda\apex_env) G:\Environments\Anaconda\apex>pip install setuptools==58.1.0
Collecting setuptools==58.1.0
  Downloading setuptools-58.1.0-py3-none-any.whl.metadata (4.9 kB)
Downloading setuptools-58.1.0-py3-none-any.whl (816 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 816.7/816.7 kB 17.9 MB/s eta 0:00:00
Installing collected packages: setuptools
  Attempting uninstall: setuptools
    Found existing installation: setuptools 75.1.0
    Uninstalling setuptools-75.1.0:
      Successfully uninstalled setuptools-75.1.0
Successfully installed setuptools-58.1.0

(G:\Environments\Anaconda\apex_env) G:\Environments\Anaconda\apex>pip install setuptools_scm
Collecting setuptools_scm
  Downloading setuptools_scm-8.1.0-py3-none-any.whl.metadata (6.6 kB)
Requirement already satisfied: packaging>=20 in g:\environments\anaconda\apex_env\lib\site-packages (from setuptools_scm) (24.1)
Requirement already satisfied: setuptools in g:\environments\anaconda\apex_env\lib\site-packages (from setuptools_scm) (58.1.0)
Downloading setuptools_scm-8.1.0-py3-none-any.whl (43 kB)
Installing collected packages: setuptools_scm
Successfully installed setuptools_scm-8.1.0

(G:\Environments\Anaconda\apex_env) G:\Environments\Anaconda\apex>conda create --name new_apex_env python=3.10
Channels:
 - defaults
Platform: win-64
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: G:\Environments\Anaconda\new_apex_env

  added / updated specs:
    - python=3.10

The following NEW packages will be INSTALLED:

  bzip2              pkgs/main/win-64::bzip2-1.0.8-h2bbff1b_6
  ca-certificates    pkgs/main/win-64::ca-certificates-2024.9.24-haa95532_0
  libffi             pkgs/main/win-64::libffi-3.4.4-hd77b12b_1
  openssl            pkgs/main/win-64::openssl-3.0.15-h827c3e9_0
  pip                pkgs/main/win-64::pip-24.2-py310haa95532_0
  python             pkgs/main/win-64::python-3.10.15-h4607a30_1
  setuptools         pkgs/main/win-64::setuptools-75.1.0-py310haa95532_0
  sqlite             pkgs/main/win-64::sqlite-3.45.3-h2bbff1b_0
  tk                 pkgs/main/win-64::tk-8.6.14-h0416ee5_0
  tzdata             pkgs/main/noarch::tzdata-2024b-h04d1e81_0
  vc                 pkgs/main/win-64::vc-14.40-h2eaa2aa_1
  vs2015_runtime     pkgs/main/win-64::vs2015_runtime-14.40.33807-h98bb1dd_1
  wheel              pkgs/main/win-64::wheel-0.44.0-py310haa95532_0
  xz                 pkgs/main/win-64::xz-5.4.6-h8cc25b3_1
  zlib               pkgs/main/win-64::zlib-1.2.13-h8cc25b3_1

Proceed ([y]/n)? y

Downloading and Extracting Packages:

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate new_apex_env
#
# To deactivate an active environment, use
#
#     $ conda deactivate

(G:\Environments\Anaconda\apex_env) G:\Environments\Anaconda\apex>conda activate apex_env

(G:\Environments\Anaconda\apex_env) G:\Environments\Anaconda\apex>conda activate new_apex_env

(G:\Environments\Anaconda\new_apex_env) G:\Environments\Anaconda\apex>conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
Channels:
 - pytorch
 - nvidia
 - defaults
Platform: win-64
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: G:\Environments\Anaconda\new_apex_env

  added / updated specs:
    - pytorch
    - pytorch-cuda=11.8
    - torchaudio
    - torchvision

The following NEW packages will be INSTALLED:

  blas               pkgs/main/win-64::blas-1.0-mkl
  brotli-python      pkgs/main/win-64::brotli-python-1.0.9-py310hd77b12b_8
  certifi            pkgs/main/win-64::certifi-2024.8.30-py310haa95532_0
  charset-normalizer pkgs/main/noarch::charset-normalizer-3.3.2-pyhd3eb1b0_0
  cuda-cccl          nvidia/win-64::cuda-cccl-12.6.77-0
  cuda-cccl_win-64   nvidia/noarch::cuda-cccl_win-64-12.6.77-0
  cuda-cudart        nvidia/win-64::cuda-cudart-11.8.89-0
  cuda-cudart-dev    nvidia/win-64::cuda-cudart-dev-11.8.89-0
  cuda-cupti         nvidia/win-64::cuda-cupti-11.8.87-0
  cuda-libraries     nvidia/win-64::cuda-libraries-11.8.0-0
  cuda-libraries-dev nvidia/win-64::cuda-libraries-dev-11.8.0-0
  cuda-nvrtc         nvidia/win-64::cuda-nvrtc-11.8.89-0
  cuda-nvrtc-dev     nvidia/win-64::cuda-nvrtc-dev-11.8.89-0
  cuda-nvtx          nvidia/win-64::cuda-nvtx-11.8.86-0
  cuda-profiler-api  nvidia/win-64::cuda-profiler-api-12.6.77-0
  cuda-runtime       nvidia/win-64::cuda-runtime-11.8.0-0
  cuda-version       nvidia/noarch::cuda-version-12.6-3
  filelock           pkgs/main/win-64::filelock-3.13.1-py310haa95532_0
  freetype           pkgs/main/win-64::freetype-2.12.1-ha860e81_0
  giflib             pkgs/main/win-64::giflib-5.2.2-h7edc060_0
  gmpy2              pkgs/main/win-64::gmpy2-2.1.2-py310h7f96b67_0
  idna               pkgs/main/win-64::idna-3.7-py310haa95532_0
  intel-openmp       pkgs/main/win-64::intel-openmp-2023.1.0-h59b6b97_46320
  jinja2             pkgs/main/win-64::jinja2-3.1.4-py310haa95532_0
  jpeg               pkgs/main/win-64::jpeg-9e-h827c3e9_3
  lcms2              pkgs/main/win-64::lcms2-2.12-h83e58a3_0
  lerc               pkgs/main/win-64::lerc-3.0-hd77b12b_0
  libcublas          nvidia/win-64::libcublas-11.11.3.6-0
  libcublas-dev      nvidia/win-64::libcublas-dev-11.11.3.6-0
  libcufft           nvidia/win-64::libcufft-10.9.0.58-0
  libcufft-dev       nvidia/win-64::libcufft-dev-10.9.0.58-0
  libcurand          nvidia/win-64::libcurand-10.3.7.77-0
  libcurand-dev      nvidia/win-64::libcurand-dev-10.3.7.77-0
  libcusolver        nvidia/win-64::libcusolver-11.4.1.48-0
  libcusolver-dev    nvidia/win-64::libcusolver-dev-11.4.1.48-0
  libcusparse        nvidia/win-64::libcusparse-11.7.5.86-0
  libcusparse-dev    nvidia/win-64::libcusparse-dev-11.7.5.86-0
  libdeflate         pkgs/main/win-64::libdeflate-1.17-h2bbff1b_1
  libjpeg-turbo      pkgs/main/win-64::libjpeg-turbo-2.0.0-h196d8e1_0
  libnpp             nvidia/win-64::libnpp-11.8.0.86-0
  libnpp-dev         nvidia/win-64::libnpp-dev-11.8.0.86-0
  libnvjpeg          nvidia/win-64::libnvjpeg-11.9.0.86-0
  libnvjpeg-dev      nvidia/win-64::libnvjpeg-dev-11.9.0.86-0
  libpng             pkgs/main/win-64::libpng-1.6.39-h8cc25b3_0
  libtiff            pkgs/main/win-64::libtiff-4.5.1-hd77b12b_0
  libuv              pkgs/main/win-64::libuv-1.48.0-h827c3e9_0
  libwebp            pkgs/main/win-64::libwebp-1.3.2-hbc33d0d_0
  libwebp-base       pkgs/main/win-64::libwebp-base-1.3.2-h3d04722_1
  lz4-c              pkgs/main/win-64::lz4-c-1.9.4-h2bbff1b_1
  markupsafe         pkgs/main/win-64::markupsafe-2.1.3-py310h2bbff1b_0
  mkl                pkgs/main/win-64::mkl-2023.1.0-h6b88ed4_46358
  mkl-service        pkgs/main/win-64::mkl-service-2.4.0-py310h2bbff1b_1
  mkl_fft            pkgs/main/win-64::mkl_fft-1.3.10-py310h827c3e9_0
  mkl_random         pkgs/main/win-64::mkl_random-1.2.7-py310hc64d2fc_0
  mpc                pkgs/main/win-64::mpc-1.1.0-h7edee0f_1
  mpfr               pkgs/main/win-64::mpfr-4.0.2-h62dcd97_1
  mpir               pkgs/main/win-64::mpir-3.0.0-hec2e145_1
  mpmath             pkgs/main/win-64::mpmath-1.3.0-py310haa95532_0
  networkx           pkgs/main/win-64::networkx-3.2.1-py310haa95532_0
  numpy              pkgs/main/win-64::numpy-2.0.1-py310h055cbcc_1
  numpy-base         pkgs/main/win-64::numpy-base-2.0.1-py310h65a83cf_1
  openjpeg           pkgs/main/win-64::openjpeg-2.5.2-hae555c5_0
  pillow             pkgs/main/win-64::pillow-10.4.0-py310h827c3e9_0
  pysocks            pkgs/main/win-64::pysocks-1.7.1-py310haa95532_0
  pytorch            pytorch/win-64::pytorch-2.5.0-py3.10_cuda11.8_cudnn9_0
  pytorch-cuda       pytorch/win-64::pytorch-cuda-11.8-h24eeafa_6
  pytorch-mutex      pytorch/noarch::pytorch-mutex-1.0-cuda
  pyyaml             pkgs/main/win-64::pyyaml-6.0.2-py310h827c3e9_0
  requests           pkgs/main/win-64::requests-2.32.3-py310haa95532_0
  sympy              pkgs/main/win-64::sympy-1.13.2-py310haa95532_0
  tbb                pkgs/main/win-64::tbb-2021.8.0-h59b6b97_0
  torchaudio         pytorch/win-64::torchaudio-2.5.0-py310_cu118
  torchvision        pytorch/win-64::torchvision-0.20.0-py310_cu118
  typing_extensions  pkgs/main/win-64::typing_extensions-4.11.0-py310haa95532_0
  urllib3            pkgs/main/win-64::urllib3-2.2.3-py310haa95532_0
  win_inet_pton      pkgs/main/win-64::win_inet_pton-1.1.0-py310haa95532_0
  yaml               pkgs/main/win-64::yaml-0.2.5-he774522_0
  zstd               pkgs/main/win-64::zstd-1.5.6-h8880b57_0

Proceed ([y]/n)? y

Downloading and Extracting Packages:

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

(G:\Environments\Anaconda\new_apex_env) G:\Environments\Anaconda\apex>conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
Channels:
 - pytorch
 - nvidia
 - defaults
Platform: win-64
Collecting package metadata (repodata.json): done
Solving environment: done

# All requested packages already installed.

(G:\Environments\Anaconda\new_apex_env) G:\Environments\Anaconda\apex>pip install -v --no-cache-dir --config-settings cpp_ext=True --config-settings cuda_ext=True .
Using pip 24.2 from G:\Environments\Anaconda\new_apex_env\lib\site-packages\pip (python 3.10)
Processing g:\environments\anaconda\apex
  Running command pip subprocess to install build dependencies
  Using pip 24.2 from G:\Environments\Anaconda\new_apex_env\Lib\site-packages\pip (python 3.10)
  Collecting setuptools
    Obtaining dependency information for setuptools from https://files.pythonhosted.org/packages/31/2d/90165d51ecd38f9a02c6832198c13a4e48652485e2ccf863ebb942c531b6/setuptools-75.2.0-py3-none-any.whl.metadata
    Using cached setuptools-75.2.0-py3-none-any.whl.metadata (6.9 kB)
  Collecting wheel
    Obtaining dependency information for wheel from https://files.pythonhosted.org/packages/1b/d1/9babe2ccaecff775992753d8686970b1e2755d21c8a63be73aba7a4e7d77/wheel-0.44.0-py3-none-any.whl.metadata
    Using cached wheel-0.44.0-py3-none-any.whl.metadata (2.3 kB)
  Using cached setuptools-75.2.0-py3-none-any.whl (1.2 MB)
  Using cached wheel-0.44.0-py3-none-any.whl (67 kB)
  Installing collected packages: wheel, setuptools
    Creating G:\Temp\pip-build-env-55wtm95g\overlay\Scripts
  Successfully installed setuptools-75.2.0 wheel-0.44.0
  Installing build dependencies ... done
  Running command Getting requirements to build wheel
  Traceback (most recent call last):
    File "G:\Environments\Anaconda\new_apex_env\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
      main()
    File "G:\Environments\Anaconda\new_apex_env\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 "G:\Environments\Anaconda\new_apex_env\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
    File "G:\Temp\pip-build-env-55wtm95g\overlay\Lib\site-packages\setuptools\build_meta.py", line 332, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=[])
    File "G:\Temp\pip-build-env-55wtm95g\overlay\Lib\site-packages\setuptools\build_meta.py", line 302, in _get_build_requires
      self.run_setup()
    File "G:\Temp\pip-build-env-55wtm95g\overlay\Lib\site-packages\setuptools\build_meta.py", line 318, in run_setup
      exec(code, locals())
    File "<string>", line 10, in <module>
  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: 'G:\Environments\Anaconda\new_apex_env\python.exe' 'G:\Environments\Anaconda\new_apex_env\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py' get_requires_for_build_wheel 'G:\Temp\tmprzdb5cj1'
  cwd: G:\Environments\Anaconda\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.

(G:\Environments\Anaconda\new_apex_env) G:\Environments\Anaconda\apex>python setup.py install --cpp_ext --cuda_ext
Traceback (most recent call last):
  File "G:\Environments\Anaconda\apex\setup.py", line 5, in <module>
    from packaging.version import parse, Version
ModuleNotFoundError: No module named 'packaging'

(G:\Environments\Anaconda\new_apex_env) G:\Environments\Anaconda\apex>
SkybuckFlying commented 1 month ago

Maybe damn python issue, not sure:

(G:\Environments\Anaconda\new_apex_env) G:\Environments\Anaconda\apex>which python
'which' is not recognized as an internal or external command,
operable program or batch file.

(G:\Environments\Anaconda\new_apex_env) G:\Environments\Anaconda\apex>where python
G:\Environments\Anaconda\new_apex_env\python.exe
C:\Python312\python.exe
C:\Users\skybu\AppData\Local\Microsoft\WindowsApps\python.exe

(G:\Environments\Anaconda\new_apex_env) G:\Environments\Anaconda\apex>python --version
Python 3.10.15

(G:\Environments\Anaconda\new_apex_env) G:\Environments\Anaconda\apex>
SkybuckFlying commented 1 month ago

Still problem:


(G:\Environments\Anaconda\new_apex_env) G:\Environments\Anaconda\apex>pip install torch torchvision torchaudio
Requirement already satisfied: torch in g:\environments\anaconda\new_apex_env\lib\site-packages (2.5.0)
Requirement already satisfied: torchvision in g:\environments\anaconda\new_apex_env\lib\site-packages (0.20.0)
Requirement already satisfied: torchaudio in g:\environments\anaconda\new_apex_env\lib\site-packages (2.5.0)
Requirement already satisfied: filelock in g:\environments\anaconda\new_apex_env\lib\site-packages (from torch) (3.13.1)
Requirement already satisfied: typing-extensions>=4.8.0 in g:\environments\anaconda\new_apex_env\lib\site-packages (from torch) (4.11.0)
Requirement already satisfied: networkx in g:\environments\anaconda\new_apex_env\lib\site-packages (from torch) (3.2.1)
Requirement already satisfied: jinja2 in g:\environments\anaconda\new_apex_env\lib\site-packages (from torch) (3.1.4)
Collecting fsspec (from torch)
  Using cached fsspec-2024.10.0-py3-none-any.whl.metadata (11 kB)
Collecting sympy==1.13.1 (from torch)
  Using cached sympy-1.13.1-py3-none-any.whl.metadata (12 kB)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in g:\environments\anaconda\new_apex_env\lib\site-packages (from sympy==1.13.1->torch) (1.3.0)
Requirement already satisfied: numpy in g:\environments\anaconda\new_apex_env\lib\site-packages (from torchvision) (2.0.1)
Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in g:\environments\anaconda\new_apex_env\lib\site-packages (from torchvision) (10.4.0)
Requirement already satisfied: MarkupSafe>=2.0 in g:\environments\anaconda\new_apex_env\lib\site-packages (from jinja2->torch) (2.1.3)
Using cached sympy-1.13.1-py3-none-any.whl (6.2 MB)
Using cached fsspec-2024.10.0-py3-none-any.whl (179 kB)
Installing collected packages: sympy, fsspec
  Attempting uninstall: sympy
    Found existing installation: sympy 1.13.2
    Uninstalling sympy-1.13.2:
      Successfully uninstalled sympy-1.13.2
Successfully installed fsspec-2024.10.0 sympy-1.13.1

(G:\Environments\Anaconda\new_apex_env) G:\Environments\Anaconda\apex>pip install apex
Collecting apex
  Using cached apex-0.9.10dev.tar.gz (36 kB)
  Preparing metadata (setup.py) ... done
Collecting cryptacular (from apex)
  Using cached cryptacular-1.6.2.tar.gz (75 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 2
  ╰─> [4 lines of output]
      scons: Reading SConscript files ...
      ModuleNotFoundError: No module named 'distutils.msvccompiler':
        File "G:\Temp\pip-install-vb6gme48\cryptacular_16f39a4b1448414bb0ae255f7334ebba\SConstruct", line 21:
          import distutils.msvccompiler
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
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.

(G:\Environments\Anaconda\new_apex_env) G:\Environments\Anaconda\apex>
SkybuckFlying commented 1 month ago

Still fails, hmm:


(G:\Environments\Anaconda\new_apex_env) G:\Environments\Anaconda\apex>pip install setuptools_scm
Collecting setuptools_scm
  Using cached setuptools_scm-8.1.0-py3-none-any.whl.metadata (6.6 kB)
Collecting packaging>=20 (from setuptools_scm)
  Using cached packaging-24.1-py3-none-any.whl.metadata (3.2 kB)
Requirement already satisfied: setuptools in g:\environments\anaconda\new_apex_env\lib\site-packages (from setuptools_scm) (75.1.0)
Collecting tomli>=1 (from setuptools_scm)
  Using cached tomli-2.0.2-py3-none-any.whl.metadata (10.0 kB)
Using cached setuptools_scm-8.1.0-py3-none-any.whl (43 kB)
Using cached packaging-24.1-py3-none-any.whl (53 kB)
Using cached tomli-2.0.2-py3-none-any.whl (13 kB)
Installing collected packages: tomli, packaging, setuptools_scm
Successfully installed packaging-24.1 setuptools_scm-8.1.0 tomli-2.0.2

(G:\Environments\Anaconda\new_apex_env) G:\Environments\Anaconda\apex>pip install setuptools==58.1.0
Collecting setuptools==58.1.0
  Using cached setuptools-58.1.0-py3-none-any.whl.metadata (4.9 kB)
Using cached setuptools-58.1.0-py3-none-any.whl (816 kB)
Installing collected packages: setuptools
  Attempting uninstall: setuptools
    Found existing installation: setuptools 75.1.0
    Uninstalling setuptools-75.1.0:
      Successfully uninstalled setuptools-75.1.0
Successfully installed setuptools-58.1.0

(G:\Environments\Anaconda\new_apex_env) G:\Environments\Anaconda\apex>conda create --name apex_env_python310 python=3.10

Channels:
 - defaults
Platform: win-64
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: G:\Environments\Anaconda\apex_env_python310

  added / updated specs:
    - python=3.10

The following NEW packages will be INSTALLED:

  bzip2              pkgs/main/win-64::bzip2-1.0.8-h2bbff1b_6
  ca-certificates    pkgs/main/win-64::ca-certificates-2024.9.24-haa95532_0
  libffi             pkgs/main/win-64::libffi-3.4.4-hd77b12b_1
  openssl            pkgs/main/win-64::openssl-3.0.15-h827c3e9_0
  pip                pkgs/main/win-64::pip-24.2-py310haa95532_0
  python             pkgs/main/win-64::python-3.10.15-h4607a30_1
  setuptools         pkgs/main/win-64::setuptools-75.1.0-py310haa95532_0
  sqlite             pkgs/main/win-64::sqlite-3.45.3-h2bbff1b_0
  tk                 pkgs/main/win-64::tk-8.6.14-h0416ee5_0
  tzdata             pkgs/main/noarch::tzdata-2024b-h04d1e81_0
  vc                 pkgs/main/win-64::vc-14.40-h2eaa2aa_1
  vs2015_runtime     pkgs/main/win-64::vs2015_runtime-14.40.33807-h98bb1dd_1
  wheel              pkgs/main/win-64::wheel-0.44.0-py310haa95532_0
  xz                 pkgs/main/win-64::xz-5.4.6-h8cc25b3_1
  zlib               pkgs/main/win-64::zlib-1.2.13-h8cc25b3_1

Proceed ([y]/n)? y

Downloading and Extracting Packages:

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate apex_env_python310
#
# To deactivate an active environment, use
#
#     $ conda deactivate

(G:\Environments\Anaconda\new_apex_env) G:\Environments\Anaconda\apex>conda activate apex_env_python310

(G:\Environments\Anaconda\apex_env_python310) G:\Environments\Anaconda\apex>pip install torch torchvision torchaudio
Collecting torch
  Downloading torch-2.5.0-cp310-cp310-win_amd64.whl.metadata (28 kB)
Collecting torchvision
  Downloading torchvision-0.20.0-cp310-cp310-win_amd64.whl.metadata (6.2 kB)
Collecting torchaudio
  Downloading torchaudio-2.5.0-cp310-cp310-win_amd64.whl.metadata (6.5 kB)
Collecting filelock (from torch)
  Using cached filelock-3.16.1-py3-none-any.whl.metadata (2.9 kB)
Collecting typing-extensions>=4.8.0 (from torch)
  Using cached typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB)
Collecting networkx (from torch)
  Downloading networkx-3.4.2-py3-none-any.whl.metadata (6.3 kB)
Collecting jinja2 (from torch)
  Using cached jinja2-3.1.4-py3-none-any.whl.metadata (2.6 kB)
Collecting fsspec (from torch)
  Using cached fsspec-2024.10.0-py3-none-any.whl.metadata (11 kB)
Collecting sympy==1.13.1 (from torch)
  Using cached sympy-1.13.1-py3-none-any.whl.metadata (12 kB)
Collecting mpmath<1.4,>=1.1.0 (from sympy==1.13.1->torch)
  Using cached mpmath-1.3.0-py3-none-any.whl.metadata (8.6 kB)
Collecting numpy (from torchvision)
  Downloading numpy-2.1.2-cp310-cp310-win_amd64.whl.metadata (59 kB)
Collecting pillow!=8.3.*,>=5.3.0 (from torchvision)
  Downloading pillow-11.0.0-cp310-cp310-win_amd64.whl.metadata (9.3 kB)
Collecting MarkupSafe>=2.0 (from jinja2->torch)
  Downloading MarkupSafe-3.0.2-cp310-cp310-win_amd64.whl.metadata (4.1 kB)
Downloading torch-2.5.0-cp310-cp310-win_amd64.whl (203.1 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 203.1/203.1 MB 19.4 MB/s eta 0:00:00
Using cached sympy-1.13.1-py3-none-any.whl (6.2 MB)
Downloading torchvision-0.20.0-cp310-cp310-win_amd64.whl (1.6 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 28.4 MB/s eta 0:00:00
Downloading torchaudio-2.5.0-cp310-cp310-win_amd64.whl (2.4 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.4/2.4 MB 23.4 MB/s eta 0:00:00
Downloading pillow-11.0.0-cp310-cp310-win_amd64.whl (2.6 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.6/2.6 MB 24.8 MB/s eta 0:00:00
Using cached typing_extensions-4.12.2-py3-none-any.whl (37 kB)
Using cached filelock-3.16.1-py3-none-any.whl (16 kB)
Using cached fsspec-2024.10.0-py3-none-any.whl (179 kB)
Using cached jinja2-3.1.4-py3-none-any.whl (133 kB)
Downloading networkx-3.4.2-py3-none-any.whl (1.7 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.7/1.7 MB 23.6 MB/s eta 0:00:00
Downloading numpy-2.1.2-cp310-cp310-win_amd64.whl (12.9 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.9/12.9 MB 24.4 MB/s eta 0:00:00
Downloading MarkupSafe-3.0.2-cp310-cp310-win_amd64.whl (15 kB)
Using cached mpmath-1.3.0-py3-none-any.whl (536 kB)
Installing collected packages: mpmath, typing-extensions, sympy, pillow, numpy, networkx, MarkupSafe, fsspec, filelock, jinja2, torch, torchvision, torchaudio
Successfully installed MarkupSafe-3.0.2 filelock-3.16.1 fsspec-2024.10.0 jinja2-3.1.4 mpmath-1.3.0 networkx-3.4.2 numpy-2.1.2 pillow-11.0.0 sympy-1.13.1 torch-2.5.0 torchaudio-2.5.0 torchvision-0.20.0 typing-extensions-4.12.2

(G:\Environments\Anaconda\apex_env_python310) G:\Environments\Anaconda\apex>pip install apex
Collecting apex
  Using cached apex-0.9.10dev.tar.gz (36 kB)
  Preparing metadata (setup.py) ... done
Collecting cryptacular (from apex)
  Using cached cryptacular-1.6.2.tar.gz (75 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 2
  ╰─> [4 lines of output]
      scons: Reading SConscript files ...
      ModuleNotFoundError: No module named 'distutils.msvccompiler':
        File "G:\Temp\pip-install-ui2_rf5d\cryptacular_ace7e2f9953b4245888e7ac64c1e205b\SConstruct", line 21:
          import distutils.msvccompiler
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
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.

(G:\Environments\Anaconda\apex_env_python310) G:\Environments\Anaconda\apex>
SkybuckFlying commented 1 month ago

Big fail as usual with python, it's such a crap, switch to Delphi:

(G:\Environments\Anaconda\apex_env_python310) G:\Environments\Anaconda\apex>pip install setuptools
Requirement already satisfied: setuptools in g:\environments\anaconda\apex_env_python310\lib\site-packages (75.1.0)

(G:\Environments\Anaconda\apex_env_python310) G:\Environments\Anaconda\apex>pip install --upgrade setuptools
Requirement already satisfied: setuptools in g:\environments\anaconda\apex_env_python310\lib\site-packages (75.1.0)
Collecting setuptools
  Using cached setuptools-75.2.0-py3-none-any.whl.metadata (6.9 kB)
Using cached setuptools-75.2.0-py3-none-any.whl (1.2 MB)
Installing collected packages: setuptools
  Attempting uninstall: setuptools
    Found existing installation: setuptools 75.1.0
    Uninstalling setuptools-75.1.0:
      Successfully uninstalled setuptools-75.1.0
Successfully installed setuptools-75.2.0

(G:\Environments\Anaconda\apex_env_python310) G:\Environments\Anaconda\apex>pip install build
Collecting build
  Downloading build-1.2.2.post1-py3-none-any.whl.metadata (6.5 kB)
Collecting packaging>=19.1 (from build)
  Using cached packaging-24.1-py3-none-any.whl.metadata (3.2 kB)
Collecting pyproject_hooks (from build)
  Using cached pyproject_hooks-1.2.0-py3-none-any.whl.metadata (1.3 kB)
Collecting colorama (from build)
  Using cached colorama-0.4.6-py2.py3-none-any.whl.metadata (17 kB)
Collecting tomli>=1.1.0 (from build)
  Using cached tomli-2.0.2-py3-none-any.whl.metadata (10.0 kB)
Downloading build-1.2.2.post1-py3-none-any.whl (22 kB)
Using cached packaging-24.1-py3-none-any.whl (53 kB)
Using cached tomli-2.0.2-py3-none-any.whl (13 kB)
Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Using cached pyproject_hooks-1.2.0-py3-none-any.whl (10 kB)
Installing collected packages: tomli, pyproject_hooks, packaging, colorama, build
Successfully installed build-1.2.2.post1 colorama-0.4.6 packaging-24.1 pyproject_hooks-1.2.0 tomli-2.0.2

(G:\Environments\Anaconda\apex_env_python310) G:\Environments\Anaconda\apex>pip install apex
Collecting apex
  Using cached apex-0.9.10dev.tar.gz (36 kB)
  Preparing metadata (setup.py) ... done
Collecting cryptacular (from apex)
  Using cached cryptacular-1.6.2.tar.gz (75 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 2
  ╰─> [4 lines of output]
      scons: Reading SConscript files ...
      ModuleNotFoundError: No module named 'distutils.msvccompiler':
        File "G:\Temp\pip-install-7nw06udy\cryptacular_3f753125825d42009179e7abebbdd872\SConstruct", line 21:
          import distutils.msvccompiler
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
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.

(G:\Environments\Anaconda\apex_env_python310) G:\Environments\Anaconda\apex>python setup.py install --cpp_ext --cuda_ext

Warning: Torch did not find available GPUs on this system.
 If your intention is to cross-compile, this is not an error.
By default, Apex will cross-compile for Pascal (compute capabilities 6.0, 6.1, 6.2),
Volta (compute capability 7.0), Turing (compute capability 7.5),
and, if the CUDA version is >= 11.0, Ampere (compute capability 8.0).
If you wish to cross-compile for a single specific architecture,
export TORCH_CUDA_ARCH_LIST="compute capability" before running setup.py.

torch.__version__  = 2.5.0+cpu

Traceback (most recent call last):
  File "G:\Environments\Anaconda\apex\setup.py", line 137, in <module>
    _, bare_metal_version = get_cuda_bare_metal_version(CUDA_HOME)
  File "G:\Environments\Anaconda\apex\setup.py", line 24, in get_cuda_bare_metal_version
    raw_output = subprocess.check_output([cuda_dir + "/bin/nvcc", "-V"], universal_newlines=True)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

(G:\Environments\Anaconda\apex_env_python310) G:\Environments\Anaconda\apex>set PATH=%CUDA_HOME%\bin;%PATH%

(G:\Environments\Anaconda\apex_env_python310) G:\Environments\Anaconda\apex>python setup.py install --cpp_ext --cuda_ext

Warning: Torch did not find available GPUs on this system.
 If your intention is to cross-compile, this is not an error.
By default, Apex will cross-compile for Pascal (compute capabilities 6.0, 6.1, 6.2),
Volta (compute capability 7.0), Turing (compute capability 7.5),
and, if the CUDA version is >= 11.0, Ampere (compute capability 8.0).
If you wish to cross-compile for a single specific architecture,
export TORCH_CUDA_ARCH_LIST="compute capability" before running setup.py.

torch.__version__  = 2.5.0+cpu

Traceback (most recent call last):
  File "G:\Environments\Anaconda\apex\setup.py", line 137, in <module>
    _, bare_metal_version = get_cuda_bare_metal_version(CUDA_HOME)
  File "G:\Environments\Anaconda\apex\setup.py", line 24, in get_cuda_bare_metal_version
    raw_output = subprocess.check_output([cuda_dir + "/bin/nvcc", "-V"], universal_newlines=True)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

(G:\Environments\Anaconda\apex_env_python310) G:\Environments\Anaconda\apex>echo %CUDA_HOME%
G:\Tools\CUDA\version12.6

(G:\Environments\Anaconda\apex_env_python310) G:\Environments\Anaconda\apex>python setup.py install --cpp_ext --cuda_ext

Python crap never works on windows, bye for now.

coder109 commented 3 weeks ago

I don't know if you have used the proper command. Please read README.md carefully. The proper way to compile and install apex is:

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

or, for Windows:

pip install -v --no-cache-dir .

Please do not use something like:

pip install .

If you use the command given in README.md, there should be no errors.

Also, this project may not be able to be compiled successfully on Windows. If possible, please use Linux.

AlongWY commented 1 week ago

try this one 试试这个?apex wheels

zslefour commented 1 week ago

try this one 试试这个?apex wheels

能提供windows版本的apex wheel吗?谢谢

zslefour commented 1 week ago

I don't know if you have used the proper command. Please read README.md carefully. The proper way to compile and install apex is:

pip install -v --disable-pip-version-check --no-build-isolation --no-cache-dir ./ or, for Windows:

pip install -v --no-cache-dir . Please do not use something like:

pip install . If you use the command given in README.md, there should be no errors.

Also, this project may not be able to be compiled successfully on Windows. If possible, please use Linux.

Thanks, for Windows, I successful build and install, but whl file is delete, i want get the file, how can i do ? Even if I cancel the option --no-cache-dir pip install -v .

Created wheel for apex: filename=apex-0.1-py3-none-any.whl size=406607 sha256=5587683c54f3379a0000de5331a711ddeea05d17ea780ba2a70ac9ebe425d30a Stored in directory: C:\Users\Monday\AppData\Local\Temp\pip-ephem-wheel-cache-27vgmaxu\wheels\65\c7\12\b7e49ba4abd3da74df298dc51ea0f6a086d496566f4310f620