0

When I run the following pip command:

pip3 install -r requirements.txt --upgrade --force-reinstall --ignore-installed --target target/classes/python

I got the following error:

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

What does it mean?
I'm not even using any of the options among '--user', '--prefix', '--home' or '--install*', so where does the can't combine part come from?

Dave2e
  • 22,192
  • 18
  • 42
  • 50
tribbloid
  • 4,026
  • 14
  • 64
  • 103
  • Have you checked the solutions here ? https://stackoverflow.com/questions/4495120/combine-user-with-prefix-error-with-setup-py-install – BcK Dec 23 '20 at 23:53

1 Answers1

1

Well, first: target By default will not replace existing files/folders in as per pip documentation https://pip.pypa.io/en/stable/reference/pip_install/, so you only need to use upgrade. second: Combining many commands that are not necessarily be together is not quite preferable, the 3 commands that are necessary to be combined in this command are --upgrade --no-deps --force-reinstall as per this answer on how to force reinstall in pip Can I force pip to reinstall the current version?. third: sometimes set up tools needs reinstallation so I suggest the following commands

    pip uninstall pip setuptools
    pip install pip setuptools 
    pip3 install --upgrade --no-deps --force-reinstall <packagename>
    pip3 install -r requirements.txt