DevOps

Fix pip uninstall databricks-dlt PIP_NO_INPUT Error

Resolve pip uninstall error for databricks-dlt in Databricks: 'No input was expected ($PIP_NO_INPUT set)'. Use %pip uninstall -y databricks-dlt, restart Python with dbutils.library.restartPython(), and handle cluster libraries.

1 answer 4 views

How to resolve pip uninstall error for databricks-dlt library when encountering “No input was expected ($PIP_NO_INPUT set)” error in Databricks?

I installed the databricks-dlt library using pip install databricks-dlt in Databricks, but when I try to uninstall it with pip uninstall databricks-dlt, I get the following error:

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)?

How can I properly uninstall the databricks-dlt library in Databricks?

Use the notebook-scoped %pip magic with an automatic-confirm flag to uninstall: run %pip uninstall -y databricks-dlt. The error “No input was expected ($PIP_NO_INPUT set)” happens because Databricks forces non‑interactive pip runs, so pip can’t prompt for “Proceed (Y/n)?” — -y (or --yes) tells pip to skip confirmation. If the package is installed at the cluster/runtime level (outside the notebook environment) you won’t be able to remove it with %pip and must remove it from the cluster Libraries UI or use a different cluster/runtime.


Contents


Problem summary: pip uninstall databricks-dlt error (PIP_NO_INPUT)

Why did pip throw “No input was expected ($PIP_NO_INPUT set)”? In Databricks the environment variable PIP_NO_INPUT is set so pip cannot prompt interactively. When pip uninstall needs confirmation it calls into pip’s prompt routine; because prompts are disabled, pip raises an Exception and the uninstall fails (which is the root cause of the PipError you saw). The official Databricks docs describe this notebook-scoped %pip behavior and the PIP_NO_INPUT constraint — so the platform expects commands to be non-interactive or to include an automatic confirmation flag. See the Databricks guide on notebook-scoped Python libraries for details: https://docs.databricks.com/en/libraries/notebooks-python-libraries.html.


Quick fix — %pip uninstall -y databricks-dlt

Run this one-liner in a Databricks notebook cell:

python
%pip uninstall -y databricks-dlt

Step-by-step: pip uninstall databricks-dlt in a Databricks notebook

  1. Confirm the package is present (and which version):
python
%pip show databricks-dlt
# or
%pip list | grep databricks-dlt
  1. Uninstall non-interactively:
python
%pip uninstall -y databricks-dlt

Expected behavior: pip lists the files to remove and then completes the uninstall. If pip still raises the PIP_NO_INPUT exception, double-check you used the %pip magic and the -y flag.

  1. Restart the notebook Python process so the interpreter picks up the change:
python
dbutils.library.restartPython()

Note: restarting will clear variables and state in the notebook. Per Databricks docs, you may need to restart to see the removal; newer runtimes have different restart semantics, so restart when in doubt: https://docs.databricks.com/en/libraries/notebooks-python-libraries.html.

  1. Verify the package is gone:
python
%pip show databricks-dlt # should say "WARNING: Package(s) not found: databricks-dlt" or produce no output
python -c "import importlib.util; print(importlib.util.find_spec('dlt'))" # should print None

If the package still shows up in %pip list after restart, see the next section — it may be installed at cluster/runtime level.


If pip won’t remove databricks-dlt: cluster/runtime-provided packages

If pip prints something like “Not uninstalling … outside environment” or “Can’t uninstall … No files were found to uninstall”, that means the package lives in a system or cluster-level site-packages folder (outside the notebook-scoped environment). Notebook %pip can only touch the notebook-scoped environment.

Options when the package is cluster/runtime-provided:

If you need to override a runtime-provided package for a specific job, consider running your job on a dedicated cluster with the desired libraries rather than trying to change the runtime image.


Verify uninstall and restart Python

After uninstall and restart:

  • Confirm with %pip list / %pip show databricks-dlt. If it’s not listed, you’re done.
  • Programmatic check:
python
# Should return None if package removed
import importlib.util
print(importlib.util.find_spec('dlt'))
  • If pip still lists databricks-dlt but import dlt fails, you may have multiple Python environments or leftover files. Inspect site-packages locations:
python
import site, sys
print(site.getsitepackages()) # cluster-level paths (might be empty in managed env)
print(sys.path)

Look for duplicate installations and confirm which interpreter %pip is acting on.


FAQ & Troubleshooting

Q: The uninstall still errors with the same PipError. What now?
A: Verify you used %pip in the notebook and included -y. If you did and it still fails, confirm whether the package is cluster-provided (see “cluster/runtime-provided packages” above).

Q: Can I unset PIP_NO_INPUT so pip prompts again?
A: Databricks sets PIP_NO_INPUT intentionally for non-interactive environments. Don’t rely on unsetting it in production; the supported approach is to pass -y for non-interactive confirmation.

Q: Will uninstalling databricks-dlt break running pipelines?
A: Yes — if Delta Live Tables or jobs depend on the library, removing it may break pipelines. Coordinate with your team and restart clusters or jobs as needed.

Q: I need to remove a package for an automated job. How do I make this non-interactive?
A: Use --yes/-y in automated scripts or use the cluster configuration (Libraries API or cluster init) to ensure the correct environment before the job runs. See the Databricks notebooks libraries docs for managed approaches: https://learn.microsoft.com/en-us/azure/databricks/libraries/notebooks-python-libraries.


Sources


Conclusion

Use %pip uninstall -y databricks-dlt inside your Databricks notebook to bypass the PIP_NO_INPUT prompt; restart the Python process with dbutils.library.restartPython() if needed, and if the package is cluster/runtime-provided remove it from the cluster Libraries or use a different cluster.

Authors
Verified by moderation
Moderation
Fix pip uninstall databricks-dlt PIP_NO_INPUT Error