python install_error ai_generated true

DeprecationWarning: `setup.py develop` is deprecated. Use `pip install -e .` instead. error: invalid command 'develop'

ID: python/pip-legacy-setup-py-develop-invocation

Also available as: JSON · Markdown · 中文
80%Fix Rate
87%Confidence
0Evidence
2024-03-15First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
setuptools>=64 active — — —

Root Cause

setuptools removed the `develop` command in v64. Running `python setup.py develop` on modern setuptools fails because the command class no longer exists.

generic

中文

setuptools 在 v64 中移除了 `develop` 命令。在现代 setuptools 上运行 `python setup.py develop` 会失败,因为命令类已不存在。

Workarounds

  1. 95% success
    Use pip's editable install instead:
    
    pip install -e .
    
    This uses PEP 660 editable wheels and works with modern setuptools/hatchling/flit.
  2. 70% success
    For legacy projects that must run setup.py directly, invoke build_editable via the backend:
    
    python -m build --wheel --no-isolation
    pip install dist/mypackage-*.whl
    # or with the PEP 660 hook:
    python -c "from setuptools import build_meta; build_meta.build_editable('/tmp/out')"

Dead Ends

Common approaches that don't work:

  1. 70% fail

    Downgrading setuptools globally breaks other packages that require newer setuptools features and is not a sustainable fix.

  2. 95% fail

    The --user flag does not resurrect the removed command; the error is the same.