diff --git a/docs/linux_install_full.sh b/docs/linux_install_full.sh index d1d84ba69..f315c9940 100644 --- a/docs/linux_install_full.sh +++ b/docs/linux_install_full.sh @@ -23,25 +23,19 @@ if ! command -v conda &> /dev/null; then echo "Conda not found, installing Miniconda." wget https://repo.anaconda.com/miniconda/Miniconda3-py310_23.1.0-1-Linux-x86_64.sh bash ./Miniconda3-py310_23.1.0-1-Linux-x86_64.sh -b -u - source ~/miniconda3/bin/activate - conda init bash - conda deactivate else echo "Conda is already installed." - source ~/miniconda3/bin/activate - conda init bash - conda deactivate fi -if [ "$CONDA_DEFAULT_ENV" = "h2ogpt" ]; then - echo "Deactivating the h2ogpt Conda environment." - conda deactivate -else - echo "The h2ogpt Conda environment is not currently activated." -fi +# if there no session created or instanced, it will be +source ~/miniconda3/bin/activate +conda init bash +# it does not matter where it is, it will be utterly deactivate. +while [ $CONDA_SHLVL -gt 0 ]; do conda deactivate; done +# Now we can stay on base conda session echo "Installing fresh h2oGPT env." -if conda env list | grep -q 'h2ogpt'; then +if conda env list | grep -w 'h2ogpt'; then conda remove -n h2ogpt --all -y else echo "h2ogpt environment does not exist." @@ -51,11 +45,31 @@ conda create -n h2ogpt -y conda activate h2ogpt conda install python=3.10 -c conda-forge -y +if ! command -v nvcc &> /dev/null; then + echo -e "\n\n\tThere is no NVIDIA CUDA Compiler Driver NVCC installed\n\n" + exit 1 +fi +nvccVersion=$(nvcc --version | grep -i release | sed -e 's/^.*release *\(\([[:digit:]]\|\.\)\+\).*$/\1/i') +if [ ! "$nvccVersion" == "12.1" ] && [ ! "$nvccVersion" == "11.8" ]; then + echo -e "\n\n\tWARNING - There can be problems if you do not have installed NVIDIA CUDA Compiler Driver NVCC like 12.1 or 11.8" + echo -e "\tYour current version is: ${nvccVersion}" + echo -en "\t"; read -r -p "Are you sure to continue [y|Y]: " response < /dev/tty + if [ ! "${response^^}" == "Y" ]; then + echo -e "\n\n\tExit without installing\n\n" + exit 1 + fi +fi + export CUDA_HOME=/usr/local/cuda-12.1 export PIP_EXTRA_INDEX_URL="https://download.pytorch.org/whl/cu121" export LLAMA_CUBLAS=1 export CMAKE_ARGS="-DLLAMA_CUBLAS=on -DCMAKE_CUDA_ARCHITECTURES=all" export FORCE_CMAKE=1 +# Overwriting in case of CUDA 11.8 +if [ "${nvccVersion}" == "11.8" ]; then + export CUDA_HOME=/usr/local/cuda-11.8 + export PIP_EXTRA_INDEX_URL="https://download.pytorch.org/whl/cu118 https://huggingface.github.io/autogptq-index/whl/cu118" +fi echo "Installing fresh h2oGPT" set +x