oobabooga / one-click-installers

Simplified installers for oobabooga/text-generation-webui.
GNU Affero General Public License v3.0
550 stars 186 forks source link

Check for special characters in installation path on Windows #81

Closed jllllll closed 1 year ago

jllllll commented 1 year ago

Windows Miniconda installer does not allow special characters in the installation path. Displays a warning message if detected. Couldn't find a list of specific characters that it checks for.

Not too sure if detection is necessary or not. Could just display a message on Windows by default.

Checking for these characters: !#$%&()*+,;<=>?@[]^`{|}~

This is a response to: https://github.com/oobabooga/text-generation-webui/issues/1351#issuecomment-1589924256

SuperFurias commented 1 year ago

After some testings: From all the special characters !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ The ones that you can actually put into a folder name are: !#$%&'()+,-.;=@[]^_`{}~ image The miniconda setup can be installed in a folder with the following characters ()+-._ (quite the unique choice that i don't absolutely understand why) but blocks the installation with every other special character from the previous image.

I didn't actually test if installing miniconda in a folder with ()+-._ can actually cause some problems, or break something with conda, so.. well.. yes, beside common special characters like _ best to warn the user about all of them anyway. For spaces in the folder name, as we all already probably know, simply gives a warning but lets you continue the installation.

And this is not only a problem of installation. If you install miniconda in a normal folder directory, for example.. D:\ProgramsOwO\Potato\oobabooga_windows\installer_files (this case scenario is mostly for portable installations of miniconda, like in the oobabooga one) and you suddently want to rename the folder from Potato to.. something else, and you put a special character inside the folder name, like me, then.. this breaks everything. so a warning will be useful

jllllll commented 1 year ago

@SuperFurias Yeah, I put a check for most of the characters and only allowed the ones that I had to, like : \ and / due to C:\, and also ones that I knew wouldn't cause issues with Python and Conda packages. It's best to minimize the use of special characters due to Python and Conda packages potentially not handling them well.

As for the renaming of the folder, typical Conda environments are not portable and require that the path to the environment stays the same as it was when created. I did actually find a way to make a portable environment using Micromamba to create the Conda environment and wrote a Windows installer for it here: https://github.com/jllllll/one-click-installers/tree/oobabooga-windows-conda-bootstrap Unfortunately, Micromamba just doesn't work on some systems, so a different strategy would need to be implemented for Miniconda if portability is to be achieved in the main installer.

For spaces in the folder name, as we all already probably know, simply gives a warning but lets you continue the installation.

The start_windows.bat script includes a check for spaces and stops the installer if they are present. This is because, while the Miniconda installer will warn you about the spaces when run directly, it will just silently fail if the installer is used in silent mode. If you do install it under a path with spaces, some Python packages and Conda packages will not work correctly. This caused a lot of problems back when we were using Micromamba as it didn't prevent installation under a path with spaces.