harishaseebat92 commited on
Commit
021d346
·
1 Parent(s): 2ee3876

Fix: Correct aqc_venv path for Docker environment

Browse files
utils/EBU_Quantum/no_body/base_functions.py CHANGED
@@ -683,22 +683,25 @@ from qiskit import QuantumCircuit
683
  from qiskit.qasm3 import dumps, loads
684
 
685
  # --- Dynamic Path Detection ---
686
- # 1. Find the project root (webui_trame)
687
- # This file is at: .../quantum/utils/EBU_Quantum/no_body/base_functions.py
688
- # So we go up 4 levels to reach 'webui_trame'
689
  CURRENT_FILE = Path(__file__).resolve()
690
- PROJECT_ROOT = CURRENT_FILE.parents[4]
691
 
692
- # 2. Define the path to the virtual environment python executable
693
- # It is located at: .../quantum/utils/aqc_venv/Scripts/python.exe (Windows)
694
- # or .../quantum/utils/aqc_venv/bin/python (Linux/Mac)
695
- VENV_DIR = PROJECT_ROOT / "quantum" / "utils" / "aqc_venv"
 
696
 
697
  if sys.platform == "win32":
698
  ADAPT_PYTHON = str(VENV_DIR / "Scripts" / "python.exe")
699
  else:
700
  ADAPT_PYTHON = str(VENV_DIR / "bin" / "python")
701
 
 
 
 
 
702
  # 3. Define the module path
703
  ADAPT_MODULE = "quantum.utils.EBU_Quantum.no_body.run_adapt_aqc"
704
 
@@ -740,7 +743,9 @@ sys.stdout.write(dumps(qc_opt))
740
  """
741
 
742
  # Launch subprocess, pipe in QASM3 string
743
- # We set cwd to PROJECT_ROOT so imports like 'quantum.utils...' work correctly
 
 
744
  proc = subprocess.run(
745
  [ADAPT_PYTHON, "-c", code],
746
  input=qasm_str,
 
683
  from qiskit.qasm3 import dumps, loads
684
 
685
  # --- Dynamic Path Detection ---
686
+ # This file is at: .../utils/EBU_Quantum/no_body/base_functions.py
687
+ # We need to find: .../utils/aqc_venv/
 
688
  CURRENT_FILE = Path(__file__).resolve()
 
689
 
690
+ # Go up to the 'utils' directory (3 levels: base_functions.py -> no_body -> EBU_Quantum -> utils)
691
+ UTILS_DIR = CURRENT_FILE.parents[2]
692
+
693
+ # Define the path to the virtual environment python executable
694
+ VENV_DIR = UTILS_DIR / "aqc_venv"
695
 
696
  if sys.platform == "win32":
697
  ADAPT_PYTHON = str(VENV_DIR / "Scripts" / "python.exe")
698
  else:
699
  ADAPT_PYTHON = str(VENV_DIR / "bin" / "python")
700
 
701
+ # Debug: Print the path to help troubleshoot
702
+ print(f"DEBUG: ADAPT_PYTHON path = {ADAPT_PYTHON}")
703
+ print(f"DEBUG: VENV exists = {VENV_DIR.exists()}")
704
+
705
  # 3. Define the module path
706
  ADAPT_MODULE = "quantum.utils.EBU_Quantum.no_body.run_adapt_aqc"
707
 
 
743
  """
744
 
745
  # Launch subprocess, pipe in QASM3 string
746
+ # We set cwd to the project root (parent of utils) so imports work correctly
747
+ # UTILS_DIR is .../utils, so UTILS_DIR.parent is the project root (e.g., /home/user/app)
748
+ PROJECT_ROOT = UTILS_DIR.parent
749
  proc = subprocess.run(
750
  [ADAPT_PYTHON, "-c", code],
751
  input=qasm_str,