flash-attention
flash-attention copied to clipboard
FileNotFoundError: [Errno 2] No such file or directory: ':/usr/local/cuda-11.7/bin/nvcc'
Hi, I am tring to install flash-attention with pip install flash-attn==1.0.4
, I meet the error, No such file or directory: ':/usr/local/cuda-11.7/bin/nvcc'
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting flash-attn==1.0.4
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/25/0f/80f16a741e328342ed4e9b3c010ec87f0ef939a71154b7b8bd22d70a0bb8/flash_attn-1.0.4.tar.gz (2.0 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [21 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-u3qbej0b/flash-attn_5f7ed8b4eb05405eaeb0adf0e4265254/setup.py", line 109, in <module>
_, bare_metal_version = get_cuda_bare_metal_version(CUDA_HOME)
File "/tmp/pip-install-u3qbej0b/flash-attn_5f7ed8b4eb05405eaeb0adf0e4265254/setup.py", line 24, in get_cuda_bare_metal_version
raw_output = subprocess.check_output([cuda_dir + "/bin/nvcc", "-V"], universal_newlines=True)
File "/home/qiaolinlu/miniconda3/envs/scGPT/lib/python3.8/subprocess.py", line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/home/qiaolinlu/miniconda3/envs/scGPT/lib/python3.8/subprocess.py", line 493, in run
with Popen(*popenargs, **kwargs) as process:
File "/home/qiaolinlu/miniconda3/envs/scGPT/lib/python3.8/subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/home/qiaolinlu/miniconda3/envs/scGPT/lib/python3.8/subprocess.py", line 1704, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: ':/usr/local/cuda-11.7/bin/nvcc'
torch.__version__ = 1.13.1+cu117
[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.
before that, I have already installed pytorch 1.13.1+cu117, and nvcc -V
is shown
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Tue_May__3_18:49:52_PDT_2022
Cuda compilation tools, release 11.7, V11.7.64
Build cuda_11.7.r11.7/compiler.31294372_0
Could you please help me to fix it, thanks
Probably CUDA_HOME
or PATH
aren't set properly.
Can you try setting CUDA_HOME
to the right location such that $CUDA_HOME/bin/nvcc
exists?
I not sure if my
CUDA_HOME
is right, if it was wrong, how to set it
You can find the full path of nvcc
(e.g. with which nvcc
) then set CUDA_HOME
properly (e.g. export CUDA_HOME=blah
).
I used which nvcc
, result is /usr/local/cuda-11.7/bin/nvcc
, in .bashrc
file, it was
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.7/lib64
export PATH=$PATH:/usr/local/cuda-11.7/bin
export CUDA_HOME=$CUDA_HOME:/usr/local/cuda-11.7
Then I don't know what's wrong. We recommend the Pytorch container from Nvidia, which has all the required tools to install FlashAttention.
Looks like you set CUDA_HOME
to :/usr/local/cuda-11.7
(extra :
at the beginning that causes the path to be wrong).
Thanks a lot, I will try it.
I have also encountered the same problem. How did you solve it @QiaolinLu
I checked my $CUDA_HOME
, there was an extra :
at the beginning, then I deleted it in the path, everything is fine now!
Looks like you set
CUDA_HOME
to:/usr/local/cuda-11.7
(extra:
at the beginning that causes the path to be wrong).
How NICE!
That works for me since there are too many different CUDA-1X.X on my environment.
"pip install flash-attn --no-build-isolation" worked perfectly after I changed from
export CUDA_HOME=$CUDA_HOME:/path/to/CUDA-11.8
to
export CUDA_HOME=/path/to/CUDA-11.8
The possible reason for this issue could be that the program cannot correctly recognize the environment variable path containing ":".