Error while importing torch

I have an issue while running:

import torch

Below is my Pipfile:

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
streamlit-searchbox = "*"
pytesseract = "*"
pdf2image = "*"
pipenv = "*"
python-dotenv = "*"
openpyxl = "*"
sentence-transformers = "*"
torch = {version = "==2.3.1", index = "https://download.pytorch.org/whl/cpu"}

[dev-packages]
ruff = "*"
pytest = "*"

[requires]
python_version = "3.11"

This is the link to the app:

The error logs are below:

/home/adminuser/venv/lib/python3.11/site-packages/torch/__init__.py:238 in    
  <module>                                                                      
                                                                                
     235 │   #                                                                  
     236 │   # See Note [Global dependencies]                                   
     237 │   if USE_GLOBAL_DEPS:                                                
  ❱  238 │   │   _load_global_deps()                                            
     239 │   from torch._C import *  # noqa: F403                               
     240                                                                        
     241 # Appease the type checker; ordinarily this binding is inserted by th  
                                                                                
  /home/adminuser/venv/lib/python3.11/site-packages/torch/__init__.py:199 in    
  _load_global_deps                                                             
                                                                                
     196 │   │   if not is_cuda_lib_err:                                        
     197 │   │   │   raise err                                                  
     198 │   │   for lib_folder, lib_name in cuda_libs.items():                 
  ❱  199 │   │   │   _preload_cuda_deps(lib_folder, lib_name)                   
     200 │   │   ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)                 
     201                                                                        
     202                                                                        
                                                                                
  /home/adminuser/venv/lib/python3.11/site-packages/torch/__init__.py:164 in    
  _preload_cuda_deps                                                            
                                                                                
     161 │   │   if lib_path:                                                   
     162 │   │   │   break                                                      
     163 │   if not lib_path:                                                   
  ❱  164 │   │   raise ValueError(f"{lib_name} not found in the system path {s  
     165 │   ctypes.CDLL(lib_path)                                              
     166                                                                        
     167                                                                        
────────────────────────────────────────────────────────────────────────────────
ValueError: libcublas.so.*[0-9] not found in the system path 
['src/sonar/app.py', 'src/sonar', '/home/adminuser/venv/bin', 
'/usr/local/lib/python311.zip', '/usr/local/lib/python3.11', 
'/usr/local/lib/python3.11/lib-dynload', 
'/home/adminuser/venv/lib/python3.11/site-packages']
2024-07-01 17:37:02.682 503 GET /script-health-check (127.0.0.1) 108.03ms

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.