Bench update fails with python setup.py egg_info message

We run a multis-site ERPnext since 3 years. Now I am trying to do a bench update, but it fails. Is there an old dependency of an (uninstalled) app?

   ~/frappe-bench$ bench update
    INFO:bench.utils:updating bench
    INFO:bench.utils:git pull
    Already up-to-date.
    INFO:bench.utils:./env/bin/pip install Pillow
    Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages (3.1.1)
    INFO:bench.app:pulling frappe
    INFO:bench.utils:git pull  upstream master
    From https://github.com/frappe/frappe
     * branch            master     -> FETCH_HEAD
    Already up-to-date.
    INFO:bench.utils:find . -name "*.pyc" -delete
    INFO:bench.app:pulling erpnext
    INFO:bench.utils:git pull  upstream master
    From https://github.com/frappe/erpnext
     * branch            master     -> FETCH_HEAD
    Already up-to-date.
    INFO:bench.utils:find . -name "*.pyc" -delete
    INFO:bench.app:pulling base_vat
    INFO:bench.utils:git pull  upstream master
    From https://github.com/saguas/frappe_base_vat
     * branch            master     -> FETCH_HEAD
    Already up-to-date.
    INFO:bench.utils:find . -name "*.pyc" -delete
    Updating Python libraries...
    INFO:bench.utils:./env/bin/pip install --upgrade pip
    Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages (18.0)
    INFO:bench.utils:./env/bin/pip install -q -r /home/aaaaaa/bench-repo/requirements.txt
    INFO:bench.utils:./env/bin/pip install -q -r ./apps/frappe/requirements.txt
    INFO:bench.utils:./env/bin/pip install -q -r ./apps/base_vat/requirements.txt
    Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-8sQ3kb/frappe/

The last command without -q option is a bit more verbose: 

    pip install -q -r ./apps/base_vat/requirements.txt

    Collecting frappe (from erpnext->-r ./apps/base_vat/requirements.txt (line 1))
      Using cached https://files.pythonhosted.org/packages/4c/d3/73da0e17271031bacd2c585588026701ae5934329264db575ad989cc9ce3/frappe-2.1.4.tar.gz
        Complete output from command python setup.py egg_info:
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "/tmp/pip-install-513n3g/frappe/setup.py", line 10, in <module>
            raise LookupError("You must have test.fm >= 1.0.4 installed before (https://github.com/grafos-ml/frappe)")
        LookupError: You must have test.fm >= 1.0.4 installed before (https://github.com/grafos-ml/frappe)
    
    ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-513n3g/frappe/

This looks like another repository? How can I change that?

I tried to remove the base_vat app, which is triggering this, in several ways, also with:

    ~/frappe-bench$ ./env/bin/pip uninstall -r ./apps/base_vat/requirements.txt
    Uninstalling vatnumber-1.2:
      Would remove:
        /home/aaaaa/frappe-bench/env/lib/python2.7/site-packages/vatnumber-1.2-py2.7.egg-info
        /home/aaaaa/frappe-bench/env/lib/python2.7/site-packages/vatnumber/*
    Proceed (y/n)? y
      Successfully uninstalled vatnumber-1.2

So the app was uninstalled, but the related base_vat app is still around and causes that error. Any hint?

Continuing thread from
OSError: [Errno 2] No such file or directory: './erpnext/private/backups' - #9 by yashodhan as suggested by @yashodhan

I was only partially able to delete the base_vat app. As you see from the log above, there seems still to remain a dependency, which blocks any updates.

bench --version
4.1.0

bench version
erpnext 10.1.52
frappe 10.1.47

Fixed with
./env/bin/pip install -e ./apps/frappe
and removed base_vat from sites/apps.txt