Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

`pip install` from Github private repo with `setup.py` not in `root` directory

Our current setup is this:

  • repo_1
  • repo_2
  • components_repo

repo_1 and repo_2 both need to make use of the components from the component_repo and all 3 repo’s are in Github.

The component_repo folder structure is like this:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

.
├── README.md
└── src
    ├── setup.py
    ├── folder_1
    │   ├── functions.py
    ├── folder_2
    │   ├── functions.py

So I looked into "installing" this component_repo and found these docs:

and they both explain how to use this command:

python -m pip install -e git+https://$GITHUB_USER:$GH_TOKEN@github.com/$GITHUB_USER/components.git@main#egg=common&subdirectory=src

But then, I get this error:

ERROR: components from
git+https://$GITHUB_USER:****@github.com/$GITHUB_USER/components.git@main#egg=common
does not appear to be a Python project: neither ‘setup.py’ nor
‘pyproject.toml’ found.

And I see this in my repo_1 src folder:

enter image description here

So as I understand, it will do a git clone, then build with setup.py and then remove the cloned repo. But it’s failing at step 2 and not completing the final step (I think).

Admittedly, I still don’t quite understand what needs to be used for #egg= but I do know, if I exclude #egg=[whatever] from the command, then I get this error:

ERROR: Could not detect requirement name for
‘git+https://$GITHUB_USER:$GH_TOKEN@github.com/$GITHUB_USER/components.git@main’,
please specify one with #egg=your_package_name

I figured that with using the &subdirectory=src in the command, I am specifying the location of the setup.py file, but it turns out, that’s not the case.

So I thought I would move the setup.py file one directory up, to be in the root directory instead, and lo and behold, it works. I did need to update the paths inside the setup.py file for it to work (since I am one directory higher), but it worked.

>Solution :

Depending on your shell, you might need to add double quotes around that URL, otherwise # and/or & might be interpreted by the shell:

python -m pip install -e "git+https://$GITHUB_USER:$GH_TOKEN@github.com/$GITHUB_USER/components.git@main#egg=common&subdirectory=src"
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading