'Could not install packages due to an EnvironmentError: [WinError 5] Access is denied [duplicate]

ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'C:\Users\Sampath\anaconda3\Lib\site-packages\~5py\defs.cp38-win_amd64.pyd' Consider using the --user option or check the permissions.

I tried pip install mediapipe



Solution 1:[1]

EnvironmentError: Access is denied errors usually stem from one of two reasons:

  1. You do not have the proper permissions to install these files, and you should try running the same commands in an Administrator Command Prompt. 90% of the time, this should solve the problem.
  2. If the first doesn't work, then the problem is usually from an external program accessing a file, and you (or the installation script) are trying to delete that file (you cannot delete a file that is opened by another program). Try to restart your computer, so that whatever process is using that file will be shut down. Then, try the command again.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1