Issue2576

classification
Title: pip install -r requirements.txt fails with RE recursion limit
Type: Severity: major
Components: Versions: Jython 2.7
Milestone:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: jamesmudd, pjac, stefan.richthofer
Priority: Keywords:

Created on 2017-04-06.10:52:26 by pjac, last changed 2017-04-08.11:46:29 by jamesmudd.

Messages
msg11299 (view) Author: Peter (pjac) Date: 2017-04-06.10:52:25
Discovered and tested under macOS, then reduced to the following simple test case

(1) Install Jython 2.7.0, e.g. as follows:

$ java -jar jython-installer-2.7.0.jar -s -d ~/jython-2.7.0

(2) Update pip to current release, pip 9.0.1

$ ~/jython-2.7.0/bin/jython -m pip install --upgrade pip
Downloading/unpacking pip from https://pypi.python.org/packages/b6/ac/7015eb97dc749283ffdec1c3a88ddb8ae03b8fad0f0e611408f196358da3/pip-9.0.1-py2.py3-none-any.whl#md5=297dbd16ef53bcef0447d245815f5144
  Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB): 1.3MB downloaded
Installing collected packages: pip
  Found existing installation: pip 1.6.dev1
    Uninstalling pip:
      Successfully uninstalled pip
Successfully installed pip
Cleaning up...

(3) Attempt to run pip with a requirements file, even a trivial example:

$ echo pip > requirements.txt
$ ~/jython-2.7.0/bin/jython -m pip install -r requirements.txt 
Exception:
Traceback (most recent call last):
  File "/Users/xxx/jython-2.7.0/Lib/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Users/xxx/jython-2.7.0/Lib/site-packages/pip/commands/install.py", line 310, in run
    self.populate_requirement_set(
  File "/Users/xxx/jython-2.7.0/Lib/site-packages/pip/basecommand.py", line 292, in populate_requirement_set
    for req in parse_requirements(
  File "/Users/xx/jython-2.7.0/Lib/site-packages/pip/req/req_file.py", line 89, in parse_requirements
    for line_number, line in lines_enum:
  File "/Users/xxx/jython-2.7.0/Lib/site-packages/pip/req/req_file.py", line 323, in ignore_comments
    for line_number, line in lines_enum:
  File "/Users/xxx/jython-2.7.0/Lib/site-packages/pip/req/req_file.py", line 298, in join_lines
    if COMMENT_RE.match(line):
RuntimeError: maximum recursion depth exceeded (Java StackOverflowError)


I'm assuming this is a Jython problem given pip 9.0.1 works fine for me under CPython and PyPy.
msg11300 (view) Author: Stefan Richthofer (stefan.richthofer) Date: 2017-04-06.12:27:17
Peter, could you please test this with current trunk version or at least with 2.7.1 soft release candidate?
(See https://sourceforge.net/p/jython/mailman/message/35692550)

There have been some improvements regarding PIP since Jython 2.7.0.
msg11301 (view) Author: James Mudd (jamesmudd) Date: 2017-04-08.11:46:28
I have just tested this with the current master and it appears to have already been fixed. I get:

james@james-ubuntu:~/jython2.7.1rc1/bin$ ./jython -m pip install --upgrade pip
Requirement already up-to-date: pip in /home/james/jython2.7.1rc1/Lib/site-packages

james@james-ubuntu:~/jython2.7.1rc1/bin$ ./pip --version
pip 9.0.1 from /home/james/jython2.7.1rc1/Lib/site-packages (python 2.7)

james@james-ubuntu:~/jython2.7.1rc1/bin$ echo pip > requirements.txt 

james@james-ubuntu:~/jython2.7.1rc1/bin$ ./jython -m pip install -r requirements.txt 
Requirement already satisfied: pip in /home/james/jython2.7.1rc1/Lib/site-packages (from -r requirements.txt (line 1))
History
Date User Action Args
2017-04-08 11:46:29jamesmuddsetnosy: + jamesmudd
messages: + msg11301
2017-04-06 12:27:17stefan.richthofersetnosy: + stefan.richthofer
messages: + msg11300
2017-04-06 10:52:27pjaccreate