Skip to content

PowerShellPython Troubleshooting

leomaxwell973 edited this page Feb 9, 2025 · 3 revisions

Troubleshooting:

-Uncomment the top and bottom prints in the script to get a ton more info on how things are being processed and can easily see if its powershellpython or something else at fault.

-ensure default install for visual studio (either program files, or program files (x86) is fine)

-There is a possibility that powershellpython may at times depending on circumstances prefer, if not require (without further debugging) that FilePaths have NO spaces AND possibly no () or other special characters. It seems to only trigger this under unusual circumstances, such as when early in testing powershellpython was forcing powershell to try and run a bat native, which had odd behavior as expected, but, the change in path requirements was strange still and unsolved as to why it behaved that way or if it would occur under any other circumstances. If you get errors like '"C:\Program" is not a valid command' or etc. you may have run into this odd issue. Only two ways to fix it, either symlink the spaces and specails out of your paths, or, hardcode into the script an exception to try the same path on except, but with escaped spaces and S.characters I.E.: " "& "(" This must be done as an exception or conditional of some kind not a blanket as typically powershell reads just like cmd and other exe would, except in this niche scenario.

-On that note, avoid running bats if at all possible, without precautions taken, as, the running into bats was never resolved, instead, that bat had a custom pre-routine setup (the vcvarsall env setup routine to be precise), though this is something easy to include in later versions, it just wasn't needed for the current testing scope nor had it come up in general python use either making it a rather niche feature addition so... post if this actually occurs and what package install as I can't think of any aside from vcvarsall. if you prefer codin it in yourself just add a check if popenargs/[0]/[2]/(depending on where you put the code) cotains/endswith .bat to skip/bypass powershell and/or include cmd /c without powershell changing it.

-It may be worth restoring setuptools build.py, but doubtful in current versions of xformers or flash-attn, though other packages may be differ and future versions may as well.

-if you get a "file name length" error. I say again, FILE NAME length error, you are probably using python cmake/ninja, use windows instead.

-ensure your CUDA paths are set

-PYTHON_HOME/PATH, shouldn't really be a factor, but couldn't hurt to try either way if something goes wrong and still no fix found

-If you are using PowerShell V7 and get odd errors, try V1.0 only instead if possible.

-ensure powershell is functioning without odd behavior (I.E. profiles autoloading it into unintended environment. conda/anaconda may do this automatically sometimes)

-ensure no conflict between user and system python if present, as, if only one is setup with powershellpython, the other is working cmd, either making odd or no-change behavior likely. of course you'll want to isolate them not install on both, unless you intend to for other reasons.

-if using the portable and you already have your own environment, ensure you have switched over entirely to portable when running, I.E. 'where.exe python' and 'where.exe pip' should both have portable path at top if working correctly.

-this does not address long-path setting (addresses cmd line length) in any way and technically expects it, but also doesn't. Make sure your long-path is enabled by default.

-setting Set-ExecutionPolicy Unrestricted may be helpful whether you use ps1 scripts or not.

Clone this wiki locally