Search code examples
pythongithubpipenvegg

Why pipenv module install from git with egg fragment fails even with requirement present?


Using pipenv on Windows 10 with Python 3.9.5. I am trying to use:

pipenv install git+https://github.com/John-Polo/cocoapi.git#egg=PythonAPI

My repo directory tree looks like

cocoapi/PythonAPI/pycocotools
                -/setup.py
                -[more directories]

When I run the pipenv install, this is the result:

(test-jpGYXydt) C:\Users\john\Documents\code\test>pipenv install git+https://github.com/John-Polo/cocoapi.git#egg=foo
Installing git+https://github.com/John-Polo/cocoapi.git#egg=foo...
Error:  An error occurred while installing git+https://github.com/John-Polo/cocoapi.git#egg=foo!
Error text: Collecting foo
  Cloning https://github.com/John-Polo/cocoapi.git to c:\users\john\appdata\local\temp\pip-install-9ocvuaci\foo_47404cbbe883400593b4786c6adbe805
  Resolved https://github.com/John-Polo/cocoapi.git to commit 2929bd2ef6b451054755dfd7ceb09278f935f7ad

  Running command git clone -q https://github.com/John-Polo/cocoapi.git 'C:\Users\john\AppData\Local\Temp\pip-install-9ocvuaci\foo_47404cbbe883400593b4786c6adbe805'
ERROR: File "setup.py" not found for legacy project foo from git+https://github.com/John-Polo/cocoapi.git#egg=foo (from -r c:\users\john\appdata\local\temp\pipenv-qmfhwbjb-requirements\pipenv-2bqximai-requirement.txt (line 1)).

Installation Failed

I don't understand why the installation failed with "setup.py" not found when the file is contained in PythonAPI tree. How can I fix this?

EDIT: after Gonzalo's comment, I changed the location of setup.py from

cocoapi/PythonAPI/pycocotools
                -/setup.py

to

cocoapi/PythonAPI/pycocotools
cocoapi/setup.py

And now I get a different error. But it's not an error about not finding setup.py, so it seems that the change addressed the error this question was about.


Solution

  • pip expects your setup.py on the root of your git repository, like:

    cocoapi/PythonAPI/pycocotools
    cocoapi/setup.py