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.
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)
- Quick fix — %pip uninstall -y databricks-dlt
- Step-by-step: pip uninstall databricks-dlt in a Databricks notebook
- If pip won’t remove databricks-dlt: cluster/runtime-provided packages
- Verify uninstall and restart Python
- FAQ & Troubleshooting
- Sources
- Conclusion
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:
%pip uninstall -y databricks-dlt
-y(same as--yes) answers “yes” to the “Proceed (Y/n)?” prompt so pip won’t attempt an interactive confirmation.- Prefer the
%pipmagic in Databricks notebooks because it targets the notebook’s Python environment correctly; plain shellpipcalls (!pip ...) can run in a different interpreter. - Alternate:
pip uninstall --yes databricks-dltorpython -m pip uninstall -y databricks-dltif you’re in a non-notebook environment, but in Databricks notebooks use%pip. See community troubleshooting that recommends-y: https://stackoverflow.com/questions/79793899/pip-uninstall-fails-for-databricks-dlt-library and general non-interactive pip guidance: https://superuser.com/questions/816143/how-to-run-pip-in-non-interactive-mode.
Step-by-step: pip uninstall databricks-dlt in a Databricks notebook
- Confirm the package is present (and which version):
%pip show databricks-dlt
# or
%pip list | grep databricks-dlt
- Uninstall non-interactively:
%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.
- Restart the notebook Python process so the interpreter picks up the change:
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.
- Verify the package is gone:
%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:
- Remove the library from the cluster Libraries UI (Clusters → select cluster → Libraries tab → uninstall/remove the library) and then restart the cluster. Databricks KB covers cases where uninstall via UI is restricted: https://kb.databricks.com/libraries/cant-uninstall-libraries.
- If the package is bundled with the Databricks Runtime (DLT might be included in certain runtime images), you can’t uninstall it — you’ll need to use a different runtime that doesn’t include DLT or use a cluster that doesn’t have it pre-installed. Community discussion notes there may be no simple uninstall path if the runtime supplies the package: https://community.databricks.com/t5/administration-architecture/how-to-not-install-or-disable-or-uninstall-databricks-delta-live/td-p/92573.
- Cluster-level changes require workspace or cluster-admin privileges. If you don’t have them, ask your admin or owner to remove the library or provision a new cluster.
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:
# Should return None if package removed
import importlib.util
print(importlib.util.find_spec('dlt'))
- If
pipstill lists databricks-dlt butimport dltfails, you may have multiple Python environments or leftover files. Inspect site-packages locations:
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
- Notebook-scoped Python libraries - Databricks Documentation
- Notebook-scoped Python libraries - Azure Databricks | Microsoft Learn
- python - pip uninstall fails for databricks-dlt library - Stack Overflow
- How to run pip in non-interactive mode? - Superuser
- How to NOT install or disable or uninstall Databricks Delta Live Tables dlt module on jobs cluster? - Databricks Community
- Cannot uninstall library from UI - Databricks Knowledge Base
- databricks-dlt · PyPI
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.