Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"can't combine user with prefix" trying to create zip package for function with dependencies

I am trying to make a deployment package with additional dependencies as per this guide https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html

I am doing this as a test, to see how simple it is. So i decided to try and import the first package that popped into my mind which was tldextract.

The guide tells me to make a fir called package, go into that package and then type "pip3 install tldextract --target ."

However, I get an error message: distutils.errors.DistutilsOptionError: can't combine user with prefix, exec_prefix/home, or install_(plat)base

I have searched through this: Combine --user with --prefix error with setup.py install But to no avail.

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```
like image 301
rlou Avatar asked Aug 31 '25 10:08

rlou


1 Answers

You may have moved passed this, but just in case it helps (this drove me up a wall for the last half hour):

I'm running Debian and was trying to install pymysql, but try issuing the command with sudo:

 sudo pip3 install tldextract --target .

I don't know why this worked yet, but will update with more info if I come across any. Files were installed in my local directory owned by root, which is unfortunate, but chown fixed that.

like image 153
Jon Sampson Avatar answered Sep 03 '25 02:09

Jon Sampson