Can’t install package with pip: “error [WinWrror 5] Access is denied”

  Kiến thức lập trình

I am struggling to install hdbscan into a virtual environment. I am trying to do this as part of a bertopic install – which is also failing when trying to install hdbscan as a dependency.

I have looked through a number of SO pages on this error and tried almost everything, but nothing seems to work. Here are the specifics and what I have tried.

  • I am on Windows 11

  • I am trying to install to a virtual environment: py -m venv [path-to-environment] Note that when I activate the virtual environment i get the following error '"C:WINDOWSSystem32chcp.com"' is not recognized as an internal or external command, operable program or batch file.. Despite this, the environment activates.

  • Initially when trying the install I ran into
    a problem regarding MS C++14 requirements. I installed those and the
    error when away.

  • Now i can’t get around the error: Building wheel for hdbscan (pyproject.toml) did not run successfully. Specific error is as follows:

    building 'hdbscan._hdbscan_tree' extension
          error: [WinError 5] Access is denied
          [end of output]
    
      note: This error originates from a subprocess, and is likely not a problem with pip.
      ERROR: Failed building wheel for hdbscan
    Failed to build hdbscan
    ERROR: Could not build wheels for hdbscan, which is required to install pyproject.toml-based projects
    
  • Its the same error whether i try py -m pip install bertopic and py -m pip install hdbscan

  • I have tried running as admin – since python is in the admin path i call python rather than py when repeating the above commands.

  • I have tried updating pip in the virtual env
    py -m pip install --upgrade pip – everything is fine

  • I have made sure to run from the command prompt rather than the IDE

  • I have rebooted my machine and tried running this as the first thing i do

  • I have tried adding the --user option but i get the response that
    this is available in the virtualenv: ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.

  • I note that my venv has its permissions set to read only. I changed this and ran the install again. Made no difference. Note on this, i am able to install other packages, with permissions being set to read-only, so i don’t think this is the issue.

  • I looked through my AppDataLocalTemp directory to delete any pip related folders, but found nothing (though there are some pyright and python-languageserver folders in there)

If anyone knows how I can diagnose the issue here, i would greatly appreciate it.

LEAVE A COMMENT