guyzmo / git-repo

Git-Repo: CLI utility to manage git services from your workspace
https://webchat.freenode.net/?channels=#git-repo
Other
842 stars 86 forks source link

Getting error when installing from git repo #190

Open doronbehar opened 6 years ago

doronbehar commented 6 years ago

Here is the error:

Processing /home/doron/repos/git-repo
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-req-build-sxu0n8_f/setup.py", line 169, in <module>
        install_requires=requirements(),
      File "/tmp/pip-req-build-sxu0n8_f/setup.py", line 125, in requirements
        requirements = pip.req.parse_requirements(
    AttributeError: module 'pip' has no attribute 'req'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-req-build-sxu0n8_f/

My pip --version is:

pip 10.0.1 from /home/doron/.local/share/virtualenvs/git-repo-6JSdEnFI/lib/python3.6/site-packages/pip (python 3.6)
guyzmo commented 6 years ago

uh.. looks like pip 10 did a major API change. As I've heard, pip integrated a bunch of hacks that was necessary into the project, and changed a bunch of its internals. So I need to check the new better way of doing things and update this :)

I'm open to suggestions/pointers to help me expedite this, as I'm being currently snowed with paying work :)

nikitavbv commented 6 years ago

I'm open to suggestions/pointers to help me expedite this, as I'm being currently snowed with paying work :)

Generally, it is not a good practice to read requirements.txt from setup.py and install_requires should be listed in setup.py separately from requirements.txt. There is a really good explanation for this on StackOverflow.

There are three possible solutions:

  1. List requirements in setup.py separately from requirements.txt in a proper way.
  2. Just change current code a bit to adapt to pip changes: they have moved req to _internal, so something like from pip._internal import req should work. But that is a hack, not a good solution :)
  3. Just read requirements.txt as file and use its lines for install_requires. Some repos followed this way: example.

I would be happy to help to solve this issue (incl. pull request).

What are your thoughts on this?

nikitavbv commented 6 years ago

I pushed PR #191, which fixes this issue