Visitar URL original
Include pip in path · Issue #121 · python/pymanager · GitHub
Skip to content

Include pip in path #121

Description

@KevinBrogan

Currently after installation, the pip command is not available on the command line.

Having the option while installing to include the scripts directory as part of the path, or some other method which includes pip, would be useful to avoid having to to it manually.

Activity

  1. zooba commented on May 27, 2025

    @zooba
    Member

    Unfortunately, there is no "scripts" directory here. There's a global commands directory that Python runtimes are added to, but pip/etc. don't use (and it probably shouldn't, since it'd just make a mess), and no PATH modifications per-install (or we get back into the unreliable mess that the install manager gets us away from).

    Use py -m pip to launch pip. It also works for most other commands, and if it doesn't, report to the tool and they should be able to enable it easily. Or create a virtual environment and activate it, then you'll get its Scripts directory on PATH for your session, which is infinitely more robust than modifying settings permanently.


    That said, this is sure to be a popular request, so I'm going to pin this issue so people can see the explanation. And if someone comes up with a brilliant idea on how to make it work, we're open to it, but automatically modifying PATH isn't it.

  2. added
    wontfixThis will not be worked on
    and removed
    enhancementNew feature or request
    on May 27, 2025
  3. pinned this issue on May 27, 2025
  4. ykqmain commented on Jul 14, 2025

    @ykqmain

    I am very excited to try Python Install Manager on Windows. Everything is ready, I installed Python 3.14, and when I tried to use pip, the Terminal reported an error. How frustrating, there were no prompts during the initialization process. Although there are a thousand reasons for the absence of pip, I just want to ask one question: If pip cannot be used conveniently, then why go to the trouble of using Python Install Manager?

    Version management for Python on Linux and macOS has a lot of options, I believe their pip solution is worth referencing.

  5. pfmoore commented on Jul 14, 2025

    @pfmoore
    Member

    py -m pip should invoke pip. Does it not?

  6. ykqmain commented on Jul 15, 2025

    @ykqmain

    py -m pip should invoke pip. Does it not?

    This command should be permanently displayed on the Usage page and consider adding an Alias, like this Issue #140

  7. zooba commented on Jul 28, 2025

    @zooba
    Member

    This command should be permanently displayed on the Usage page

    Which Usage page do you mean? Which pages did you see that would have helped you know this command?

  8. kaecy commented on Nov 1, 2025

    @kaecy

    You can perform an upgrade if there is one python -m pip install --upgrade pip or install enable-pip python -m pip enable-pip, either one will do. They both add the missing executables to the scripts folder in your python installation.

    Don't forget to add the scripts folder (%localappdata%\Python\pythoncore-3.14-64\scripts) to your PATH afterwards and close and then open any open terminals.

  9. akrymskiy commented on Nov 20, 2025

    @akrymskiy

    Ironically pip installs "pip.exe, pip3.14.exe and pip3.exe" into Scripts, which are very similar to what Python Install Manager is doing to python executable itself with "python.exe, python3.14.exe and python3.exe" - if only there was a way for the bin and scripts to work in unison...

    I feel like since there is a "default installed version, which will be the latest stable release unless configured otherwise" - there should be a way to expose and manage the Scripts associated with it, otherwise it feels like Python Install Manager basically deprecates the entire Scripts functionality, whereas most users expect it and it works this way on majority of non-Windows systems.

    I think there could be an elegant way to expose the Scripts similarly to what is done with bin, but perhaps by way of soft-linking the Scripts on the same level with bin, controlled by some new setting/env var such as PYTHON_MANAGER_EXPOSE_SCRIPTS for example...

    In the screenshot below I created a symlink to the Scripts for the currently default Python - and than add that symlinked dir to PATH.

    If Python Install Manager could maintain that symlink to always point to the same prefix path as in python.exe.target - that would totally solve this for me, as Scripts would automatically follow whatever the selected default python is.

    Image Image
  10. zooba commented on Nov 20, 2025

    @zooba
    Member

    We have to manage without symlinks, unfortunately. And linking a directory isn't something we can make reliable in the same way that the default Python is calculated, though we could potentially add a scan for entry points in all discovered Python runtimes and generate new script executors for them ourselves. Unfortunately, we can't automatically do that after a package install, unless pip/etc. learn to trigger a pymanager install --refresh command after install (which they could... @pfmoore thoughts?)

    Ultimately, the best workaround here is to use a virtual environment. py -m venv ... is the only way to create one already, and once activated, you'll have Scripts on PATH for your session.

  11. pfmoore commented on Nov 20, 2025

    @pfmoore
    Member

    I don't think it's reasonable to tie pip (and every other installation tool that might exist) to the pymanager command like this. Maybe if there was a core API in the stdlib that tools could call, installers could use that? But I don't know how we could have such an API without requiring distributors who didn't use the pymanager installer to patch the stdlib. Ultimately someone has to answer the question "is this environment one that requires something to be done whenever a new script is installed?" and the only sustainable way to have that work is if the stdlib (or more precisely, the python installation present in the environment) offers an API to answer that question (and do whatever needs to be done).

    I do agree with the @akrymskiy here that by adding the python command to the user's path, we're setting expectations that the experience will be the same as the old "add Python to PATH" option - and in particular that the Scripts directory will be available as well. We can blame OS limitations as much as we like, but the reality is that users who add python to their path are getting reduced functionality compared to the old installer. Ultimately, we made a choice to remove functionality that a lot of users found useful, in order to avoid some rare but difficult to deal with problems (the "unreliable mess" you refer to above, which frankly isn't something that most users ever noticed). We can debate whether that was a good choice, but I don't think we can claim that we didn't make that choice. Microsoft didn't force us to use the newer MSIX install format, we did so aware of its benefits and its limitations.

    Presumably the user can simply add the interpreter's Scripts directory to their PATH manually? Maybe we can provide some sort of utility or stdlib function that makes it easier to discover and use this option? Or maybe pymanager install could print a reminder that the new installation's Scripts directory isn't on PATH by default, and describe how to add it if the user wishes to?

  12. zooba commented on Nov 20, 2025

    @zooba
    Member

    Presumably the user can simply add the interpreter's Scripts directory to their PATH manually? Maybe we can provide some sort of utility or stdlib function that makes it easier to discover and use this option?

    Yes, and pip already prints a message saying to do this. Apparently, this is for people who haven't gotten as far as running pip.

    I don't think we can reasonably print more messages from PyManager and expect users to read them - it's just covering ourselves so we can say "it was there, in the middle of seven pages of output, so it's not our fault", which I'd rather not get into.

    Plus, there's no intrinsic requirement that a runtime have a Scripts directory (there's none built into the CPython packages, since it would only include a broken pip.exe, so we can't detect that it's there after install). We'd need some way to signal that a particular runtime should print that message, and resolve that in the context of multiple simultaneous installs.

    I'm leaning more towards the "scan all known runtimes for entry point specs and generate them ourselves". It would only be on runtime install/refresh, but that would at least include the initial install and would get a usable pip.exe created (which I'm sure will upset people who don't expect it to appear on their PATH, and no doubt we'll get security reports when other packages start showing up on PATH, but if the demand is strong enough then we can argue those away, and it's all opt-in to begin with anyway). When a new script is installed, users will just have to run py install --refresh if the installers are not going to run it for them.

  13. pfmoore commented on Nov 20, 2025

    @pfmoore
    Member

    That sounds reasonable. I think we should be very careful here to ensure that whatever we do design is based on what users actually want, rather than what we think they want. And it's notoriously hard to get a representative view of that 🙁

    IMO, there are going to be three key groups of users who we'll need to consider:

    1. People who don't want anything beyond py on their path. They are easy to deal with, we do nothing and we're fine.
    2. People who want python and pythonX.Y on their path, but don't want a bunch of script entry points (of which pip is only one). These people are happy now, and if we start adding script entry points, they could be annoyed. This will also likely include the group who will have security concerns if installing a Python module can end up shadowing an existing command. Again, we can do nothing, because it's current behaviour.
    3. People who want the same behaviour as the old installer, with python and pip commands available. My guess is that this group will include a huge number of people who only ever need a single Python version, and don't really care about the complexities of PATH but just want "the normal Python commands" to be available everywhere. This is likely to be the group that's least able to handle managing PATH for themselves. Adding some way for this group to get what they want is the important point here, but IMO we shouldn't do so in a way that removes the behaviour group (2) prefers.

    That means we should make "add entry point executables" opt-in, above and beyond the existing "add the python command to your path" option. I think we need to avoid having a million different options here, but the three above are all plausible, and we should support them (just no more than this!)

    There's also a bunch of technical issues around how all of this would work for users who have multiple versions of Python installed, or who switch Python version frequently, or who add the aliases for one specific use case and forget to disable them afterwards, etc. But IMO we can make reasonable technical choices on those questions without getting bogged down in "what do people want" questions - there's no strong precedent from the old installers to worry about, and the people doing things like this are technically aware enough to work with whatever we choose (as long as we document things clearly, of course 🙂).

    It's worth noting that the layout of the base Python environment is what results in there being 3 options here. The base executable is in sys.prefix, and entry points are in sysconfig.get_path("scripts"). The options basically cover which of these you add to your path (none, one or both) if you were managing executables manually. We (the core team, via the design of distutils) chose to have two locations, so we should be prepared to deal with the consequences of that.

  14. 4 remaining items

  15. zooba commented on Nov 20, 2025

    @zooba
    Member

    1 and 2 are currently available to see - make sure you don't have the directory in PATH and run py install --configure. If you choose to add the directory, you get 2, if you choose not to, you get 1.

    I'm proposing that those become 1 and 3, and those who want 2 (pythonX.Y.exe shortcuts without pipX.Y.exe etc. shortcuts) have to also put something like {"install": {"disable_shortcut_kinds": ["site-dir"]}} into their config file. And obviously that magic setting gets documented somewhere, but I don't think we have to add UX somewhere for it.

  16. zooba commented on Nov 20, 2025

    @zooba
    Member

    We don't actually have a reliable mechanism to generate the X.Y versions of these shortcuts, but the entry points spec doesn't appear to require it anyway, so that'll simplify things nicely (apart from hiding which version of Python it's running in, but that's been a problem forever and we already have numerous ways to avoid that issue).

  17. akrymskiy commented on Nov 24, 2025

    @akrymskiy

    We have to manage without symlinks, unfortunately.
    I am curious as to why no symlinks? Is it due to the admin requirement? Could directory junctions be used instead as they don't require elevation?

  18. zooba commented on Nov 24, 2025

    @zooba
    Member

    Yeah, it's the admin requirement/security risks. Junctions I think will be locked if any processes within the directory are running, which means that updating it would fail frequently.

    As I've said above, the intended way to make a runtime "active" is to activate a venv. We went through the discussion process some years ago about not relying on this, and everyone involved wanted it this way, so it's what we have. Anyone who installs something with commands without adding the particular install path to their PATH will get a message from pip telling them what path to add, which leaves only pip itself, which has recommended py -m pip for years already.

    I expect I'll eventually get the entry points work working, hopefully without hurting install/refresh performance too much, and we'll be able to see how much that changes things. But there's only one case right now that's entirely uncovered, which is pip itself.

  19. added a commit that references this issue on Dec 9, 2025
    e4a4451
  20. segevfiner commented on Dec 18, 2025

    @segevfiner

    I wonder if we just want messages about this from pymanager and commands to add/remove the installation directory of one of the installed runtimes to the PATH. This is for the time being until/when pymanager might decide to extend pip or something so it also creates shim in the global shortcuts directory of pymanager.

  21. minerharry commented on Dec 21, 2025

    @minerharry

    Agreed. Specifically, if the install manager has the authority and capability to change where the python command points to, then every time that changes it should make it as easy as possible for the user to switch scripts and similar hangers-on to the old python. Ideally, of course, this would be automated - is it possible for the program to modify path itself? or open a prompt for the user to do so?

    To that end, why aren't symlinks in the cards? since there's a single python file which is managed by the installer to point at the proper executable, a single folder would also be great. I know it's more complicated to point to something dynamic but it really feels like the solution

  22. op200 commented on Sep 1, 2026

    @op200

    I suggest automatically adding the Scripts directory of the default Python runtime to PATH, similar to what the standalone installer does.

    This would provide a more familiar and user-friendly experience, especially for new users who may not know how to configure PATH manually. With Python 3.16 and later, new users will have to use the Python Install Manager, so I think the user experience for newcomers should be given even more consideration.

    At the same time, users who understand how PATH works would still be able to manage it themselves.

    I don't think this would introduce significant environment conflicts, because only the Scripts directory of the current default Python runtime would be added. Whenever the default Python version changes, the new Scripts directory could be added with higher priority than the existing entries. This means that even if the previous Scripts directories are not removed, the one corresponding to the current default Python would always take precedence.

    This would also be consistent with the behavior of the legacy standalone installer. While automatically adding the Scripts directory to PATH may not be a better solution in every respect, I don't think it would put users in a worse situation either. Since this behavior already existed in the standalone installer and provided a familiar out-of-the-box experience, I believe it would be reasonable to restore it in the Python Install Manager.

    @zooba

  23. zooba commented on Sep 1, 2026

    @zooba
    Member

    It's a great suggestion, but it's also not viable, manageable, or safe. As soon as you have multiple installed runtimes, you'll have conflicts, and we're not able to manage those reliably from a program that is not a full GUI editor for the environment variable. It's absolutely a worse situation for everyone except those who want to manage PATH themselves (plenty of people know how and still don't want to, and they also suffer from randomly shifting alias resolution).

    Adding a global scripts path is unfortunately one of those designs that turned out to be a mistake, and we're doing the best we can to stop making that mistake. The previous installers copied it from earlier versions, but we made the decision to stop it this time around.

    Creating and activating a virtual environment is the recommended way to get a runtime-specific Scripts directory on PATH. Alternatively, using a single global directory with properly ordered scripts (such as was introduced with the PR attached to this issue) is also possible.

    Adding a bunch of semi-randomly ordered paths into a user configurable OS setting is not a good answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions