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:WINDOWS\System32\chcp.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 AppData\Local\Temp
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.
An update on this. Help from mikeolubode on the bertopic repo (https://github.com/MaartenGr/BERTopic/issues/1922) showed that this will install with python 3.9
. I had also posted the issue to the HDBSCAN repo, and have updated that the problem appears to be with python 3.12.3
.
For anyone wanting more specific instructions:
If you haven't already, delete your existing virtual environment.
Download and install python 3.9 (https://www.python.org/downloads/release/python-390/)
Create your new virtual environment calling python 3.9. I am using the python launcher so at the command line that is:
py -3.9 -m venv [path_to_your_venv]
Activate your environment:
[path_to_your_venv]\Scripts\activate
And install HDBSCAN:
py -m pip install hdbscan
Everything now completes for me.