Compile pytorch v1.3.0 from source with CUDA9.0

username: PKUFlyingPig
cooked: <p>I want to compile pytorch v1.3.0 from source with specified CUDA version 9.0. However, even I set the CUDA_PATH and CUDA_HOME to /usr/local/cuda-9.0. It always tries to find cuda from the path /usr/local/cuda.<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/8/a/8af4067f3532037eb8b46042a04e551b9a52fec8.png" data-download-href="https://discuss.pytorch.org/uploads/default/8af4067f3532037eb8b46042a04e551b9a52fec8" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/8/a/8af4067f3532037eb8b46042a04e551b9a52fec8_2_690x324.png" alt="image" data-base62-sha1="jPeIckhhXPWwEYipSCtsNXBCuSY" width="690" height="324" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/8/a/8af4067f3532037eb8b46042a04e551b9a52fec8_2_690x324.png, https://discuss.pytorch.org/uploads/default/optimized/3X/8/a/8af4067f3532037eb8b46042a04e551b9a52fec8_2_1035x486.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/8/a/8af4067f3532037eb8b46042a04e551b9a52fec8.png 2x" data-dominant-color="333E44"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">1138×536 58.7 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><br>
I know the easiest way is to change the symbol link to /usr/local/cuda-9.0, but I don’t have the sudo privilege on my server. Is there any other way ?</p>

username: eqy
cooked: <p>This might be tricky, e.g., if tools like <code>nvidia-smi</code> show a newer CUDA version…<br>
You might want to try changing other environment variables like <code>CUDA_BIN_PATH</code> like the cmake docs state: <a href="https://cmake.org/cmake/help/latest/module/FindCUDA.html#documentation-of-deprecated-usage" class="inline-onebox" rel="noopener nofollow ugc">FindCUDA — CMake 3.20.2 Documentation</a></p>

username: ptrblck
cooked: <p>Additionally to the previous suggestion you could also try to set <code>CUDA_HOME</code> to the desired CUDA toolkit installation.</p>

username: PKUFlyingPig
cooked: <p>I tried this, but when I run <code>python setup.py install</code>, it still tries to find cuda in the default folder, i.e. /usr/local/cuda.</p>

username: PKUFlyingPig
cooked: <p>According to your advice, I first run <code>export CUDA_HOME="/usr/local/cuda-9.0"</code>, then I run <code>python setup.py install</code>. But it still yells this:<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/c/0/c05905dc2fb5527d4e9402ef22832153a3028a85.png" data-download-href="https://discuss.pytorch.org/uploads/default/c05905dc2fb5527d4e9402ef22832153a3028a85" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/c/0/c05905dc2fb5527d4e9402ef22832153a3028a85_2_690x412.png" alt="image" data-base62-sha1="rrAp6MBeC1j7RaDlK7V6Rj8qA5L" width="690" height="412" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/c/0/c05905dc2fb5527d4e9402ef22832153a3028a85_2_690x412.png, https://discuss.pytorch.org/uploads/default/optimized/3X/c/0/c05905dc2fb5527d4e9402ef22832153a3028a85_2_1035x618.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/c/0/c05905dc2fb5527d4e9402ef22832153a3028a85.png 2x" data-dominant-color="323E44"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">1334×798 98.6 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>