-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add scripts directory option when using pip install --target target_dir
#3934
Comments
pip install --target target_dir
pip install --target target_dir
Slightly related to #3980 |
I agree that it would be great. But how to implement it? It's sub-option of |
Is there any workaround on this where we could install a binary wheel to a specific target with the binaries installed? |
a workaround is to use the |
I'd like to work on this (PyPA Sprint Weekend at Bloomberg). |
@gokcennurlu Great! How's this going? |
For `pip install`, this introduces a new option, `--scripts-target`, only to be used with `--target`, so that users can now specify a different path for scripts/binaries instead of the default `$target_dir/bin`. For wheel installations, the given path is injected to `scheme` in `move_wheel_files()`. For non-wheels, it is used as `--install-scripts`. This should close pypa#3934.
@pradyunsg following our conversation on this issue at pycon, what I understand from the code is that scripts are not copied to target on purpose, and it is reference to #5201. Please advice whether you want to add this functionality or not. |
The original problem here seems to have been fixed by the change in #4152; the |
From our perspective having the bin directory inside the directory pointed by --target is better, but still not enough. We do make use of virtual envs, however on top of that we use a patching system through PATH/PYTHONPATH variable (and other variables, bear in mind that in our context Java, Python and C++ coexist and communicate through CORBA). The --prefix <path> flag would be enough, however our legacy code installs in different <path1>/lib/python/site-packages, <path2>/lib/python/site-packages, etc., inestead of <path1>/lib/python3.8/site-packages, <path2>/lib/python3.8/site-packages, etc., which has the positive effect of being able to dynamically swap between Python versions. The use of --target works for libraries, which are placed correctly at --target <path>/lib/python/site-packages, however having the bin directory at <path>/lib/python/site-packages/bin doesn't make sense and we have to manually copy/symlink the executable scripts to <path>/bin directory. Either allowing to provide the scripts location for the --target flag (something like --target-scripts) or providing a mean to change the site-packages location (lib/pythonX.Y/, lib/python/, Lib/, etc.) for the --prefix would work for us, but at the moment we do see either alternative to the old --install-option as incomplete. In previous versions of Pip we made use of the '--install-option="--prefix=<path>" --install-option="--install-purelib=<path>/lib/python/site-packages"' flags, however newer versions don't allow to use these. And even in the old ones, that meant to disable the use of wheels and compile everything locally, which was definitely not ideal. Is this issue still being worked on or should we go ahead and try to workaround the situation locally by cp/ln of the scripts in the bin directory or even by patching Pip itself? |
In case anyone is interested, I added the --target-scripts flag with some small changes to the pip/_internal/commands/install.py file. The diff is from an older version of Pip though (20.1.1), but it should be easily adapted to the latest version.
|
If anyone is interested, I also prepared a pull request for latest version that you can find in |
A problem I ran into and why I'm interested in this option, is that we provide a python dmg containing a venv for macos built as universal binaries. We provide this to users so they can download extract the dmg, install their additional packages with pip, build a new dmg from it and distribute it as a GUI app. Because we provide it built using universal binaries, users can install their additional packages with pip natively on intel or apple silicon. One use case is for someone to run it on intel (when they don't have a M1 available, e.g. on the CI) but install with When using |
I've got the same use-case as @matham here, wanting to target armv7 with a specific python-version from automated builds. Until recently it's all gone okay, but a change in setuptools + deprecation means we need to downgrade setuptools to install one package, and doing that on build-machine to target something else felt bad, so we went for a virtualenv. Now that turned into a magnificent disaster of a debugging ride, and let's just say, I'd really want this feature to work. Any way to override the script path, as long as I can do it, would be very very good and welcome. |
Just to add another use case, I would like to install a package for different python versions (cpython 3.9 and pypy 3.9). If I install one after the other, the original scripts are overwritten. Probably not relevant to this specific bug, but another way to solve it for my case would be to add a suffix to the installed scripts (e.g. |
Description:
When I use --target option, I can specify target directory, however scripts are not inside. There is bit detailed StackOverflow question: http://stackoverflow.com/questions/26476607/how-do-you-specify-bin-directory-for-pip-install-with-target-option-enabled
It would be great if there was option to specify bin/ directory as well.
What I've run:
ipython
is installed insidepython_modules
but there is nobin/ipython
The text was updated successfully, but these errors were encountered: