pip: --target does not work with --user

On Ubuntu 16.04, pip 8.1.1, --user is default, and --target does not work. Is there any reason to not just have an explicit command line argument --target override implicit --user? Needed for a setup-requires shim.

  File "/usr/lib/python2.7/distutils/command/install.py", line 289, in finalize_options
    raise DistutilsOptionError("can't combine user with prefix, "
DistutilsOptionError: can't combine user with prefix, exec_prefix/home, or install_(plat)base

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 8
  • Comments: 15 (9 by maintainers)

Commits related to this issue

Most upvoted comments

What is the workaround? I want target to take precedence and ignore any other inputs. Hmm. pip install -r requirements.txt -t lib/ – OK, found the workaround. It’s adding --system so pip install -r requirements.txt --system -t lib/ thx!

Got bitten by this today (Debian 9), officially Debian mentions #1668 as reason of applying this patch. The official work-around is to use the --system parameter to disable --user, but that will break whenever Debian’s pip3 is not used. 😡

well, its more of an ubuntu bug, they blindly patch things and then the world breaks ^^

I am having the same issue on Ubuntu 18.04.1 LTS, but it is working with --system flag.

master└─ $ cat /etc/issue
Ubuntu 18.04.1 LTS \n \l
master└─ $ uname -a
Linux 4.15.0-43-generic #46-Ubuntu SMP Thu Dec 6 14:45:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

requirements:

master└─ $ cat requirements-lambda.txt 
logger==1.4
requests==2.18.4
slackclient==1.2.1
elasticsearch==6.0.0
kafka==1.3.5

Exception:

sent 320,716 bytes  received 435 bytes  642,302.00 bytes/sec
total size is 319,089  speedup is 0.99
Collecting logger==1.4 (from -r requirements-lambda.txt (line 1))
Collecting requests==2.18.4 (from -r requirements-lambda.txt (line 2))
  Using cached https://files.pythonhosted.org/packages/49/df/50aa1999ab9bde74656c2919d9c0c085fd2b3775fd3eca826012bef76d8c/requests-2.18.4-py2.py3-none-any.whl
Collecting slackclient==1.2.1 (from -r requirements-lambda.txt (line 3))
Collecting elasticsearch==6.0.0 (from -r requirements-lambda.txt (line 4))
  Using cached https://files.pythonhosted.org/packages/7a/06/4138270b44512484b3ddda7ff4a38e150cfc17a63ef3b2fa7e8c0b18029d/elasticsearch-6.0.0-py2.py3-none-any.whl
Collecting kafka==1.3.5 (from -r requirements-lambda.txt (line 5))
  Using cached https://files.pythonhosted.org/packages/21/71/73286e748ac5045b6a669c2fe44b03ac4c5d3d2af9291c4c6fc76438a9a9/kafka-1.3.5-py2.py3-none-any.whl
Collecting idna<2.7,>=2.5 (from requests==2.18.4->-r requirements-lambda.txt (line 2))
  Using cached https://files.pythonhosted.org/packages/27/cc/6dd9a3869f15c2edfab863b992838277279ce92663d334df9ecf5106f5c6/idna-2.6-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests==2.18.4->-r requirements-lambda.txt (line 2))
  Using cached https://files.pythonhosted.org/packages/9f/e0/accfc1b56b57e9750eba272e24c4dddeac86852c2bebd1236674d7887e8a/certifi-2018.11.29-py2.py3-none-any.whl
Collecting urllib3<1.23,>=1.21.1 (from requests==2.18.4->-r requirements-lambda.txt (line 2))
  Using cached https://files.pythonhosted.org/packages/63/cb/6965947c13a94236f6d4b8223e21beb4d576dc72e8130bd7880f600839b8/urllib3-1.22-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests==2.18.4->-r requirements-lambda.txt (line 2))
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting websocket-client<1.0a0,>=0.35 (from slackclient==1.2.1->-r requirements-lambda.txt (line 3))
  Using cached https://files.pythonhosted.org/packages/26/2d/f749a5c82f6192d77ed061a38e02001afcba55fe8477336d26a950ab17ce/websocket_client-0.54.0-py2.py3-none-any.whl
Collecting six<2.0a0,>=1.10 (from slackclient==1.2.1->-r requirements-lambda.txt (line 3))
  Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Installing collected packages: logger, idna, certifi, urllib3, chardet, requests, six, websocket-client, slackclient, elasticsearch, kafka
Exception:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 360, in run
    prefix=options.prefix_path,
  File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/usr/lib/python3/dist-packages/pip/wheel.py", line 247, in move_wheel_files
    prefix=prefix,
  File "/usr/lib/python3/dist-packages/pip/locations.py", line 153, in distutils_scheme
    i.finalize_options()
  File "/usr/lib/python3.6/distutils/command/install.py", line 274, 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

Yea, I told Debian/Ubuntu not to apply said patch until we got all the issues worked out with it, they didn’t want to wait on that. You’ll need to raise the issue with them since their patch is causing the issue.

@dholth could you link to the issue on debian?