0

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-hosts 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.

1 Answers1

0

You have a Mac/Linux so I think this could help:

Change openssl version back from to older version:

brew switch openssl 1.0.2e

or

Reinstall openssl by brew uninstall openssl; brew install openssl. According to the hints given by Homebrew, do the following:

echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"

For Linux use this post.

For Windows & Anaconda use this post

JoraSN
  • 332
  • 2
  • 14