diff --git a/backend/src/main.rs b/backend/src/main.rs index 84deb4e6b5..3f04fc8688 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -892,7 +892,6 @@ pub async fn run_workers = vec![]; for req in requirements { - // let venv_p = format!( - // "{UV_CACHE_DIR}/{}", - // req.replace(' ', "").replace('/', "").replace(':', "") - // ); + let py_prefix = if no_uv_install { + PIP_CACHE_DIR + } else { + PY311_CACHE_DIR + }; - // tracing::error!("{:?}", &venv_p); let venv_p = format!( - "{PIP_CACHE_DIR}/{}", + "{py_prefix}/{}", req.replace(' ', "").replace('/', "").replace(':', "") ); if metadata(&venv_p).await.is_ok() { - // TODO: remove (Deperecated) - if no_uv_install { - // e.g.: /tmp/windmill/cache/pip/wmill==1.408.1/wmill-1.408.1.dist-info/INSTALLER - let installer_file_path = format!( - "{PIP_CACHE_DIR}/{}/{}.dist-info/INSTALLER", - req.replace(' ', "").replace('/', "").replace(':', ""), - req.replace(' ', "") - .replace('/', "") - .replace(':', "") - // We want this form of dependency (with _ ) - // typing_extensions-4.12.2.dist-info - .replace('-', "_") - .replace("==", "-") - ); - - append_logs( - &job_id, - w_id, - format!("\nLooking into: {}", installer_file_path), - db, - ) - .await; - - // There is metadata which package manager downloaded library - // It is stored in *.dist-info/INSTALLER - // So if we fallback to pip and we see library installed by uv - // we want to override this installation - // TODO: If error, override anyway - if "uv" == std::fs::read_to_string(installer_file_path)? { - // Rmdir to make it pure - std::fs::remove_dir_all(&venv_p)?; - // Push it for installation - req_with_penv.push((req.to_string(), venv_p)); - } else { - req_paths.push(venv_p); - } - } else { - req_paths.push(venv_p); - } + req_paths.push(venv_p); } else { req_with_penv.push((req.to_string(), venv_p)); } @@ -1242,8 +1211,6 @@ pub async fn handle_python_reqs( "3.11", // Prevent uv from discovering configuration files. "--no-config", - // "--no-warn-conflicts", - "--disable-pip-version-check", // TODO: Doublecheck it "--system", // Prefer main index over extra diff --git a/backend/windmill-worker/src/worker.rs b/backend/windmill-worker/src/worker.rs index 14eab32eac..cbd0cb351f 100644 --- a/backend/windmill-worker/src/worker.rs +++ b/backend/windmill-worker/src/worker.rs @@ -236,7 +236,14 @@ pub const TMP_LOGS_DIR: &str = concatcp!(TMP_DIR, "/logs"); pub const ROOT_CACHE_NOMOUNT_DIR: &str = concatcp!(TMP_DIR, "/cache_nomount/"); pub const LOCK_CACHE_DIR: &str = concatcp!(ROOT_CACHE_DIR, "lock"); +// Used as fallback now pub const PIP_CACHE_DIR: &str = concatcp!(ROOT_CACHE_DIR, "pip"); + +// pub const PY310_CACHE_DIR: &str = concatcp!(ROOT_CACHE_DIR, "python_310"); +pub const PY311_CACHE_DIR: &str = concatcp!(ROOT_CACHE_DIR, "python_311"); +// pub const PY312_CACHE_DIR: &str = concatcp!(ROOT_CACHE_DIR, "python_312"); +// pub const PY313_CACHE_DIR: &str = concatcp!(ROOT_CACHE_DIR, "python_313"); + pub const UV_CACHE_DIR: &str = concatcp!(ROOT_CACHE_DIR, "uv"); pub const TAR_PIP_CACHE_DIR: &str = concatcp!(ROOT_CACHE_DIR, "tar/pip"); pub const DENO_CACHE_DIR: &str = concatcp!(ROOT_CACHE_DIR, "deno");