Skip to content

Adds --platform option to the 'pip install --download' command #2911

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
wants to merge 0 commits into from

Conversation

MathewJennings
Copy link

Using this command, a user can ask for wheels of a different architecture than that of the local machine running the command. In this way, a user running pip on a macosx machine can run 'pip wheel --no-index --find-links <target_dir> --architecture linux_x86_64 ' and gather a target wheel and all of its dependencies (which only install on linux machines). This can be used to bundle wheels of many different platforms/architectures for distribution later.

@pfmoore
Copy link
Member

pfmoore commented Jun 16, 2015

This doesn't offer the ability to build wheels of the specified architecture (because bdist_wheel doesn't offer that capability, which in turn is because cross-compiling isn't supported) so this option won't work if the specified architecture isn't already on PyPI. Worse, it looks like it will silently build the wrong wheel.

@MathewJennings
Copy link
Author

Right, this wasn't designed in order to build wheels of the wrong architecture, because that doesn't make sense.

The option is meant to be used as so: pip wheel --no-index --find-links --architecture linux_x86_64

--no-index will tell pip to not search on platforms like PyPI, which can't support linux wheels, for example. --find-links will tell pip where to search for wheels instead. This assumes you already have a collection of wheels on the filesystem, potentially multiple copies of the same wheel that are supported by different architectures.

The whole command isn't designed to build wheels, but rather to collect wheels and their dependencies, specifically for an architecture that isn't the local one. These wheels can then be distributed to someone else running that architecture, who will then build the wheels on their local machine.

@pfmoore
Copy link
Member

pfmoore commented Jun 16, 2015

OK. Given the specialised usage, I'd suggest it shouldn't be something included in pip, but rather a standalone command. (I appreciate that means that you have to reimplement the index searching that pip provides in that case - although you could try using distlib).

@dstufft
Copy link
Member

dstufft commented Jun 16, 2015

I don't think I have a problem with the idea, someone just asked for the ability to have a custom --platform which I think is basically the same thing as here. But I think it should be part of pip install --download, not part of pip wheel.

@MathewJennings
Copy link
Author

I was just considering the same thing, actually. That might be a better home for this functionality.
Does 'pip wheel' try to build wheels it finds? I think maybe I don't understand the full extent of what 'pip wheel' does. When I've run this command as discussed I've never had issues doing anything more than gathering wheels.

@dstufft
Copy link
Member

dstufft commented Jun 16, 2015

pip wheel's primary purpose is to ensure that you have a bunch of wheels built, either by downloading them or building them itself. pip install --download (which should really be moved to just pip download) downloads things only.

@MathewJennings
Copy link
Author

Alright, thanks Donald. For now I'm planning on making sure I pass the CI, and then I'm going to move this option to 'pip install' and make sure that the --download option is also specified.

I agree that 'pip download' as a command would be the best possible implementation, but I'm not sure I want to go that far down the rabbit hole. It could be a good follow up though.

@MathewJennings
Copy link
Author

As discussed earlier, this functionality has been moved.

Instead of living in the 'pip wheel' command, it lives in 'pip install', and is invoked with the option '--platform'.

It requires that the option '--download' is also specified, otherwise it raises a CommandError.

Example usage:
pip install --no-index --find-links --download --platform

@MathewJennings MathewJennings changed the title Adds --architecture option to the 'pip wheel' command Adds --platform option to the 'pip install --download' command Jun 16, 2015
@MathewJennings
Copy link
Author

@dstufft, is there anything else that needs to be done to make this PR merge worthy? (Sorry, I accidentally clicked "close and comment" instead of "comment")

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants