Skip to content

PR: Fix issue where powershell is not found by Spyder on initial launch from installer#25985

Open
mrclary wants to merge 3 commits into
spyder-ide:masterfrom
mrclary:issue-25915-FilePath
Open

PR: Fix issue where powershell is not found by Spyder on initial launch from installer#25985
mrclary wants to merge 3 commits into
spyder-ide:masterfrom
mrclary:issue-25915-FilePath

Conversation

@mrclary
Copy link
Copy Markdown
Contributor

@mrclary mrclary commented Apr 27, 2026

Add C:\Windows\System32\WindowsPowerShell\v1.0 to PATH because constructor removes it.
Also fix issue where Spyder's temp directory was incorrect when launched by installer.

Fixes #25915

@mrclary mrclary added this to the v6.1.5 milestone Apr 27, 2026
@mrclary mrclary self-assigned this Apr 27, 2026
@mrclary mrclary changed the title Fix issue where powershell is not found by Spyder on initial launch from installer PR: Fix issue where powershell is not found by Spyder on initial launch from installer Apr 28, 2026
@mrclary mrclary marked this pull request as ready for review April 28, 2026 03:31
@mrclary mrclary requested review from ccordoba12 and dalthviz April 28, 2026 03:31
@ccordoba12 ccordoba12 removed their request for review April 28, 2026 04:01
@ccordoba12
Copy link
Copy Markdown
Member

@dalthviz, please check if the installers generated in this PR fix the problem you found.

@dalthviz
Copy link
Copy Markdown
Member

Gave a check installing the Windows installer from this PR and I didn't got the error dialog mentioned over the issue related with -FilePath. However, now I got the following warning/error dialog:

image

The details shown there are:

*** COMMAND ***
start -FilePath "C:\Users\dalth\AppData\Local\spyder-6\envs\spyder-runtime\Lib\site-packages\spyder\plugins\updatemanager\scripts\updater.bat" -ArgumentList 'C:/Users/dalth/AppData/Local/spyder-6\Scripts\conda.exe','create','C:\Users\dalth\AppData\Local\spyder-6\envs\spyder-updater','C:\Users\dalth\AppData\Local\Temp\spyder\updates\spyder-updater\0.2.0\conda-updater-win-64.lock','C:\Users\dalth\AppData\Local\Temp\spyder\updates\spyder-updater\0.2.0\spyder-updater-0.2.0-py_0.conda' -Wait -WindowStyle Hidden

*** STDOUT ***


*** STDERR ***
Unable to read C:\Users\dalth\AppData\Local\Temp\spyder\updates\spyder-updater\0.2.0\updater_stderr.log: [Errno 2] No such file or directory: 'C:\\Users\\dalth\\AppData\\Local\\Temp\\spyder\\updates\\spyder-updater\\0.2.0\\updater_stderr.log'

So seems like there could be a possibility for the spyder-updater update to fail due to missing access to log files? Or maybe something else could be happening with the updater update command?

I think there was an issue related to the error log not being available but it was fixed if I'm not mistaken 🤔

@mrclary
Copy link
Copy Markdown
Contributor Author

mrclary commented Apr 29, 2026

Gave a check installing the Windows installer from this PR and I didn't got the error dialog mentioned over the issue related with -FilePath.

Excellent.

So seems like there could be a possibility for the spyder-updater update to fail due to missing access to log files? Or maybe something else could be happening with the updater update command?

Thanks for checking @dalthviz, I'll look into this. Likely a simple mistake on my part.

@mrclary
Copy link
Copy Markdown
Contributor Author

mrclary commented Apr 29, 2026

However, now I got the following warning/error dialog:
...
The details shown there are:

*** COMMAND ***
start -FilePath "C:\Users\dalth\AppData\Local\spyder-6\envs\spyder-runtime\Lib\site-packages\spyder\plugins\updatemanager\scripts\updater.bat" -ArgumentList 'C:/Users/dalth/AppData/Local/spyder-6\Scripts\conda.exe','create','C:\Users\dalth\AppData\Local\spyder-6\envs\spyder-updater','C:\Users\dalth\AppData\Local\Temp\spyder\updates\spyder-updater\0.2.0\conda-updater-win-64.lock','C:\Users\dalth\AppData\Local\Temp\spyder\updates\spyder-updater\0.2.0\spyder-updater-0.2.0-py_0.conda' -Wait -WindowStyle Hidden

*** STDOUT ***


*** STDERR ***
Unable to read C:\Users\dalth\AppData\Local\Temp\spyder\updates\spyder-updater\0.2.0\updater_stderr.log: [Errno 2] No such file or directory: 'C:\\Users\\dalth\\AppData\\Local\\Temp\\spyder\\updates\\spyder-updater\\0.2.0\\updater_stderr.log'

So seems like there could be a possibility for the spyder-updater update to fail due to missing access to log files? Or maybe something else could be happening with the updater update command?

I think there was an issue related to the error log not being available but it was fixed if I'm not mistaken 🤔

Hmm... I'm unable to reproduce on my Window machine.
I first uninstalled any existing standalone install, then also removed C:\Users\rclary\AppData\Local\Temp\spyder, and installed from the artifact for just my user. Just to confirm, the version should be 6.1.0b3.dev724.

After Spyder auto-launched from the installer, I checked for updates and the spyder-updater environment was successfully created. I verified that both log files are in %TMP%\spyder\updates\spyder-updater\0.2.0\.

Are those files present for you @dalthviz? Is there a directory %TMP%\spyder\spyder (an extra nested spyder directory)? That should not be there. If so, try removing %TMP%\spyder and uninstall/reinstall again.

@dalthviz
Copy link
Copy Markdown
Member

Checked and I indeed had a spyder\spyder directory under my Temp directory (%TEMP%\spyder\spyder\updates\spyder-updater\0.2.0 existed for me). What could have caused that? 🤔

However, trying again by removing first that directory before uninstalling and installing, still let me to see the warning/error message. Checking my Temp directory after the autolaunch and failed update attempt, I was able to see that the correct path was created and would say contents (.lock files and a .conda file) but no updater_stderr.log:

image

Just to test, added manually a updater_stderr.log file to the 0.2.0 directory while Spyder was still running from the the after installation autostart and triggered again the check for updates which then let me to see the normal "update available want to install message" 🤔

@mrclary
Copy link
Copy Markdown
Contributor Author

mrclary commented Apr 29, 2026

Checked and I indeed had a spyder\spyder directory under my Temp directory (%TEMP%\spyder\spyder\updates\spyder-updater\0.2.0 existed for me). What could have caused that? 🤔

That was a result of setting tmpdir=%tmp%\spyder in the post-install.bat script. This environment variable is only intended for use in this script but was unintentionally passed to Spyder when launched by the installer. tempfile.gettempdir looks for this (normally not set) variable as the root temporary directory, and spyder.utils.programs.get_temp_dir adds spyder to this, resulting in two spyder directories. This was not intended, and only affects Spyder launched from the installer. I fixed this as part of this PR as well.

However, trying again by removing first that directory before uninstalling and installing, still let me to see the warning/error message. Checking my Temp directory after the autolaunch and failed update attempt, I was able to see that the correct path was created and would say contents (.lock files and a .conda file) but no updater_stderr.log:

Just to test, added manually a updater_stderr.log file to the 0.2.0 directory while Spyder was still running from the the after installation autostart and triggered again the check for updates which then let me to see the normal "update available want to install message" 🤔

Okay, at least we now know that it is unrelated to the nested spyder directories and that the log files are not created for some reason.

The only other thing I can think to try is, before checking for updates, put some other diagnostic in spyder\plugins\updatemanager\scripts\updater.bat above line 12, maybe something like set > C:\Users\dalth\Desktop\test_output.log. Maybe we could see some environment variable, or missing one, that is causing the problem. 🤷🏼‍♂️

@dalthviz
Copy link
Copy Markdown
Member

The only other thing I can think to try is, before checking for updates, put some other diagnostic in spyder\plugins\updatemanager\scripts\updater.bat above line 12, maybe something like set > C:\Users\dalth\Desktop\test_output.log. Maybe we could see some environment variable, or missing one, that is causing the problem. 🤷🏼‍♂️

Tried that and seems to me that the only variable that stands out is that there is a tmpdir variable defined as tmpdir=\Users\dalth\AppData\Local\Temp\spyder\updates\SPYDER~1\026545~1.0\. Will sent you the generated file so you can give it a check

@mrclary
Copy link
Copy Markdown
Contributor Author

mrclary commented Apr 30, 2026

The tmpdir there is what I see on my side too. That is the shortname path, which is okay.

@mrclary mrclary force-pushed the issue-25915-FilePath branch from 50ecbeb to a18ec21 Compare May 12, 2026 15:43
@dalthviz
Copy link
Copy Markdown
Member

Gave this another try but now using a clean Windows 10 VM and the updated worked. I was still able to reproduce the error in my Windows 10 machine but while checking again noticed that I had a project open (spyder repo itself) when Spyder was autolaunched. After closing the project I was able to update without isssue 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

-FilePath error message when attempting to update just installed and auto launched Spyder from Windows installer

3 participants