PIP Installing from Github

Hey team,

I would like to pip install a package from Github which I want to use in my app and then deploy on streamlit cloud share.

pip install --upgrade git+https://github.com/StreamAlpha/pynse.git

Please guide me how do I clone to this for using this package in my app and then hosting on Streamlit cloud.

Usually pip install packages like numpy, yfinance are put in requirements.txt, but how do I go about with this, pls help me.



Hi @pitanjal :wave:

This Knowledge base article in our docs covers how to install a package (that’s available on GitHub) on Streamlit Cloud via requirements.txt:

Let us know if this helped!

Happy Streamlit-ing! :balloon:


Is there documentation for this if the GitHub repo is private?

For example, I have success locally running:

pip install git+ssh://git@github.com/<organisation>/<repo>.git@<branch>

However, I have tried a couple things in the the requirements.txt for Cloud.


gives me the error:

fatal: could not read Username for 'https://github.com': No such device or address

  error: subprocess-exited-with-error

I appreciate the help!

1 Like

Hi Sophie,
I am running into the same issue, did you manage to resolve it?

Not yet, unfortunately.
I just tried this: python - Is it possible to use pip to install a package from a private GitHub repository? - Stack Overflow
Where I put the PERSONAL_ACCESS_TOKEN into the secrets that Streamlit Cloud has under ‘Settings’, but that didn’t work either.
I got fatal: could not read Password for 'https://$PERSONAL_ACCESS_TOKEN@github.com': No such device or address

Hi @sophiegeoghan and @C-Roensholt :wave:

I had no luck via the requirements.txt route either :disappointed: What worked was installing the package in the main app script itself via a subprocess.

Say your script is streamlit_app.py. Include the following at the very top of your app:

import streamlit as st
import subprocess
import sys
import time

  # replace "yourpackage" with the package you want to import
  import yourpackage

# This block executes only on the first run when your package isn't installed
except ModuleNotFoundError as e:
  subprocess.Popen([f'{sys.executable} -m pip install git+https://${{token}}@github.com/yourusername/yourrepo.git'], shell=True)
  # wait for subprocess to install package before running your actual code below
# Rest of your code goes here
import yourpackage

In the secrets management console paste in your token like so:


where xxxx is your GitHub personal access token.


Hi everybody,

I am facing the same problem when trying to install a private GitHub repo and unfortunately keep getting the error

fatal: could not read Username for 'https://github.com': No such device or address

  error: subprocess-exited-with-error

even after I tried the proposed solution of @snehankekre to generate the personal access token and install the package in the main script. Did anybody come up with a workaround in the mean time or made it work with the proposed code?

Would appreciate any helpful answers! Thanks!

1 Like

anyone get this to work? provided solution doesn’t for me

still doesn’t work… can anyone give better guidance>

I also need that.

@dudeman @GinaKsb @sophiegeoghan @C-Roensholt @pitanjal see this Medium article for more context and an explanation of how to do it (based on @snehankekre’s answer)

1 Like

I think the solution mentioned before by @snehankekre is not working any longer… You’ll now get an Errno-13. I’ve opened this topic to discuss it: Unable to install private github repo on streamlit cloud [Errno-13]