question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Spaces] Can't install from private git

See original GitHub issue

Describe the bug

Hi,

I cannot get installing python packages from private repos to work (tried gitlab and hf). When using the access tokens, the part where the requirements.txt are installed still fails.

On any remote machine I tried, this works perfectly. The error is attached below.

To reproduce create a private repo with a setup.py and a folder named “test” (as attached). Then in your public space add this to the requirements.txt: pip install git+https://${USERNAME}:${SECRET}@${YOUR_REPO}.

Reproduction

No response

Logs

--> RUN pip install -r requirements.txt
Defaulting to user instal
[test.zip](https://github.com/huggingface/huggingface_hub/files/9371797/test.zip)
lation because normal site-packages is not writeable
Collecting git+https://lfolle:****@huggingface.co/lfolle/handkimodel (from -r requirements.txt (line 3))
  Cloning https://lfolle:****@huggingface.co/lfolle/handkimodel to /tmp/pip-req-build-8eb7e8uv
  Running command git clone --filter=blob:none --quiet 'https://lfolle:****@huggingface.co/lfolle/handkimodel' /tmp/pip-req-build-8eb7e8uv
  fatal: Authentication failed for 'https://lfolle:${HANDKIMODEL}@huggingface.co/lfolle/handkimodel/'
  error: subprocess-exited-with-error

System Info

The code is running on Spaces, so should be up-to-date an linux.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
osansevierocommented, Aug 19, 2022

If you’re doing it in runtime, although it would be slower, you can do subprocess.run to run git clone + cd + pip install .

1reaction
osansevierocommented, Aug 18, 2022

If this is for a Space, you could do something like

file_path = hf_hub_download("lfolle/DeepNAPSIModel", "dummy_model.pth",
                              use_auth_token=os.environ['DeepNAPSIModel'])

And you can add the environment variable as a secret in the Settings tab as documented here. There is no need to have it in the requirements file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

git repositories with spaces not working
1 git is not dealing properly with remote repositories that have a space in them. On VSTS we have a parent repository that...
Read more >
Is it possible to use pip to install a package from a private ...
I am trying to install a Python package from a private GitHub repository. For a public repository, I can issue the following command...
Read more >
Managing access to other repositories within your codespace
You can manage the repositories that GitHub Codespaces can access. ... If your repository does not already contain a devcontainer.json file, add one...
Read more >
How to Use a Private Go Module in Your Own Project
To publish your new module, stage your changes in the current directory using the git add command, then commit those changes to your...
Read more >
Manage projects - GitLab Docs
You cannot use git push to create projects with project paths that: ... Generate a personal access token and add the credentials in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found