Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: unsupported operand type(s) for +: 'NoneType' and 'str' #990

Open
KrisWongz opened this issue Nov 9, 2020 · 14 comments
Open

Comments

@KrisWongz
Copy link

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.

Traceback (most recent call last):
File "setup.py", line 35, in
_, bare_metal_major, _ = get_cuda_bare_metal_version(cpp_extension.CUDA_HOME)
File "setup.py", line 14, 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'

@6cigarette
Copy link

I have the same questions.Now do you find the solution?

@Symbolk
Copy link

Symbolk commented Mar 22, 2022

This occurs when you try to install apex on a non-GPU machine.

Run the following command would work like a charm:

cd apex
export TORCH_CUDA_ARCH_LIST="compute capability" 
python3 setup.py install

@BUAADreamer
Copy link

Hello, did you solve this problem? I tried export TORCH_CUDA_ARCH_LIST="compute capability" but it can't work either.

@tzcskys
Copy link

tzcskys commented Nov 15, 2022

Hello, did you solve this problem? I tried export TORCH_CUDA_ARCH_LIST="compute capability" but it can't work either.

Hi, I also met the problem, did you find the solution? thanks

@tzcskys
Copy link

tzcskys commented Nov 15, 2022

Hello, did you solve this problem? I tried export TORCH_CUDA_ARCH_LIST="compute capability" but it can't work either.

Hi, I also met the problem, did you find the solution? thanks

Hi, I found out the problem with my environment is that the cuda installed with conda is not the full version, which means the nvcc is not installed. So use "conda install -c nvidia cuda-nvcc" first and try again, works for me. Put my solution here in case someone meet the same problem.

@BUAADreamer
Copy link

Hello, did you solve this problem? I tried export TORCH_CUDA_ARCH_LIST="compute capability" but it can't work either.

Hi, I also met the problem, did you find the solution? thanks

Hi, I found out the problem with my environment is that the cuda installed with conda is not the full version, which means the nvcc is not installed. So use "conda install -c nvidia cuda-nvcc" first and try again, works for me. Put my solution here in case someone meet the same problem.

Yeah, I find the reason is I didn't install the whole package, I finally use conda env and pip3 install from source

@xywhat
Copy link

xywhat commented Nov 22, 2022

Hello, did you solve this problem? I tried export TORCH_CUDA_ARCH_LIST="compute capability" but it can't work either.

Hi, I also met the problem, did you find the solution? thanks

Hi, I found out the problem with my environment is that the cuda installed with conda is not the full version, which means the nvcc is not installed. So use "conda install -c nvidia cuda-nvcc" first and try again, works for me. Put my solution here in case someone meet the same problem.

Yeah, I find the reason is I didn't install the whole package, I finally use conda env and pip3 install from source

Hello, did you solve this problem? I tried export TORCH_CUDA_ARCH_LIST="compute capability" but it can't work either.

Hi, I also met the problem, did you find the solution? thanks

Hi, I found out the problem with my environment is that the cuda installed with conda is not the full version, which means the nvcc is not installed. So use "conda install -c nvidia cuda-nvcc" first and try again, works for me. Put my solution here in case someone meet the same problem.

you saved me!

@Fanstering
Copy link

Hello, did you solve this problem? I tried export TORCH_CUDA_ARCH_LIST="compute capability" but it can't work either.

Hi, I also met the problem, did you find the solution? thanks

Hi, I found out the problem with my environment is that the cuda installed with conda is not the full version, which means the nvcc is not installed. So use "conda install -c nvidia cuda-nvcc" first and try again, works for me. Put my solution here in case someone meet the same problem.

Thanks, I encountered the same problem, and successfully solved it with your method

@olayinkaajayi
Copy link

Hello, did you solve this problem? I tried export TORCH_CUDA_ARCH_LIST="compute capability" but it can't work either.

Hi, I also met the problem, did you find the solution? thanks

Hi, I found out the problem with my environment is that the cuda installed with conda is not the full version, which means the nvcc is not installed. So use "conda install -c nvidia cuda-nvcc" first and try again, works for me. Put my solution here in case someone meet the same problem.

Thank you so much! This appears to work for me.

@WilliamTambellini
Copy link

python could nt find nvcc. Could need:

PATH=/usr/local/cuda/bin/:$PATH pip ...

@MSaqibShah
Copy link

Got it sorted after trying out different things and digging into the web for answers. Ended up fixing it by installing the whole CUDA toolkit manually from this link. Figured I'd drop it here in case anyone else is pulling their hair out over the same issue. Cheers!

@gndps
Copy link

gndps commented Apr 4, 2024

For some reason the CUDA_HOME is none check is not working leading to this misleading error statement.
It was happening because CUDA_HOME was not found in setup.py
i.e from torch.utils.cpp_extension import CUDA_HOME was None
To solve it, I installed CUDA from here https://developer.nvidia.com/cuda-downloads
Then tried the apex installation command in a new shell

@PussyCat0700
Copy link

Hello, did you solve this problem? I tried export TORCH_CUDA_ARCH_LIST="compute capability" but it can't work either.

Hi, I also met the problem, did you find the solution? thanks

Hi, I found out the problem with my environment is that the cuda installed with conda is not the full version, which means the nvcc is not installed. So use "conda install -c nvidia cuda-nvcc" first and try again, works for me. Put my solution here in case someone meet the same problem.

Hi, How can I specify version of nvcc installed with this command?

@SuperIRabbit
Copy link

In my case running module load cuda/{YOUR_CUDA_VERSION} solves the problem (inspired by the answers above about nvcc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests