Install huggingface cli on Windows 11

Stefan SkorpenStefan Skorpen
2 min read

First you need to install python, by going to the official python page and download the installer for windows.

When you have python ready, open your terminal app or the command line as administrator.
Search for terminal or cmd in the search menu, right click the app and select open as administrator.

Install huggingface by typing in “pip install -U "huggingface_hub[cli]"

If the installer says something like “Defaulting to user installation because normal site-packages is not writeable“ then you are in normal mode for the terminal, and not using it as an administrator.

(some also have success by making creating a virtual enviroment for their python project with “python -m venv .env”)

After the huggingface cli is installed, then you have to add the path to the installed files to your PATH variables.

If you dont add the installpath to the PATH then you often get this error:
“'huggingface-cli' is not recognized as an internal or external command, operable program or batch file.”

The programs were installed in this location:

“C:\Users\%username%\AppData\Roaming\Python\Python313\Scripts\“

You have to find your real username first, go to “c:\users” and look what users you have created in your windows installation.

Then right click the start menu icon and choose “System”, then look for “Advanced system settings”
Then click “Environment Variables”
At the bottom part locate the “path” in the list and click edit.

Choose “new” and enter “C:\Users\your_username_here\AppData\Roaming\Python\Python313\Scripts\”
make sure to put in your own username.

Restart windows to make sure that the setting is applied.

After the reboot you can open your terminal or cmd app and type in “huggingface-cli —help” and you should see something like the article image as the response.

0
Subscribe to my newsletter

Read articles from Stefan Skorpen directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Stefan Skorpen
Stefan Skorpen