Permission Denied in Temp folder on Windows #22042
Replies: 1 comment
-
|
This is a Windows UAC/permissions issue with how Prefect tries to write to Most common cause: temp directory path with spaces or special characters Prefect's subprocess workers sometimes fail when # Set TEMP to a path with no spaces before running Prefect
$env:TEMP = "C:\Temp"
$env:TMP = "C:\Temp"
New-Item -ItemType Directory -Force "C:\Temp"
prefect server startRunning as non-admin with restricted temp access If you're running Prefect as a service account or in a context where # prefect.yaml or in your flow
import tempfile
import os
# Point Prefect to a writable location
os.environ["PREFECT_HOME"] = "C:/PrefectData"
os.environ["TMPDIR"] = "C:/PrefectData/tmp"Or configure in [home]
path = "C:/PrefectData"Antivirus/EDR blocking temp writes Windows Defender and most EDR solutions scan and sometimes temporarily lock files being written to Docker Desktop / WSL2 interaction If running Prefect inside WSL2 but storing state on the Windows filesystem ( Diagnostic: check the exact error path import tempfile
print(tempfile.gettempdir()) # see what Prefect will use
# Test write
with tempfile.NamedTemporaryFile(dir=tempfile.gettempdir(), delete=True) as f:
f.write(b"test")
print("Temp write OK")If this fails, the temp directory itself is the problem. If it succeeds, the issue is specific to how Prefect is launched (service account vs. user context). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a flow from my prefect server on Ubuntu and I am trying to get a Windows worker to do runs however I am getting an error saying that access is denied:
14:53:59.053 | ERROR | Flow run 'rough-macaw' - [WinError 5] Access is denied: 'C:\\Users\\jason.nagy\\AppData\\Local\\Temp\\18\\tmp0_x4yprdprefect\\prefect-workflows-test\\.git\\objects\\pack\\pack-b8233f81476ede7f07c417aa498194b26da1266b.idx'I checked the folder and my user has full permissions so Im not sure why it is complaining I dont have permissions. I confirmed all my prefect versions are up to date. I am using Git submodules and made sure my Github token is valid for all repos needed. The token is set up on my server hosting the deploymen. The worker just has a basic profile to access the server and is then started with
prefect worker start --pool "local-pool".A longer snippet of the logs is pasted below:
Beta Was this translation helpful? Give feedback.
All reactions