I am trying to make an installer for an application. I had it working last night, but now it fails. I am using Tkinter, Python 3.10, pip 22, and when I run this code:
import tkinter as tk
root = tk.Tk()
root.geometry("500x300")
top = tk.Frame(root)
bottom = tk.Frame(root)
top.pack(side=tk.TOP)
bottom.pack(side=tk.BOTTOM, fill=tk.BOTH, expand=True)
root.eval('tk::PlaceWindow . center')
root.resizable(False, False)
root.title("Kahoot bot INSTALLER")
installNoticeLabel = tk.Label(root, text="You are about to install FrederickAmpsUp's\nkahoot bot generator. Do you want to proceed?", font=("roboto", 15))
installNoticeLabel.pack()
def install ():
yes.pack_forget()
no.pack_forget()
installNoticeLabel.config(text="Installing, please wait...")
def cancel ():
root.destroy()
yes = tk.Button(root, text="Yes", font=("roboto", 15), command=install)
no = tk.Button(root, text="No", font=("roboto", 15), command=cancel)
yes.pack(in_=bottom, side=tk.RIGHT, fill=tk.BOTH, expand=True)
no.pack(in_=bottom, side=tk.LEFT, fill=tk.BOTH, expand=True)
root.mainloop()
I get the error:
Traceback (most recent call last):
File "/home/USER/VSCode/Kahoot bot app/installer.py", line 1, in <module>
import tkinter as tk
File "/usr/local/lib/python3.10/tkinter/__init__.py", line 37, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter'
So I ran the command pip3.10 install tk
.
Running this, I get:
Defaulting to user installation because normal site-packages is not writeable
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/tk/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/tk/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/tk/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/tk/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/tk/
Could not fetch URL https://pypi.org/simple/tk/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/tk/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
ERROR: Could not find a version that satisfies the requirement tk (from versions: none)
ERROR: No matching distribution found for tk
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
I have tried setting --trusted-host
s for pip, but it does not make a difference.
Please help!
I am running Ubuntu 16.04. If it matters, I get internet through a Raspberry Pi 3 B+ and ethernet cable, as I don't have a wireless card.