Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -45,15 +45,40 @@ if process.returncode == 0:
|
|
| 45 |
else:
|
| 46 |
print("Houve um erro na execução do comando:", process.stderr)
|
| 47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
source_path = '/usr/local/lib/python3.10/site-packages/nvidia/cublas/lib/libcublasLt.so.12'
|
| 49 |
destination_path = '/usr/local/lib/python3.10/site-packages/nvidia/cudnn/lib/'
|
| 50 |
command = ['mv', source_path, destination_path]
|
| 51 |
subprocess.run(command, check=True)
|
| 52 |
|
| 53 |
-
|
| 54 |
-
subprocess.run(command, check=True)
|
| 55 |
|
| 56 |
-
command = ['mv', "/usr/local/lib/python3.10/site-packages/nvidia/cublas/lib/
|
| 57 |
subprocess.run(command, check=True)
|
| 58 |
|
| 59 |
command = ['mv', "/usr/local/lib/python3.10/site-packages/nvidia/cufft/lib/libcufft.so.11", destination_path]
|
|
|
|
| 45 |
else:
|
| 46 |
print("Houve um erro na execução do comando:", process.stderr)
|
| 47 |
|
| 48 |
+
|
| 49 |
+
def find_and_move_library(library_name, destination):
|
| 50 |
+
# Search for the library in the entire system
|
| 51 |
+
try:
|
| 52 |
+
command = f"find / -name '{library_name}' 2>/dev/null"
|
| 53 |
+
process = subprocess.run(command, shell=True, text=True, capture_output=True)
|
| 54 |
+
|
| 55 |
+
if process.returncode == 0:
|
| 56 |
+
found_paths = process.stdout.strip().split('\n')
|
| 57 |
+
if found_paths:
|
| 58 |
+
for path in found_paths:
|
| 59 |
+
print(f"Found {library_name} at: {path}")
|
| 60 |
+
# Move the library to the destination
|
| 61 |
+
try:
|
| 62 |
+
subprocess.run(['mv', path, destination], check=True)
|
| 63 |
+
print(f"Moved {library_name} to {destination}")
|
| 64 |
+
break # Exit after moving the first valid match
|
| 65 |
+
except subprocess.CalledProcessError as e:
|
| 66 |
+
print(f"Failed to move {path} to {destination}: {e}")
|
| 67 |
+
else:
|
| 68 |
+
print(f"No {library_name} found.")
|
| 69 |
+
else:
|
| 70 |
+
print("Error during search:", process.stderr)
|
| 71 |
+
except Exception as e:
|
| 72 |
+
print(f"Error finding {library_name}: {e}")
|
| 73 |
+
|
| 74 |
source_path = '/usr/local/lib/python3.10/site-packages/nvidia/cublas/lib/libcublasLt.so.12'
|
| 75 |
destination_path = '/usr/local/lib/python3.10/site-packages/nvidia/cudnn/lib/'
|
| 76 |
command = ['mv', source_path, destination_path]
|
| 77 |
subprocess.run(command, check=True)
|
| 78 |
|
| 79 |
+
find_and_move_library('libnvrtc.so.12', destination_path)
|
|
|
|
| 80 |
|
| 81 |
+
command = ['mv', "/usr/local/lib/python3.10/site-packages/nvidia/cublas/lib/libcublas.so.12", destination_path]
|
| 82 |
subprocess.run(command, check=True)
|
| 83 |
|
| 84 |
command = ['mv', "/usr/local/lib/python3.10/site-packages/nvidia/cufft/lib/libcufft.so.11", destination_path]
|