Search code examples
pythonmediapipe

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


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

  • EnvironmentError: Access is denied errors usually stem from one of three 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. You don't have permission to install the package system-wide. You can instead install it for only your user by adding the --user flag:
    pip install --user <PACKAGE>
    
    1. If that 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.