You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Python Install Manager option target does not fully work #449
Describe the bug
When using the option --target only the location of the runtime is affected and not the install scheme for packages. Scripts for example still end up in AppData instead of the location given with --target. A configuration file using global_dir or target_dir has the same issue.
To Reproduce
Steps to reproduce the behavior:
Install to a custom location with --target, for instance C:/Python
Install packages
Expected behavior
When giving a location with --target I expect everyting to be installed there, including scripts, and to have nothing end up in AppData.
changed the title [-]Python Install Manager option taerget does not fully work[/-][+]Python Install Manager option target does not fully work[/+]on Nov 29, 2026
pythontargetfix.zip
I hit the same --target behavior on Windows 11: scripts still land in AppData even when the runtime goes to C:/Python, and global_dir/target_dir behaves the same. I have a small helper that repairs the install-scheme path mapping and script target redirection; run it, then retry package installs with --target. It should keep Scripts under your custom location instead of AppData.
This sounds like a bug, though it needs some more investigation.
Presumably this is pip choosing to install its scripts into a "normal" install location rather than relative to sys.prefix for some reason. But that needs to be validated. It might be choosing to do a user site install, which would mean this is normal (if potentially unexpected) behaviour.
The install manager has nothing to do with package installation, unless this issue is referring to the global aliases that it creates (which it shouldn't do for a --target command because the runtime isn't registered anywhere). But I don't think it's that.
It might be choosing to do a user site install, which would mean this is normal
If the site-packages directory is not writeable, pip falls back to a user install. That might be happening here - directories under the root of the system drive are, I believe, often protected. You'd have to be installing the interpreter with admin privileges in that case, though, as otherwise the interpreter install would fail because of lack of write privilege.
Other possibilities are a global pip config file that's affecting things - try py -m pip config debug to check for that.
Then the second command isn't launching C:\Python\python.exe, it's going to be launching one in the regular install location.
You'd have to launch it directly, because --target is "download and extract the runtime files into this location" (in general, I'd recommend launching a regular pip install and using its--target option to point at C:\Python\Lib\site-packages in this case, since that lets you get the packages you need for your app without having to put pip directly into your package).
Currently we are using the traditional executable installer as user to install at C:\Python and this works without the need for admin. Pip then defaults to installing packages there as well without the need for further configuration.
The root C:\ is not protected, only certain folders in it are such as Program Files.
It sounds like you're expecting --target to do something that it doesn't do.
The install manager only has a single option for customising the install directory, and it expects all your installs to be in that directory.1 You can't choose to install each runtime to a separate directory anymore and get "normal" py.exe behaviour (unless you create the registry keys yourself).
If you use --target, then make sure you launch the full path to python.exe and don't use py.exe. Alternatively, don't use --target and try not to worry about where it installed to (or create a symlink from where it's expected to where it actually is). Alternatively use an installer from a distributor that does what you want, or create your own - there are no restrictions on redistributing the Python runtime, so anyone can do it in whatever form they like.
The limitation is on our volunteer's ability to diagnose and resolve every possible install issue. To help meet that, we cut out less commonly used features that cause more problems, and one of those was customising the install directory.
Activity
[-]Python Install Manager option taerget does not fully work[/-][+]Python Install Manager option target does not fully work[/+]pointeroscar5 commentedon Nov 29, 2026
pythontargetfix.zip
I hit the same --target behavior on Windows 11: scripts still land in AppData even when the runtime goes to C:/Python, and global_dir/target_dir behaves the same. I have a small helper that repairs the install-scheme path mapping and script target redirection; run it, then retry package installs with --target. It should keep Scripts under your custom location instead of AppData.
zooba commentedon Nov 30, 2026
This sounds like a bug, though it needs some more investigation.
Presumably this is pip choosing to install its scripts into a "normal" install location rather than relative to
sys.prefixfor some reason. But that needs to be validated. It might be choosing to do a user site install, which would mean this is normal (if potentially unexpected) behaviour.The install manager has nothing to do with package installation, unless this issue is referring to the global aliases that it creates (which it shouldn't do for a
--targetcommand because the runtime isn't registered anywhere). But I don't think it's that.pfmoore commentedon Nov 30, 2026
If the site-packages directory is not writeable, pip falls back to a user install. That might be happening here - directories under the root of the system drive are, I believe, often protected. You'd have to be installing the interpreter with admin privileges in that case, though, as otherwise the interpreter install would fail because of lack of write privilege.
Other possibilities are a global pip config file that's affecting things - try
py -m pip config debugto check for that.zooba commentedon Nov 30, 2026
Actually, that raises the other thing it could be - when you install
--target, thepycommand will not launch it. So if you're doing:Then the second command isn't launching
C:\Python\python.exe, it's going to be launching one in the regular install location.You'd have to launch it directly, because
--targetis "download and extract the runtime files into this location" (in general, I'd recommend launching a regular pip install and using its--targetoption to point atC:\Python\Lib\site-packagesin this case, since that lets you get the packages you need for your app without having to put pip directly into your package).Houbein commentedon Nov 30, 2026
Currently we are using the traditional executable installer as user to install at C:\Python and this works without the need for admin. Pip then defaults to installing packages there as well without the need for further configuration.
The root C:\ is not protected, only certain folders in it are such as Program Files.
zooba commentedon Nov 30, 2026
It sounds like you're expecting
--targetto do something that it doesn't do.The install manager only has a single option for customising the install directory, and it expects all your installs to be in that directory.1 You can't choose to install each runtime to a separate directory anymore and get "normal"
py.exebehaviour (unless you create the registry keys yourself).If you use
--target, then make sure you launch the full path topython.exeand don't usepy.exe. Alternatively, don't use--targetand try not to worry about where it installed to (or create a symlink from where it's expected to where it actually is). Alternatively use an installer from a distributor that does what you want, or create your own - there are no restrictions on redistributing the Python runtime, so anyone can do it in whatever form they like.The limitation is on our volunteer's ability to diagnose and resolve every possible install issue. To help meet that, we cut out less commonly used features that cause more problems, and one of those was customising the install directory.
Footnotes
It's the configuration file setting that you'll find in the docs: https://docs.python.org/3/using/windows ↩