PIP Install ERROR: Cannot set --home and --prefix together

Viewed 581

I am not using --home or --prefix in my pip install command but this error doesn't allow a git repo to be installed.

  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      Collecting setuptools>=40.8.0
        Using cached setuptools-62.3.2-py3-none-any.whl (1.2 MB)
      Collecting wheel
        Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
      Installing collected packages: wheel, setuptools
      ERROR: Cannot set --home and --prefix together
      WARNING: You are using pip version 22.0.4; however, version 22.1 is available.
      You should consider upgrading via the 'C:\Users\Rizwan computers\AppData\Local\Programs\Python\Python310\python.exe -m pip install --upgrade pip' command.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.```
2 Answers

I had the same issue with a VS Code Dev container using Poetry to install our dependencies. Seems to be something in pip itself as reported in this issue.

I ended up removing all the lines of our .devcontainer/Dockerfile that had PIP_TARGET in them. Our setup didn't really need them so that change worked just fine.

I had the same issue on Windows 10 with Python 3.7.3 and pip 21.3.1. The issue was resolved when I removed the target from pip\pip.ini.

Related