GithubHelp home page GithubHelp logo

Comments (14)

vbabiy avatar vbabiy commented on August 26, 2024

Hmm, no comment?

Is supporting this planned? Is its missing considered a bug? Is there some
other way?


Original Comment By: Thomas Waldmann

from pip.

vbabiy avatar vbabiy commented on August 26, 2024

This is also an issue for me. I started digging into the pip code a little
bit, but I'm not sure what the correct fix is.


Original Comment By: Dan Sully

from pip.

vbabiy avatar vbabiy commented on August 26, 2024

maybe this will do it:
https://bitbucket.org/MattMaker/pip/changeset/9144e997b918


Original Comment By: MattMaker

from pip.

MatthewMaker avatar MatthewMaker commented on August 26, 2024

Made some adjustments to my proposed patch, see see https://bitbucket.org/MattMaker/pip/changeset/4a967b7de7ad and https://bitbucket.org/MattMaker/pip/changeset/9c681d36b768 . Now it works with uninstalling too! (oops :) )

from pip.

dsully avatar dsully commented on August 26, 2024

Matthew - can you fork the new pip repo on GitHub and send a pull request for your changes?

Thanks

from pip.

MatthewMaker avatar MatthewMaker commented on August 26, 2024

forked, retested, and pull requested!

from pip.

carljm avatar carljm commented on August 26, 2024

Fixed. Thanks @MatthewMaker for the patch, and @ssaboum for adding tests.

from pip.

poswald avatar poswald commented on August 26, 2024

Just a quick question about this... I don't think it is documented at all and I think it should be, probably in the requirements.txt section. My question is.. does this work in all places where you could use install before? I usually tested things out locally by running pip install . while in the working directory of my project.

I added this to my setup.py:

extras_require = {
    'django':  ['Django<1.4',],
}

... but now I don't see how I could install it. I tried pip install ". [django]" with no luck. Is this format supported? Is putting something like my project [django] in a requirements.txt supported? Should I open this as a new issue?

from pip.

carljm avatar carljm commented on August 26, 2024

@poswald Thanks for noting the lack of documentation - if you'd be willing to open an issue for that (or better, a pull request!) that'd be great.

As for the format, using myproject[extra] either from commandline or requirements file should certainly work. And from my reading of InstallRequirement.from_file and InstallRequirement.__init__ (in pip/reqs.py), it appears that extras can also be referenced from the #egg= fragment of a URL requirement (e.g. http://somesite/somepackage.tgz#egg=somepackage[extra]), though I haven't tested this. And this should also work with a local file:// URL to a directory, which might cover your use case. In any case, some experimentation here and documentation of what you find would definitely be helpful. If there are obvious gaps in the functionality, filing bugs for them would make sense (though personally I think supporting file:// URLs with an #egg= fragment is adequate, we don't need to support .[extra] - that just reads wierd.)

from pip.

poswald avatar poswald commented on August 26, 2024

There's the documentation for it in the requirements.txt file. I only use the .[extra] format because it works and I wasn't aware that the file:/// was working.

I'll play around and open any issues if I see it isn't working as expected. Thanks!

from pip.

carljm avatar carljm commented on August 26, 2024

Oh - I was under the impression from your previous comment that .[extra] didn't work. If it already works, great :-)

from pip.

poswald avatar poswald commented on August 26, 2024

I just didn't know how to properly specify it for a local install to test it because I didn't know how to do file://. I'll report back.

from pip.

poswald avatar poswald commented on August 26, 2024

Sorry guys, I may have spoken too soon on this. I thought it was working before but I must have done something wrong as doesn't seem to be. Here I have a project with an extras_require that I'm testing out. I checkout the project and create a virtualenv to try to install it into using the file:// technique:

$ which pip
/usr/local/bin/pip

$ pip --version
pip 1.0.2.post1 from /Users/poswald/tmp/src/pip (python 2.6)

$ git clone git://github.com/poswald/example.git example
Cloning into example...
remote: Counting objects: 348, done.
remote: Compressing objects: 100% (188/188), done.
remote: Total 348 (delta 157), reused 329 (delta 138)
Receiving objects: 100% (348/348), 59.39 KiB, done.
Resolving deltas: 100% (157/157), done.

$ cd example/

$ git checkout packaging
Branch packaging set up to track remote branch packaging from origin.
Switched to a new branch 'packaging'

$ pip freeze
distribute==0.6.14
virtualenv==1.6.1
wsgiref==0.1.2

$ virtualenv --distribute --no-site-packages .
New python executable in ./bin/python
Installing distribute....................................................................................................................................................................................done.
Installing pip...............done.

$ source bin/activate

(example)$ pip install "file:///Users/poswald/tmp/example [django]"
Unpacking /Users/poswald/tmp/example [django]
Exception:
Traceback (most recent call last):
  File "/Users/poswald/tmp/example/lib/python2.6/site-packages/pip-1.0.1-py2.6.egg/pip/basecommand.py", line 126, in main
    self.run(options, args)
  File "/Users/poswald/tmp/example/lib/python2.6/site-packages/pip-1.0.1-py2.6.egg/pip/commands/install.py", line 223, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/Users/poswald/tmp/example/lib/python2.6/site-packages/pip-1.0.1-py2.6.egg/pip/req.py", line 961, in prepare_files
    self.unpack_url(url, location, self.is_download)
  File "/Users/poswald/tmp/example/lib/python2.6/site-packages/pip-1.0.1-py2.6.egg/pip/req.py", line 1075, in unpack_url
    return unpack_file_url(link, location)
  File "/Users/poswald/tmp/example/lib/python2.6/site-packages/pip-1.0.1-py2.6.egg/pip/download.py", line 305, in unpack_file_url
    unpack_file(source, location, content_type, link)
  File "/Users/poswald/tmp/example/lib/python2.6/site-packages/pip-1.0.1-py2.6.egg/pip/util.py", line 473, in unpack_file
    or tarfile.is_tarfile(filename)
  File "/usr/local/Cellar/python/2.6.4/lib/python2.6/tarfile.py", line 2523, in is_tarfile
    t = open(name)
  File "/usr/local/Cellar/python/2.6.4/lib/python2.6/tarfile.py", line 1647, in open
    return func(name, "r", fileobj, **kwargs)
  File "/usr/local/Cellar/python/2.6.4/lib/python2.6/tarfile.py", line 1709, in gzopen
    fileobj = bltn_open(name, mode + "b")
IOError: [Errno 2] No such file or directory: '/Users/poswald/tmp/example [django]'

Storing complete log in /Users/poswald/.pip/pip.log

Assuming I did that correctly, it seems that the issue is that the line to unpack the file:// url is called without knowing about the requirements

Is there an equivalent to urllib.parse but for the pip requirements?

Should this be a separate issue or perhaps should this one be reopened?

from pip.

carljm avatar carljm commented on August 26, 2024

Whatever needs to be done here, if anything, should be a separate issue. Extras work just fine for the common case (installing "Foo[Bar]" off PyPI) which solves this ticket; I didn't really ever expect it to work for other cases. If it's possible to make it work, that's great, but it's a separate issue.

Based on reading the code, I didn't expect it to work using the syntax you tried, I expect that it should work if you pip install "file:///Users/poswald/tmp/example#egg=example[django]"

from pip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.