Pip: Should we print an error if --user and --target are used together?

Created on 21 Oct 2019  ·  3Comments  ·  Source: pypa/pip

I wonder why we aren't also throwing if --target is provided.

No clue. Filing a new issue to track someone figuring this out. :)

_Originally posted by @chrahunt in https://github.com/pypa/pip/pull/7002_

target user scheme awaiting PR auto-locked enhancement

Most helpful comment

This seems pretty straightforward, so changing status.

All 3 comments

If I try passing both, I get an error from distutils. It's pretty clear, so maybe this is why it's not checked in pip, but maybe it still makes sense to check it and fail faster.

$ pip install --user --target test-tgt/  astcheck
Collecting astcheck
  Using cached https://files.pythonhosted.org/packages/8d/a7/23752054ffc65eca77b2137f88c3b4b8d196112b5e13e9536f194ab67756/astcheck-0.2.5-py2.py3-none-any.whl
Installing collected packages: astcheck
Exception:
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 179, in main
    status = self.run(options, args)
  File "/usr/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 421, in run
    strip_file_prefix=options.strip_file_prefix,
  File "/usr/lib/python3.7/site-packages/pip/_internal/req/__init__.py", line 57, in install_given_reqs
    **kwargs
  File "/usr/lib/python3.7/site-packages/pip/_internal/req/req_install.py", line 917, in install
    strip_file_prefix=strip_file_prefix,
  File "/usr/lib/python3.7/site-packages/pip/_internal/req/req_install.py", line 447, in move_wheel_files
    strip_file_prefix=strip_file_prefix,
  File "/usr/lib/python3.7/site-packages/pip/_internal/wheel.py", line 326, in move_wheel_files
    prefix=prefix,
  File "/usr/lib/python3.7/site-packages/pip/_internal/locations.py", line 180, in distutils_scheme
    i.finalize_options()
  File "/usr/lib64/python3.7/distutils/command/install.py", line 252, in finalize_options
    raise DistutilsOptionError("can't combine user with prefix, "
distutils.errors.DistutilsOptionError: can't combine user with prefix, exec_prefix/home, or install_(plat)base

This seems pretty straightforward, so changing status.

@pradyunsg I am on it. :+1:

Was this page helpful?
0 / 5 - 0 ratings