โ03-09-2023 09:08 AM
Hello,
I'm trying to install a library called aif360 on the databricks notebook. However, I get error that tkinter is not installed.
I tried installing tk and tk-tools, but still the issue remains.
Any idea on what solution we can use?
I also tried installing the libraries through the cluster settings, still doesn't work.
โ03-16-2023 01:10 AM
@Ahmed Elghareebโ :
The aif360 package requires a GUI library like tkinter for some of its visualization functionalities. However, it is not recommended to install GUI libraries on Databricks since it is a cloud-based platform and there is no display available. You can still use the aif360 package on Databricks, but you will need to avoid using the visualization functionalities that require tkinter. If you still need to use the visualization functionalities, one workaround is to install the required libraries on your local machine and run the visualization code from there.
If you still encounter issues with the installation, try installing aif360 and its dependencies using a Python wheel file instead of using pip. You can download the wheel file from the aif360 GitHub page (https://github.com/Trusted-AI/AIF360) and then upload it to your Databricks workspace. Then, install the wheel file using the "Upload Python Egg or PyPI Package" option in the "Libraries" tab.
โ03-19-2023 11:30 AM
Thanks @Suteja Kanuriโ for your answer. Indeed I'm aware of the GUI situation. In fact, I have no intention of using the GUI feature, however, tkinter is imported on a module level. Even if I'm not calling Tkinter code at all, since the import is in the same file as other code that I'm calling, then it's gonna raise an exception.
so, the question is.. is there a way to install Tkinter when I'm not planning to use it?
โ03-19-2023 08:20 PM
@Ahmed Elghareebโ : Can you try installing using the below command
pip install python-tk
โ03-23-2023 06:59 PM
@Suteja Kanuriโ โ I get a weird error that the library doesn't exist. I'm attaching a screenshot.
โ04-01-2023 09:08 PM
@Ahmed Elghareebโ : Providing you 2 options here, please see what works for you.
Option 1:
!pip install tk
This should install the necessary dependencies for python-tk without actually installing the python-tk package itself.
Option 2:
apt-get update
apt-get install -y python3-tk```
-Save and launch the cluster.
-Once the cluster is up and running, you should be able to import tkinter in your notebook.
This init script installs the required package for tkinter to work on Databricks.
โ04-03-2023 03:49 AM
Hi @Ahmed Elghareebโ
Thank you for your question! To assist you better, please take a moment to review the answer and let me know if it best fits your needs.
Please help us select the best solution by clicking on "Select As Best" if it does.
This will also help other community members who may have similar questions in the future. Thank you for your participation and let us know if you need any further assistance!
Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโt want to miss the chance to attend and share knowledge.
If there isnโt a group near you, start one and help create a community that brings people together.
Request a New Group