pip install --editable cause running develop, error in 'egg_base' option: 'src' does not exist
The location of the setup.cfg
and setup.py
files are the problem here.
Depending on experiences with another project out of habit I located them in the src
folder.
hyperorg
├── src
│ ├── hyperorg
│ │ └── ...
│ ├── setup.cfg
│ └── setup.py
This can work in some circumstances but the official setuptools documentation about usage of setup.cfg
also state to locate that files in the project root like this.
hyperorg
├── src
│ └── ...
├── setup.cfg
└── setup.py
In that case my setup work like a charm without modifying any other files. I just have to do in the project root
pip3 install --editable .
The string develop
in the error output points to a Development Mode of setuptools
. This is because of the --editable
option in the pip
call. The effect of Development Mode is that the package is not installed the usual way via coping the py files in the right directories of the system but just links to the source folders are created.
EDIT: This answer is still valid. But keep in mind that today the recommendation is to use a pyproject.toml
file instead of setup.cfg
. The details can be found in the setuptools
docu.
Breaking 'pip install' to smaller steps, so I can edit the package before it is installed
Modern pip (Since 1.10)
Use pip download
:
pip download mypackage
pip 1.5 - 1.9
Use pip install -d
pip install -d . --allow-external netifaces --allow-unverified netifaces netifaces
tar xzf netifaces-0.8.tar.gz # Unpack the downloaded file.
cd netifaces-0.8
Now do your modifications and continue:
pip install .
Old pip (Before 1.5)
Install the package with
--no-install
option; with--no-install
option, pip downloads and unpacks all packages, but does not actually install the package.pip install --no-install netifaces
Change to the build directory. If you don't know where is the build directory, issue above command again, then it display the location.
cd /tmp/pip_build_falsetru/netifaces
Do the custom modification.
Install the package using
pip install .
(add --no-clean option if you want keep the build directory) orpython setup.py install
.sudo pip install --no-clean .
Related Topics
How to Plot Multiple Functions on the Same Figure, in Matplotlib
Could Pandas Use Column as Index
How to Change Values in a Tuple
Format Floats with Standard JSON Module
Django Upgrading to 1.9 Error "Appregistrynotready: Apps Aren't Loaded Yet."
Pandas: To_Numeric for Multiple Columns
Python Pip Install Module Is Not Found. How to Link Python to Pip Location
How to Find Char in String and Get All the Indexes
Inserting Line at Specified Position of a Text File
Python: How to Get Stdout After Running Os.System
How to Make a For-Loop Pyramid More Concise in Python
How to Generate a Random Number with a Specific Amount of Digits
Virtualenv --No-Site-Packages and Pip Still Finding Global Packages
Index of Duplicates Items in a Python List