17

When I install a local python package with pip 21.1 (pip install .)I get a deprecation warning:

 DEPRECATION: A future pip version will change local packages to be built in-place without first copying to a temporary directory. We recommend you use --use-feature=in-tree-build to test your packages with this new behavior before it becomes the default.
   pip 21.3 will remove support for this functionality. You can find discussion regarding this at https://github.com/pypa/pip/issues/7555.

I do not understand what what means. Also, how can I fix it?

Alex
  • 41,580
  • 88
  • 260
  • 469

2 Answers2

9

In short, my understanding:

  • pip builds a tree of dependencies between packages.
  • currently pip requires a temporary folder
  • this leads sometimes to issues, especially if relative paths are involved, see here.

To fix this and additional issues. they will change the behaviour of pip install. So to test if that will affect you in any way you can test it before by using --use-feature=in-tree-build as described by @Jason Harrison.

As mentioned in the warning there is a github discussion which explains it in much more detail here.

Andreas
  • 8,694
  • 3
  • 14
  • 38
  • So no action required from my side. It is just an internal change, not visible to the user? – Alex Apr 28 '21 at 14:17
  • 1
    If anyone has infromation otherwise, please let us know, but as far as i understand it, yes you are right. In case you want to be super sure e.g. for production, use the `--use-feature=in-tree-build` for your packages. – Andreas Apr 28 '21 at 14:21
  • You can add `use-feature = in-tree-build` to the `[install]` section of your [`~/.configs/pip/pip.conf` file](https://pip.pypa.io/en/stable/topics/configuration/). Not sure if this has any bad consequences, but has worked for me. – mforbes Jan 27 '22 at 18:37
8

While the answer by @andreas links to the discussions and answers the question. The way to use the flag is to include it after the target:

pip install . --use-feature=in-tree-build

This is the "same" as using the --editable flag: the source of the package is used as the source of the installation without any copies being made. This is extra useful when your working copy of the repository has large extra debugging or binary files lying around that would need to be copied to a temporary location.

Jason Harrison
  • 922
  • 9
  • 27