Skip to content

Conversation

@RobPasMue
Copy link
Member

@RobPasMue RobPasMue commented Aug 28, 2023

As title says. I will also try to fix #93

@github-actions github-actions bot added the bug Something isn't working label Aug 28, 2023
@RobPasMue RobPasMue self-assigned this Aug 28, 2023
@github-actions github-actions bot added documentation Improvements or additions to documentation maintenance Package and maintenance related labels Aug 28, 2023
@RobPasMue
Copy link
Member Author

New message box in case check for update fails:

image

@kmahajan-cadfem
Copy link
Collaborator

I am not able to run the UI from source code because again SSL errors from pypi api.
I do understand that this is necessary, but would it be possible to maintain a list of versions(of all the possible versions from) in the package itself, then at least the UI would open, in my case the UI just does not open and user does not know whats wrong.

--console flag does not work with the exe, I had to run the main.py file

2023-08-28 11:32:26,874 - DEBUG - Populating the table with virtual environments.
2023-08-28 11:32:26,881 - DEBUG - Populating the table with python and conda forge versions.
2023-08-28 11:32:26,881 - DEBUG - Found the following unified Ansys installation versions: {232: 'C:\\Program Files\\ANSYS Inc\\v232', 231: 'C:\\Program Files\\ANSYS Inc\\v231', 221: 'C:\\Program Files\\ANSYS Inc\\v221'}
2023-08-28 11:32:27,255 - DEBUG - Starting new HTTPS connection (1): pypi.python.org:443
Traceback (most recent call last):
  File "D:\users\mkanchan\Work\pyansys\source\python-installer-qt-gui\.venv\lib\site-packages\urllib3\connectionpool.py", line 467, in _make_request
    self._validate_conn(conn)
  File "D:\users\mkanchan\Work\pyansys\source\python-installer-qt-gui\.venv\lib\site-packages\urllib3\connectionpool.py", line 1092, in _validate_conn    conn.connect()
  File "D:\users\mkanchan\Work\pyansys\source\python-installer-qt-gui\.venv\lib\site-packages\urllib3\connection.py", line 642, in connect
    sock_and_verified = _ssl_wrap_socket_and_match_hostname(
  File "D:\users\mkanchan\Work\pyansys\source\python-installer-qt-gui\.venv\lib\site-packages\urllib3\connection.py", line 783, in _ssl_wrap_socket_and_match_hostname
    ssl_sock = ssl_wrap_socket(
  File "D:\users\mkanchan\Work\pyansys\source\python-installer-qt-gui\.venv\lib\site-packages\urllib3\util\ssl_.py", line 469, in ssl_wrap_socket     
    ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
  File "D:\users\mkanchan\Work\pyansys\source\python-installer-qt-gui\.venv\lib\site-packages\urllib3\util\ssl_.py", line 513, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "C:\Program Files\ANSYS Inc\v232\commonfiles\CPython\3_10\winx64\Release\python\lib\ssl.py", line 513, in wrap_socket
    return self.sslsocket_class._create(
  File "C:\Program Files\ANSYS Inc\v232\commonfiles\CPython\3_10\winx64\Release\python\lib\ssl.py", line 1071, in _create
    self.do_handshake()
  File "C:\Program Files\ANSYS Inc\v232\commonfiles\CPython\3_10\winx64\Release\python\lib\ssl.py", line 1342, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)   

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\users\mkanchan\Work\pyansys\source\python-installer-qt-gui\.venv\lib\site-packages\urllib3\connectionpool.py", line 790, in urlopen        
    response = self._make_request(
  File "D:\users\mkanchan\Work\pyansys\source\python-installer-qt-gui\.venv\lib\site-packages\urllib3\connectionpool.py", line 491, in _make_request  
    raise new_e
urllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)    

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\users\mkanchan\Work\pyansys\source\python-installer-qt-gui\.venv\lib\site-packages\requests\adapters.py", line 486, in send
    resp = conn.urlopen(
  File "D:\users\mkanchan\Work\pyansys\source\python-installer-qt-gui\.venv\lib\site-packages\urllib3\connectionpool.py", line 844, in urlopen        
    retries = retries.increment(
  File "D:\users\mkanchan\Work\pyansys\source\python-installer-qt-gui\.venv\lib\site-packages\urllib3\util\retry.py", line 515, in increment
    raise MaxRetryError(_pool, url, reason) from reason  # type: ignore[arg-type]
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /pypi/pyansys/json (Caused by 
SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\users\mkanchan\Work\pyansys\source\python-installer-qt-gui\src\ansys\tools\installer\__main__.py", line 6, in <module>
    open_gui()
  File "D:\users\mkanchan\Work\pyansys\source\python-installer-qt-gui\.venv\lib\site-packages\ansys\tools\installer\main.py", line 680, in open_gui   
    window = AnsysPythonInstaller()
  File "D:\users\mkanchan\Work\pyansys\source\python-installer-qt-gui\.venv\lib\site-packages\ansys\tools\installer\main.py", line 123, in __init__   
    self.installed_table_tab = InstalledTab(self)
  File "D:\users\mkanchan\Work\pyansys\source\python-installer-qt-gui\.venv\lib\site-packages\ansys\tools\installer\installed_table.py", line 281, in 
__init__
    self.update_package_combo(0)
  File "D:\users\mkanchan\Work\pyansys\source\python-installer-qt-gui\.venv\lib\site-packages\ansys\tools\installer\installed_table.py", line 362, in 
update_package_combo
    self._cached_versions[package_name] = get_pkg_versions(package_name)
  File "D:\users\mkanchan\Work\pyansys\source\python-installer-qt-gui\.venv\lib\site-packages\ansys\tools\installer\common.py", line 88, in get_pkg_versions
    releases = json.loads(requests.get(url).content)["releases"]
  File "D:\users\mkanchan\Work\pyansys\source\python-installer-qt-gui\.venv\lib\site-packages\requests\api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
  File "D:\users\mkanchan\Work\pyansys\source\python-installer-qt-gui\.venv\lib\site-packages\requests\api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "D:\users\mkanchan\Work\pyansys\source\python-installer-qt-gui\.venv\lib\site-packages\requests\sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "D:\users\mkanchan\Work\pyansys\source\python-installer-qt-gui\.venv\lib\site-packages\requests\sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "D:\users\mkanchan\Work\pyansys\source\python-installer-qt-gui\.venv\lib\site-packages\requests\adapters.py", line 517, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /pypi/pyansys/json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)')))

@RobPasMue
Copy link
Member Author

RobPasMue commented Aug 28, 2023

@kmahajan-cadfem - yep got it...

Keeping track of a hardcoded list of versions might be a high-burden to pay for... What I can do, though, is to avoid the failure and just show the list of packages. That way, if you then request the installation of a certain package, you would just get the latest version of it (i.e. it's like instead of doing pip install pyansys==XX.YY.ZZ you just ran pip install pyansys).

Would that work?

@kmahajan-cadfem
Copy link
Collaborator

@kmahajan-cadfem - yep got it...

Keeping track of a hardcoded list of versions might be a high-burden to pay for... What I can do, though, is to avoid the failure and just show the list of packages. That way, if you then request the installation of a certain package, you would just get the latest version of it (i.e. it's like instead of doing pip install pyansys==XX.YY.ZZ you just ran pip install pyansys).

Would that work?

I agree, maintaining list is a manual work and would not be efficient.

but just list without versions(i think this is already there) would be a great advantage and it is better to tell user what is failing or it should not fail to open.

once the user at least reaches to the UI , venvs creation should not be a problem, the last remaining bit of installation of pip packages could be done at later point or through console.

@RobPasMue
Copy link
Member Author

Just did some implementation "simulating" your case (no connection to the PyPI API). Let me know what you think. I'll upload the changes

pypi-api.webm

@kmahajan-cadfem
Copy link
Collaborator

This looks great 👍

@RobPasMue
Copy link
Member Author

Awesome, thanks @kmahajan-cadfem! Please review and approve whenever you have the chance so that we can merge it in that case. Glad it solved your issues!

@RobPasMue RobPasMue merged commit 9a70921 into main Aug 28, 2023
@RobPasMue RobPasMue deleted the fix/autoupdate branch August 28, 2023 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation maintenance Package and maintenance related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Persistent SSL certificate issues

3 participants