# Buggy code
def relocate(self, dirpath):
    self.path = str(dirpath)
    self.name = os.path.basename(self.path)
    self._bin_directory = os.path.join(
        self.path, "scripts" if self._is_windows else "bin"
    )
    #
    # Pip and the interpreter will be set up when the virtualenv is created
    #
    self.interpreter = os.path.join(self._bin_directory, "python" + self._bin_extension)
    self.pip = Pip(os.path.join(self._bin_directory, "pip" + self._bin_extension))
    logger.debug("Virtual environment set up %s at %s", self.name, self.path)
    self.settings["dirpath"] = self.path


# Traceback (mu.virtual_environment.VirtualEnvironmentError)
2021-02-11 08:24:50,511 - root:172(run) INFO:

-----------------

Starting Mu 1.1.0.beta.1
2021-02-11 08:24:50,516 - root:173(run) INFO: uname_result(system='Darwin', node='Carlos-MBP-8.local', release='18.7.0', version='Darwin Kernel Version 18.7.0: Tue Jan 12 22:04:47 PST 2021; root:xnu-4903.278.56~1/RELEASE_X86_64', machine='x86_64', processor='i386')
2021-02-11 08:24:50,517 - root:174(run) INFO: Python path: ['/', '/Users/microbit-carlos/Downloads/Mu Editor.app/Contents/Resources/Python/lib/python37.zip', '/Users/microbit-carlos/Downloads/Mu Editor.app/Contents/Resources/Python/lib/python3.7', '/Users/microbit-carlos/Downloads/Mu Editor.app/Contents/Resources/Python/lib/python3.7/lib-dynload', '/Users/microbit-carlos/Downloads/Mu Editor.app/Contents/Resources/Python/lib/python3.7/site-packages', '/Users/microbit-carlos/Downloads/Mu Editor.app/Contents/Resources/Python/lib/python3.7/site-packages/setuptools-49.6.0-py3.7.egg', '/Users/microbit-carlos/Downloads/Mu Editor.app/Contents/Resources/Python/lib/python3.7/site-packages/pip-20.2.2-py3.7.egg', '/Users/microbit-carlos/Downloads/Mu Editor.app/Contents/Resources/Python/lib/python3.7/site-packages/IPython/extensions']
2021-02-11 08:24:50,517 - root:175(run) INFO: Language code: en_GB
2021-02-11 08:24:50,776 - mu.virtual_environment:371(ensure) DEBUG: Found existing virtual environment at /Users/microbit-carlos/Library/Application Support/mu/mu_venv
2021-02-11 08:24:50,776 - mu.virtual_environment:383(ensure_interpreter) ERROR: Interpreter not found where expected at /Users/microbit-carlos/Library/Application Support/mu/mu_venv/bin/python
2021-02-11 08:24:50,776 - root:106(excepthook) ERROR: Unrecoverable error
Traceback (most recent call last):
File "/Users/microbit-carlos/Downloads/Mu Editor.app/Contents/Resources/Python/lib/python3.7/site-packages/mu/app.py", line 98, in run
venv.ensure()
File "/Users/microbit-carlos/Downloads/Mu Editor.app/Contents/Resources/Python/lib/python3.7/site-packages/mu/virtual_environment.py", line 373, in ensure
self.ensure_interpreter()
File "/Users/microbit-carlos/Downloads/Mu Editor.app/Contents/Resources/Python/lib/python3.7/site-packages/mu/virtual_environment.py", line 384, in ensure_interpreter
raise VirtualEnvironmentError(message)
mu.virtual_environment.VirtualEnvironmentError: Interpreter not found where expected at /Users/microbit-carlos/Library/Application Support/mu/mu_venv/bin/python
2021-02-11 08:24:50,777 - mu.settings:169(save) DEBUG: Saving to /Users/microbit-carlos/Library/Application Support/mu/session.json
2021-02-11 08:24:50,778 - mu.settings:169(save) DEBUG: Saving to /Users/microbit-carlos/Library/Application Support/mu/venv.json
2021-02-11 08:25:06,987 - root:172(run) INFO:

-----------------

Starting Mu 1.1.0.beta.1
2021-02-11 08:25:06,987 - root:173(run) INFO: uname_result(system='Darwin', node='Carlos-MBP-8.local', release='18.7.0', version='Darwin Kernel Version 18.7.0: Tue Jan 12 22:04:47 PST 2021; root:xnu-4903.278.56~1/RELEASE_X86_64', machine='x86_64', processor='i386')
2021-02-11 08:25:06,987 - root:174(run) INFO: Python path: ['/', '/Users/microbit-carlos/Downloads/Mu Editor.app/Contents/Resources/Python/lib/python37.zip', '/Users/microbit-carlos/Downloads/Mu Editor.app/Contents/Resources/Python/lib/python3.7', '/Users/microbit-carlos/Downloads/Mu Editor.app/Contents/Resources/Python/lib/python3.7/lib-dynload', '/Users/microbit-carlos/Downloads/Mu Editor.app/Contents/Resources/Python/lib/python3.7/site-packages', '/Users/microbit-carlos/Downloads/Mu Editor.app/Contents/Resources/Python/lib/python3.7/site-packages/setuptools-49.6.0-py3.7.egg', '/Users/microbit-carlos/Downloads/Mu Editor.app/Contents/Resources/Python/lib/python3.7/site-packages/pip-20.2.2-py3.7.egg', '/Users/microbit-carlos/Downloads/Mu Editor.app/Contents/Resources/Python/lib/python3.7/site-packages/IPython/extensions']
2021-02-11 08:25:06,987 - root:175(run) INFO: Language code: en_GB
2021-02-11 08:25:07,184 - mu.virtual_environment:371(ensure) DEBUG: Found existing virtual environment at /Users/microbit-carlos/Library/Application Support/mu/mu_venv
2021-02-11 08:25:07,184 - mu.virtual_environment:383(ensure_interpreter) ERROR: Interpreter not found where expected at /Users/microbit-carlos/Library/Application Support/mu/mu_venv/bin/python
2021-02-11 08:25:07,184 - root:106(excepthook) ERROR: Unrecoverable error
Traceback (most recent call last):
File "/Users/microbit-carlos/Downloads/Mu Editor.app/Contents/Resources/Python/lib/python3.7/site-packages/mu/app.py", line 98, in run
venv.ensure()
File "/Users/microbit-carlos/Downloads/Mu Editor.app/Contents/Resources/Python/lib/python3.7/site-packages/mu/virtual_environment.py", line 373, in ensure
self.ensure_interpreter()
File "/Users/microbit-carlos/Downloads/Mu Editor.app/Contents/Resources/Python/lib/python3.7/site-packages/mu/virtual_environment.py", line 384, in ensure_interpreter
raise VirtualEnvironmentError(message)
mu.virtual_environment.VirtualEnvironmentError: Interpreter not found where expected at /Users/microbit-carlos/Library/Application Support/mu/mu_venv/bin/python
2021-02-11 08:25:07,185 - mu.settings:169(save) DEBUG: Saving to /Users/microbit-carlos/Library/Application Support/mu/session.json
2021-02-11 08:25:07,186 - mu.settings:169(save) DEBUG: Saving to /Users/microbit-carlos/Library/Application Support/mu/venv.json
2021-02-11 08:25:15,345 - root:172(run) INFO:

-----------------

# Fixed code
def relocate(self, dirpath):
    """Relocate sets up variables for, eg, the expected location and name of
    the Python and Pip binaries, but doesn't access the file system. That's
    done by code in or called from `create`
    """
    self.path = str(dirpath)
    self.name = os.path.basename(self.path)
    self._bin_directory = os.path.join(
        self.path, "scripts" if self._is_windows else "bin"
    )
    #
    # Pip and the interpreter will be set up when the virtualenv is created
    #
    self.interpreter = os.path.join(self._bin_directory, "python" + self._bin_extension)
    self.pip = Pip(os.path.join(self._bin_directory, "pip" + self._bin_extension))
    logger.debug("Virtual environment set up %s at %s", self.name, self.path)
    self.settings["dirpath"] = self.path