question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Do not allow --target, --user, --root and --prefix together

See original GitHub issue

--target, --user, --root and --prefix are mutually exclusive and simply don’t make sense when used together. Instead of failing for irrelevant errors, the error should explicitly describe why it is not excepted. This is currently implemented in GH-7828. I move the discussion here since the PR to avoid distracting the code review process.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
hexagonrecursioncommented, Feb 17, 2021

target and root

Something is seriously wrong here since (not /tmp/foo, /tmp/bar or /tmp/bar/tmp/foo but /tmp/bar/tmp):

$ pip install --target /tmp/foo --root /tmp/bar appdirs
Collecting appdirs
  Using cached appdirs-1.4.3-py2.py3-none-any.whl (12 kB)
Installing collected packages: appdirs
Successfully installed appdirs-1.4.3
$ ls /tmp/foo
$ tree /tmp/bar
/tmp/bar
└── tmp
    └── pip-target-_apxmir1
        └── lib
            └── python
                β”œβ”€β”€ appdirs-1.4.3.dist-info
                β”‚   β”œβ”€β”€ DESCRIPTION.rst
                β”‚   β”œβ”€β”€ INSTALLER
                β”‚   β”œβ”€β”€ METADATA
                β”‚   β”œβ”€β”€ metadata.json
                β”‚   β”œβ”€β”€ RECORD
                β”‚   β”œβ”€β”€ top_level.txt
                β”‚   └── WHEEL
                β”œβ”€β”€ appdirs.py
                └── __pycache__
                    └── appdirs.cpython-37.pyc

It smells like tempfile.mkdtemp(dir=root/'tmp', prefix='pip-target-') is used as a temporary installation location and the files are never moved into target.

3reactions
pfmoorecommented, Apr 4, 2020

There are subtleties here, as @pradyunsg said. I appreciate that current behaviour is weird and likely broken in many cases, but see this xkcd comic πŸ™‚

Specific things that should be considered:

  • Users can set --user in their global config, and then they don’t have a way of switching it off. Having it ignored rather than erroring out when combined with other flags may be important to such users. This may be sufficient to want to behave differently depending on whether the flag came from config or command line, Which isn’t something we’ve ever done before, I believe.
  • Ubuntu/Debian patch pip to make --user the default. This is an even more extreme case of the previous point.
  • Some tools I believe force --root or --prefix - they are likely the main users of those flags (I don’t think end users specify them manually very often) so we’d need to understand how they expect things to work, or be prepared to react quickly if we break something for them.

That’s quite a lot of research to do.

With the new resolver work in full swing, and a release coming soon, I doubt many of the @pypa/pip-committers will have a lot of time to look at this issue in the near future. But if you were able to investigate some of the points above, and summarise your findings as you did with the current behaviour, that would help a lot when the discussion does get restarted.

Sorry if this sounds like stalling on the issue - the work you’ve put in here is genuinely appreciated, and I’d love to get this tidied up. Just not right now πŸ˜‰

Read more comments on GitHub >

github_iconTop Results From Across the Web

Combine --user with --prefix error with setup.py install
One time workaround: pip install --user --install-option="--prefix=" <package_name>. or python setup.py install --user --prefix=.
Read more >
IAM JSON policy elements: Condition operators
Describes the operators that you can use in the Condition element of the IAM JSON policy language.
Read more >
Configure the source tree - Apache HTTP Server Version 2.4
Configure for building compilers for the system type TARGET . It defaults to HOST . This option is offered by autoconf and not...
Read more >
The Buildroot user manual
Why not use the target directory as a chroot directory? ... By default, Buildroot does not support top-level parallel build, so running make...
Read more >
cmake-toolchains(7) β€” CMake 3.25.1 Documentation
For toolchains that do not support linking binaries without custom flags or ... by default in all cases, as well as looking in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found