26

How can I install a specific git branch with pipenv? I know this command will install the bitcoinlib master branch

pipenv install -e git+https://github.com/1200wd/bitcoinlib.git#egg=bitcoinlib 

But how can I install a branch that isn't master?

3 Answers 3

42

You need to simply use the @ symbol to specify branch and change the egg name to be a bit different if you're also using the master or some other branch. Follow this syntax

pipenv install -e git+<your/target/git/repository/url.git>@branch#egg=package_name 

So in my example I needed to use the segwit-support branch

pipenv install -e git+https://github.com/1200wd/bitcoinlib.git@segwit-support#egg=bitcoinlib_segwitsupport 

Which adds this line to my pipfile

bitcoinlib_segwit-support = {editable = true, ref = "segwit-support", git = "https://github.com/1200wd/bitcoinlib.git"} 
Sign up to request clarification or add additional context in comments.

2 Comments

"Docs" point to 404
0

I think this Post discusses exactly your issue. For a specific version/branch you need to modify the https url.

Comments

0

There is another way you can do that:

  • Add in your Pipfile [packages] section

packages_name = {git = "https://repository_url.git", ref = "branch_name", editable=True}

editable = True means that the package is installed in "editable mode." This allows changes made directly to the source code of the package to be immediately reflected in the environment where the package is installed, without needing to reinstall the package.

Example:

[packages]

nemoguardrails = {git = "https://github.com/NVIDIA/NeMo-Guardrails.git", ref = "develop", editable = true}

Once you have done this, run the following in your terminal:

pipenv install 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.