[GH-ISSUE #17] Flash Attention Installation error #9

Open
opened 2026-10-26 21:06:31 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @pdx97 on GitHub (Mar 20, 2025).
Original GitHub issue: https://github.com/deepseek-ai/DeepSeek-Prover-V1.5/issues/17

I am running the pip requirements.txt and it throws an error while installing the flash attention.

`Collecting flash-attn
Using cached flash_attn-2.7.4.post1.tar.gz (6.0 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [45 lines of output]

  A module that was compiled using NumPy 1.x cannot be run in
  NumPy 2.2.4 as it may crash. To support both 1.x and 2.x
  versions of NumPy, modules must be compiled with NumPy 2.0.
  Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
  
  If you are a user of the module, the easiest solution will be to
  downgrade to 'numpy<2' or try to upgrade the affected module.
  We expect that some modules will need time to support NumPy 2.
  
  Traceback (most recent call last):  File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "/tmp/pip-install-q6uv6vlg/flash-attn_4405380fa9914660a01501eff3eabefc/setup.py", line 22, in <module>
      import torch
    File "/home/pdx/anaconda3/envs/DeepseekProver/lib/python3.10/site-packages/torch/__init__.py", line 1477, in <module>
      from .functional import *  # noqa: F403
    File "/home/pdx/anaconda3/envs/DeepseekProver/lib/python3.10/site-packages/torch/functional.py", line 9, in <module>
      import torch.nn.functional as F
    File "/home/pdx/anaconda3/envs/DeepseekProver/lib/python3.10/site-packages/torch/nn/__init__.py", line 1, in <module>
      from .modules import *  # noqa: F403
    File "/home/pdx/anaconda3/envs/DeepseekProver/lib/python3.10/site-packages/torch/nn/modules/__init__.py", line 35, in <module>
      from .transformer import TransformerEncoder, TransformerDecoder, \
    File "/home/pdx/anaconda3/envs/DeepseekProver/lib/python3.10/site-packages/torch/nn/modules/transformer.py", line 20, in <module>
      device: torch.device = torch.device(torch._C._get_default_device()),  # torch.device('cpu'),
  /home/pdx/anaconda3/envs/DeepseekProver/lib/python3.10/site-packages/torch/nn/modules/transformer.py:20: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at ../torch/csrc/utils/tensor_numpy.cpp:84.)
    device: torch.device = torch.device(torch._C._get_default_device()),  # torch.device('cpu'),
  /tmp/pip-install-q6uv6vlg/flash-attn_4405380fa9914660a01501eff3eabefc/setup.py:106: UserWarning: flash_attn was requested, but nvcc was not found.  Are you sure your environment has nvcc available?  If you're installing within a container from https://hub.docker.com/r/pytorch/pytorch, only images whose names contain 'devel' will provide nvcc.
    warnings.warn(
  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "/tmp/pip-install-q6uv6vlg/flash-attn_4405380fa9914660a01501eff3eabefc/setup.py", line 198, in <module>
      CUDAExtension(
    File "/home/pdx/anaconda3/envs/DeepseekProver/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1074, in CUDAExtension
      library_dirs += library_paths(cuda=True)
    File "/home/pdx/anaconda3/envs/DeepseekProver/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1201, in library_paths
      if (not os.path.exists(_join_cuda_home(lib_dir)) and
    File "/home/pdx/anaconda3/envs/DeepseekProver/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2407, in _join_cuda_home
      raise OSError('CUDA_HOME environment variable is not set. '
  OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.
  
  
  torch.__version__  = 2.2.1+cu121
  
  
  [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.
`

Originally created by @pdx97 on GitHub (Mar 20, 2025). Original GitHub issue: https://github.com/deepseek-ai/DeepSeek-Prover-V1.5/issues/17 I am running the pip requirements.txt and it throws an error while installing the flash attention. `Collecting flash-attn Using cached flash_attn-2.7.4.post1.tar.gz (6.0 MB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [45 lines of output] A module that was compiled using NumPy 1.x cannot be run in NumPy 2.2.4 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0. Some module may need to rebuild instead e.g. with 'pybind11>=2.12'. If you are a user of the module, the easiest solution will be to downgrade to 'numpy<2' or try to upgrade the affected module. We expect that some modules will need time to support NumPy 2. Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 34, in <module> File "/tmp/pip-install-q6uv6vlg/flash-attn_4405380fa9914660a01501eff3eabefc/setup.py", line 22, in <module> import torch File "/home/pdx/anaconda3/envs/DeepseekProver/lib/python3.10/site-packages/torch/__init__.py", line 1477, in <module> from .functional import * # noqa: F403 File "/home/pdx/anaconda3/envs/DeepseekProver/lib/python3.10/site-packages/torch/functional.py", line 9, in <module> import torch.nn.functional as F File "/home/pdx/anaconda3/envs/DeepseekProver/lib/python3.10/site-packages/torch/nn/__init__.py", line 1, in <module> from .modules import * # noqa: F403 File "/home/pdx/anaconda3/envs/DeepseekProver/lib/python3.10/site-packages/torch/nn/modules/__init__.py", line 35, in <module> from .transformer import TransformerEncoder, TransformerDecoder, \ File "/home/pdx/anaconda3/envs/DeepseekProver/lib/python3.10/site-packages/torch/nn/modules/transformer.py", line 20, in <module> device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'), /home/pdx/anaconda3/envs/DeepseekProver/lib/python3.10/site-packages/torch/nn/modules/transformer.py:20: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at ../torch/csrc/utils/tensor_numpy.cpp:84.) device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'), /tmp/pip-install-q6uv6vlg/flash-attn_4405380fa9914660a01501eff3eabefc/setup.py:106: UserWarning: flash_attn was requested, but nvcc was not found. Are you sure your environment has nvcc available? If you're installing within a container from https://hub.docker.com/r/pytorch/pytorch, only images whose names contain 'devel' will provide nvcc. warnings.warn( Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 34, in <module> File "/tmp/pip-install-q6uv6vlg/flash-attn_4405380fa9914660a01501eff3eabefc/setup.py", line 198, in <module> CUDAExtension( File "/home/pdx/anaconda3/envs/DeepseekProver/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1074, in CUDAExtension library_dirs += library_paths(cuda=True) File "/home/pdx/anaconda3/envs/DeepseekProver/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1201, in library_paths if (not os.path.exists(_join_cuda_home(lib_dir)) and File "/home/pdx/anaconda3/envs/DeepseekProver/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2407, in _join_cuda_home raise OSError('CUDA_HOME environment variable is not set. ' OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root. torch.__version__ = 2.2.1+cu121 [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. `
Author
Owner

@AtharvRN commented on GitHub (Aug 18, 2025):

@pdx97 I faced the same issue. You can try installing torch first and then run pip -r requirements.txt

<!-- gh-comment-id:3196662628 --> @AtharvRN commented on GitHub (Aug 18, 2025): @pdx97 I faced the same issue. You can try installing torch first and then run pip -r requirements.txt
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/DeepSeek-Prover-V1.5#9
No description provided.