How to Fix Python PermissionError: [WinError 5] Access Is Denied

Rana Hasnain Khan Feb 02, 2024
How to Fix Python PermissionError: [WinError 5] Access Is Denied

We will briefly introduce how to resolve the PermissionError: [WinError 5] Access is denied in Python.

PermissionError: [WinError 5] Access is denied in Python

The PermissionError: [WinError 5] Access is denied is a very common error message that appears while using Python on Windows. This error might occur when we import Python packages, run a script, or update or install any Python packages.

Almost all python developers encounter this error at some stage in their careers. The error message is shown below.

permissionerror [winerror 5] access denied in Python

From the above image, I tried to install the setuptools using pip, and it gave me the PermissionError: [WinError 5] Access is denied. The solution is very simple, follow the steps below:

  • Go to search and write cmd, right-click on it, and run it as an administrator, as shown below.

    step 1 for solving permissionerror [winerror 5] access is denied

  • Now, we will run the command again, and it will work just fine, as shown below.

    step 2 for solving permissionerror [winerror 5] access is denied

When we run the cmd as an administrator and run the command or install or update any package, it works fine without giving any error.

Rana Hasnain Khan avatar Rana Hasnain Khan avatar

Rana is a computer science graduate passionate about helping people to build and diagnose scalable web application problems and problems developers face across the full-stack.

LinkedIn

Related Article - Python Error