In Databricks, I had installed Databricks dlt library from here using the command pip install databricks-dlt. But now when I try to uninstall using the command pip uninstall databricks-dlt, I get the following error. How can I uninstall this library:
PipError: Command 'pip --disable-pip-version-check uninstall databricks-dlt' returned non-zero exit status 2.
Error Details:
Found existing installation: databricks-dlt 0.3.0
Uninstalling databricks-dlt-0.3.0:
Would remove:
/local_disk0/.ephemeral_nfs/envs/pythonEnv-c872873f-ebba-4c11-8d9a-eeff12cab0bb/lib/python3.12/site-packages/databricks_dlt-0.3.0.dist-info/*
/local_disk0/.ephemeral_nfs/envs/pythonEnv-c872873f-ebba-4c11-8d9a-eeff12cab0bb/lib/python3.12/site-packages/dlt/*
ERROR: Exception:
Traceback (most recent call last):
File "/local_disk0/.ephemeral_nfs/envs/pythonEnv-c872873f-ebba-4c11-8d9a-eeff12cab0bb/lib/python3.12/site-packages/pip/_internal/cli/base_command.py", line 106, in _run_wrapper
status = _inner_run()
^^^^^^^^^^^^
File "/local_disk0/.ephemeral_nfs/envs/pythonEnv-c872873f-ebba-4c11-8d9a-eeff12cab0bb/lib/python3.12/site-packages/pip/_internal/cli/base_command.py", line 97, in _inner_run
return self.run(options, args)
^^^^^^^^^^^^^^^^^^^^^^^
File "/local_disk0/.ephemeral_nfs/envs/pythonEnv-c872873f-ebba-4c11-8d9a-eeff12cab0bb/lib/python3.12/site-packages/pip/_internal/commands/uninstall.py", line 106, in run
uninstall_pathset = req.uninstall(
^^^^^^^^^^^^^^
File "/local_disk0/.ephemeral_nfs/envs/pythonEnv-c872873f-ebba-4c11-8d9a-eeff12cab0bb/lib/python3.12/site-packages/pip/_internal/req/req_install.py", line 723, in uninstall
uninstalled_pathset.remove(auto_confirm, verbose)
File "/local_disk0/.ephemeral_nfs/envs/pythonEnv-c872873f-ebba-4c11-8d9a-eeff12cab0bb/lib/python3.12/site-packages/pip/_internal/req/req_uninstall.py", line 364, in remove
if auto_confirm or self._allowed_to_proceed(verbose):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/local_disk0/.ephemeral_nfs/envs/pythonEnv-c872873f-ebba-4c11-8d9a-eeff12cab0bb/lib/python3.12/site-packages/pip/_internal/req/req_uninstall.py", line 404, in _allowed_to_proceed
return ask("Proceed (Y/n)? ", ("y", "n", "")) != "n"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/local_disk0/.ephemeral_nfs/envs/pythonEnv-c872873f-ebba-4c11-8d9a-eeff12cab0bb/lib/python3.12/site-packages/pip/_internal/utils/misc.py", line 228, in ask
_check_no_input(message)
File "/local_disk0/.ephemeral_nfs/envs/pythonEnv-c872873f-ebba-4c11-8d9a-eeff12cab0bb/lib/python3.12/site-packages/pip/_internal/utils/misc.py", line 220, in _check_no_input
raise Exception(
Exception: No input was expected ($PIP_NO_INPUT set); question: Proceed (Y/n)?
By default Databricks disables all prompts for user input by pip package manager, so if there is a need of user input from user it fails automatically.
This is defined by variable PIP_NO_INPUT.
You can also check the value of this variable is set as 1 in Databricks
print(os.environ.get("PIP_NO_INPUT"))
#prints 1
As a solution you can run pip in non-interactive mode like below :
%pip uninstall -y databricks-dlt
Ref : ( similar answer )
I tested this in Databricks and it got uninstalled