3C-SCSU / Avatar

MIT License
6 stars 122 forks source link

Fix GUI: current Tab/File transfer bug #70

Closed 3C-SCSU closed 8 months ago

3C-SCSU commented 8 months ago

Bug fixing: Backwards compatibility with Python 3.9.1. Currently the newer version of the Avatar with the new Tab and Transfer file integration crashes when folks try to install and run the Avatar GUI. What is causing it needs investigation, and it has to be fixed:

https://github.com/3C-SCSU/Avatar/issues/60 https://github.com/3C-SCSU/Avatar/pull/65

An implementation that fixes it will be awarded 1 bounty for improving it and 1 extra bounty if the implementation is voted the best version and approved into the main open source repo.

Record a short video showing the new version is running with no problem. Upload it on YouTube or some other online option, then submit the pull request with the link to the video demo included.

Have fun coding!

Note: after the best version is accepted and the pull request is merged into the main repo, further submission is closed.


Python 3.9.1 problem -- (note: quick fix update your Python installation - for Python 3.11 works) pip show bcrypt Name: bcrypt Version: 4.1.2 Summary: Modern password hashing for your software and your servers Home-page: Author: Author-email: The Python Cryptographic Authority developers cryptography-dev@python.org License: Apache-2.0 Location: c:\users\matth\appdata\local\programs\python\python39\lib\site-packages Requires: Required-by: paramiko PS C:\Users\matth\AppData\Roaming\SPB_Data\Avatar-Matt\brainwave-prediction-app> Exception has occurred: ImportError DLL load failed while importing _bcrypt: The specified procedure could not be found. File "C:\Users\matth\AppData\Roaming\SPB_Data\Avatar-Matt\file-transfer\sftp.py", line 1, in import pysftp File "C:\Users\matth\AppData\Roaming\SPB_Data\Avatar-Matt\brainwave-prediction-app\gui_windows\transfer_files_window.py", line 6, in from sftp import fileTransfer File "C:\Users\matth\AppData\Roaming\SPB_Data\Avatar-Matt\brainwave-prediction-app\GUI.py", line 10, in from gui_windows.transfer_files_window import TransferData ImportError: DLL load failed while importing _bcrypt: The specified procedure could not be found. Full error traceback:

Traceback (most recent call last): File "c:\Users\matth\AppData\Roaming\SPB_Data\Avatar-Matt\brainwave-prediction-app\GUI.py", line 10, in from gui_windows.transfer_files_window import TransferData File "c:\Users\matth\AppData\Roaming\SPB_Data\Avatar-Matt\brainwave-prediction-app\gui_windows\transfer_files_window.py", line 6, in from sftp import fileTransfer File "C:\Users\matth\AppData\Roaming\SPB_Data\Avatar-Matt\brainwave-prediction-app\gui_windows....\file-transfer\sftp.py", line 1, in import pysftp File "C:\Users\matth\AppData\Local\Programs\Python\Python39\lib\site-packages\pysftp__init.py", line 12, in import paramiko File "C:\Users\matth\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\init.py", line 22, in from paramiko.transport import ( File "C:\Users\matth\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\transport.py", line 93, in from paramiko.dsskey import DSSKey File "C:\Users\matth\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\dsskey.py", line 37, in from paramiko.pkey import PKey File "C:\Users\matth\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\pkey.py", line 32, in import bcrypt File "C:\Users\matth\AppData\Local\Programs\Python\Python39\lib\site-packages\bcrypt\init__.py", line 13, in from ._bcrypt import ( ImportError: DLL load failed while importing _bcrypt: The specified procedure could not be found.

KINGTUT10101 commented 8 months ago

Is this an issue for multiple users? I switched to Python 3.9.1 (the version seemingly used in the error message), cloned it, and ran the GUI without issue

KINGTUT10101 commented 8 months ago

Okay, I was able to recreate the error by installing python 3.9.1 on Windows (it seems to work on linux just fine though)

KINGTUT10101 commented 8 months ago

I confirmed that the TABS implementation did not cause this error. Pysftp has issues running on older versions of Python on Windows. If you are running Avatar on Windows with WSL, you need Python v3.9.2 or higher. Anything older than that will cause this error on Windows (it will work fine on Linux and probably WSL though).

You can confirm this for yourself by installing Python v3.9.1 and running the following program: import pysftp This will cause the same error as in this issue, which shows that this is not caused by the Avatar project. You can also prove that the TABS implementation did not cause this problem by running an older version of the project, like this one: https://github.com/3C-SCSU/Avatar/commit/7927143867d1baa615ac30c5fe51eb67f5c17d02 It will give you the same error.

MythMaker commented 8 months ago

I think it is an issue with the latest version of bcrypt (4.1.2). Downgrading to bcrypt version 4.1.1 solves this issue.

KINGTUT10101 commented 8 months ago

If that's the case then we can fix this in the future by completing this issue (https://github.com/3C-SCSU/Avatar/issues/69) and specifying that version number.

For now, users can type pip3 install bcrypt==4.1.1 to install the older version

However, it might be good to use more modern versions of Python instead to avoid more problems like this in the future.

3C-SCSU commented 8 months ago

Solution proposed by KINGTUT10101 accepted. Ticket closed.