Reputation: 611
I have created a package in python, and now I would like to install it as a regular package.
What is the difference between just using pip3 install .
and pip3 install -e .
?
The reason why I asked, is because with pip3 install . the package, although installed was not seen by the system. While in the second way it was working fine
Upvotes: 7
Views: 7284
Reputation: 38183
The -e
flag tells pip to install in editable mode:
-e,--editable <path/url>
Install a project in editable mode (i.e. setuptools "develop mode") from a local project path or a VCS url.
https://manpages.debian.org/stretch/python-pip/pip.1
So what is editable mode or setuptools "develop mode" ?
This command allows you to deploy your project’s source for use in one or more “staging areas” where it will be available for importing. This deployment is done in such a way that changes to the project source are immediately available in the staging area(s), without needing to run a build or install step after each change.
The develop command works by creating an .egg-link file (named for the project) in the given staging area. If the staging area is Python’s site-packages directory, it also updates an easy-install.pth file so that the project is on sys.path by default for all programs run using that Python installation.
The develop command also installs wrapper scripts in the staging area (or a separate directory, as specified) that will ensure the project’s dependencies are available on sys.path before running the project’s source scripts. And, it ensures that any missing project dependencies are available in the staging area, by downloading and installing them if necessary.
Last, but not least, the develop command invokes the build_ext -i command to ensure any C extensions in the project have been built and are up-to-date, and the egg_info command to ensure the project’s metadata is updated (so that the runtime and wrappers know what the project’s dependencies are). If you make any changes to the project’s setup script or C extensions, you should rerun the develop command against all relevant staging areas to keep the project’s scripts, metadata and extensions up-to-date.
or, tldr;
Deploy your project in “development mode”, such that it’s available on sys.path, yet can still be edited directly from its source checkout.
Upvotes: 8