drewThomasson
commited on
Commit
•
a293829
1
Parent(s):
8b1f286
fixed install bug adding nvidia repo
Browse files
app.py
CHANGED
@@ -34,18 +34,21 @@ def install_cuda_if_gpu_detected():
|
|
34 |
if torch.cuda.is_available():
|
35 |
print("GPU detected! Proceeding with installation...")
|
36 |
try:
|
37 |
-
#
|
|
|
|
|
38 |
subprocess.run(['apt-get', 'update'], check=True)
|
39 |
-
|
40 |
# Install CUDA dependencies
|
41 |
subprocess.run(['apt-get', 'install', '-y', 'libcudnn8', 'libcudnn8-dev'], check=True)
|
42 |
-
|
43 |
print("Installation complete.")
|
44 |
except subprocess.CalledProcessError as e:
|
45 |
print(f"An error occurred during installation: {e}")
|
46 |
else:
|
47 |
print("No GPU detected. Skipping installation.")
|
48 |
|
|
|
49 |
# Run the function
|
50 |
install_cuda_if_gpu_detected()
|
51 |
|
|
|
34 |
if torch.cuda.is_available():
|
35 |
print("GPU detected! Proceeding with installation...")
|
36 |
try:
|
37 |
+
# Add NVIDIA's package repositories
|
38 |
+
subprocess.run(['apt-key', 'adv', '--fetch-keys', 'https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/3bf863cc.pub'], check=True)
|
39 |
+
subprocess.run(['add-apt-repository', 'deb https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/ /'], check=True)
|
40 |
subprocess.run(['apt-get', 'update'], check=True)
|
41 |
+
|
42 |
# Install CUDA dependencies
|
43 |
subprocess.run(['apt-get', 'install', '-y', 'libcudnn8', 'libcudnn8-dev'], check=True)
|
44 |
+
|
45 |
print("Installation complete.")
|
46 |
except subprocess.CalledProcessError as e:
|
47 |
print(f"An error occurred during installation: {e}")
|
48 |
else:
|
49 |
print("No GPU detected. Skipping installation.")
|
50 |
|
51 |
+
|
52 |
# Run the function
|
53 |
install_cuda_if_gpu_detected()
|
54 |
|