I am tring to run subprocess.run(["huggingface-cli", "login", "--token", TOKEN])
in a Jupyter notebook, which works on Mac but gets the following error on Ubuntu. I checked that pip install huggingface_hub
has been executed.
subprocess.run(["git", "lfs", "install"])
works.
!huggingface-cli login
in the jupyter cell gets the error /bin/bash: huggingface-cli: command not found
Anyone can help?
Your huggingface_hub
is not in your path env variable for your Ubuntu
system, it is not the same between your jupyter
and your terminal
session
here what you can do, get the path
of the executable pip show huggingface_hub | grep Location
then update the path in your jupyter notebook, like for example:
import os
import sys
import subprocess
huggingface_bin_path = "/home/user/.local/bin"
os.environ["PATH"] = f"{huggingface_bin_path}:{os.environ['PATH']}"
subprocess.run(["huggingface-cli", "login", "--token", TOKEN])
replace /home/user/.local/bin
and TOKEN
with the correct one, then it should work