Here’s an enhanced script which will should resolve the AmbiguousPluginError regardless of whether your openedx-platform checkout is older or newer than the setup.py -> pyproject.yaml switchover. If you’re bouncing between branches, it’ll work in either direction.
# Uninstall and clean *both* editable packages.
pip uninstall --yes Open_edX openedx-platform
rm -rf *.egg-info
# Ensure that you only have one of: setup.py, pyproject.toml.
# This will delete the file which you don't need, and keep the one you do.
git clean -f setup.py pyproject.toml
# Install just the editable package that you need:
# either Open_edX (old, setup.py) or openedx-platform (new, pyproject.toml)
pip install -e .