Skip to content

Relative paths in requirements don't seem to work #892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
stuaxo opened this issue Aug 18, 2014 · 6 comments
Closed

Relative paths in requirements don't seem to work #892

stuaxo opened this issue Aug 18, 2014 · 6 comments

Comments

@stuaxo
Copy link

stuaxo commented Aug 18, 2014

In my project we have a sphinx extension .. my requirements file points at it like this:

./sphinxcontrib_shoebot

Locally I have pip 1.5.6 and installing this requirements flle works correctly.
On rtd I get this error:

requirements
-----

Exception:
Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/shoebot-test-rtd/envs/readthedocs/local/lib/python2.7/site-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/home/docs/checkouts/readthedocs.org/user_builds/shoebot-test-rtd/envs/readthedocs/local/lib/python2.7/site-packages/pip/commands/install.py", line 262, in run
    for req in parse_requirements(filename, finder=finder, options=options, session=session):
  File "/home/docs/checkouts/readthedocs.org/user_builds/shoebot-test-rtd/envs/readthedocs/local/lib/python2.7/site-packages/pip/req.py", line 1631, in parse_requirements
    req = InstallRequirement.from_line(line, comes_from, prereleases=getattr(options, "pre", None))
  File "/home/docs/checkouts/readthedocs.org/user_builds/shoebot-test-rtd/envs/readthedocs/local/lib/python2.7/site-packages/pip/req.py", line 172, in from_line
    return cls(req, comes_from, url=url, prereleases=prereleases)
  File "/home/docs/checkouts/readthedocs.org/user_builds/shoebot-test-rtd/envs/readthedocs/local/lib/python2.7/site-packages/pip/req.py", line 70, in __init__
    req = pkg_resources.Requirement.parse(req)
  File "/home/docs/checkouts/readthedocs.org/user_builds/shoebot-test-rtd/envs/readthedocs/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources.py", line 2667, in parse
    reqs = list(parse_requirements(s))
  File "/home/docs/checkouts/readthedocs.org/user_builds/shoebot-test-rtd/envs/readthedocs/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources.py", line 2605, in parse_requirements
    line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")
  File "/home/docs/checkouts/readthedocs.org/user_builds/shoebot-test-rtd/envs/readthedocs/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources.py", line 2573, in scan_list
    raise ValueError("Expected "+item_name+" in",line,"at",line[p:])
ValueError: ('Expected version spec in', './sphinxcontrib_shoebot', 'at', '/sphinxcontrib_shoebot')

Storing debug log for failure in /home/docs/.pip/pip.log

https://readthedocs.org/builds/shoebot-test-rtd/1610799/

@ericholscher
Copy link
Member

Looks like we're running pip 1.5.6 on the build server -- I imagine we aren't running the requirements file from the directory -- does pip expect that path relative to the file or the current working dir?

@stuaxo
Copy link
Author

stuaxo commented Aug 18, 2014

I did a quick test and it appears to be the current working directory.

I guess running pip from the same directory as the requirements.txt seems logical - though, the project root would be another candidate.

If it's the project root, I can just move my requirements or just have a special one for rtd.

Ideally I could just use file: urls but these seem broken for relative directories (though file:../currentdir/ is a horrible workaround ... as long as pip is executed from the same directory as requirements).

@ericholscher
Copy link
Member

Having the install process depend on where pip is run from seems like tying
it to an implementation detail on our side. I can't guarantee that logic
will stay consistent -- I feel like there should be a better way to solve
this, but I don't know what it is off hand.

On Mon, Aug 18, 2014 at 9:59 AM, Stuart Axon [email protected]
wrote:

I did a quick test and it appears to be the current working directory.

I guess running pip from the same directory as the requirements.txt seems
logical - though, the project root would be another candidate.

If it's the project root, I can just move my requirements or just have a
special one for rtd.

Ideally I could just use file: urls but these seem broken for relative
directories (though file:../currentdir/ is a horrible workaround ... as
long as pip is executed from the same directory as requirements).


Reply to this email directly or view it on GitHub
#892 (comment)
.

Eric Holscher
Maker of the internet residing in Portland, Or
http://ericholscher.com

@stuaxo
Copy link
Author

stuaxo commented Aug 18, 2014

If pip ever fixes relative paths and file: urls then the workaround isn't needed.

I'm not usually a fan of "add a setting", in this case though, you could add a setting for the CWD, relative to the project that pip will be run from.

@stuaxo
Copy link
Author

stuaxo commented Aug 18, 2014

Now I think about it more, being able to set the CWD is probably the only sane option.

@ericholscher
Copy link
Member

Seems like #890 is the main issue here, closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants