spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.34k stars 1.62k forks source link

Spyder 6 silent installation is done to `C:\ProgramData` but it should be to `C:\Program Files` #22931

Open Saxomania opened 6 days ago

Saxomania commented 6 days ago

Issue Report Checklist

Problem Description

In contrast to Spyder 5, Spyder 6 is installed automatically in silent mode after c:\programdata. This is fundamentally wrong. Installations belong in ‘C:\Program Files’ or ‘C:\Program Files (x86)’.

I have not found a way to change the installation path.

Please adjust the installer so that you can install silent again and adjust the installation path and you should definitely change the default installation path.

Here is an info what C:\ProgramData is used for, source (https://learn.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/microsoft-windows-shell-setup-folderlocations-programdata):

ProgramData specifies the path to the program-data folder (normally C:\ProgramData). Unlike the Program Files folder, this folder can be used by applications to store data for standard users, because it does not require elevated permissions.

Versions

dalthviz commented 5 days ago

Hi @Saxomania thank you for the report! Could it be possible for you to check if the the /D flag can help you to set where the installer should do the installation? I think the current Spyder 6 installers should be able to support it. For more info on CLI options available for the Spyder 6 installers on Windows you can check: https://conda.github.io/constructor/cli-options/#windows-installers

Let us know if the info above helps!

Also, just in case, what do you think @mrclary ? It is possible to configure the default path for the Windows installer with constructor?

mrclary commented 5 days ago

In contrast to Spyder 5, Spyder 6 is installed automatically in silent mode after c:\programdata. This is fundamentally wrong. Installations belong in ‘C:\Program Files’ or ‘C:\Program Files (x86)’.

Spyder 6 is not installed automatically in silent mode. To do so, you must run the executable from a cmd prompt and use the /S flag.

Spyder 6 uses constructor to create the installer, which is the same mechanism as Anaconda. The default location for installing these conda environments is not C:\Program Files or C:\Program Files (x86), but either %USERPROFILE% or %LOCALAPPDATA% for "Just Me" installation. We have chosen %LOCALAPPDATA%. See https://conda.github.io/constructor/construct-yaml/#default-prefix.

I have not found a way to change the installation path.

As @dalthviz has mentioned, you should be able to install to any directory by using the /D flag at the cmd prompt.

dalthviz commented 5 days ago

In contrast to Spyder 5, Spyder 6 is installed automatically in silent mode after c:\programdata. This is fundamentally wrong. Installations belong in ‘C:\Program Files’ or ‘C:\Program Files (x86)’.

Spyder 6 is not installed automatically in silent mode. To do so, you must run the executable from a cmd prompt and use the /S flag.

I think what @Saxomania meant to say is that the default path where an installation is done is over the APPDATA path regardless of the option you use (for current user or for all the users install option). Doing a check, running the installer from the GUI, you can see that the default value for the installation path indeed points to the APPDATA dir even when you choose the option to install for all users:

installer_default_path_allusers

Maybe this is something that needs to be fixed over constructor? It seems like the custom default path defined is used for both "only me" and "all users" installs? Or maybe we are missing to also define a default path value for the 'all users' option? :thinking:

mrclary commented 5 days ago

The default path for "All Users" should be %ALLUSERSPROFILE%. If this is not the case, then we should create an issue at https://github.com/conda/constructor

mrclary commented 5 days ago

Yep. %ALLUSERPROFILE% is C:\ProgramData on my Windows VM. I think this is the default location for Anaconda for "All Users". I think our use of C:\ProgramData is consistent with the description in the link provided.

ccordoba12 commented 5 days ago

As @dalthviz has mentioned, you should be able to install to any directory by using the /D flag at the cmd prompt.

@mrclary, could you manually check if that works as expected?

Other than that, and writing some docs for silent installations (as we talked about), I don't know if there's something else we should do here. I mean, I've seen software installed to both ProgramData and Program Files, so this is not unique to Spyder and I wouldn't say fundamentally wrong (as @Saxomania implies).

ccordoba12 commented 5 days ago

Maybe this is something that needs to be fixed over constructor? It seems like the custom default path defined is used for both "only me" and "all users" installs? Or maybe we are missing to also define a default path value for the 'all users' option? 🤔

What do you mean by this @dalthviz? Even if the default is ProgramData in the installer's GUI, is it not possible to change it?

mrclary commented 5 days ago

@dalthviz @ccordoba12, we explicitly define the default install path for "All Users", although it is the same as if we did not explicitly define it: https://conda.github.io/constructor/construct-yaml/#default-prefix-all-users https://github.com/spyder-ide/spyder/blob/de95a54694237a2b9169f2461ea98f2b3a585047/installers-conda/build_installers.py#L391C1-L399C19

It should be possible to change the install location in the GUI or via /D at the cmd prompt, regardless of "All Users" or "Just Me". But, I'll confirm /D efficacy. If there is an issue here, then it will have to be pushed up to constructor.

ccordoba12 commented 5 days ago

we explicitly define the default install path for "All Users"

Ok, I didn't know that we were doing that. Then perhaps we should change it to Program Files, given that it doesn't require an additional effort (I thought it was not possible without changes to constructor).

mrclary commented 5 days ago

I've made two observatons on my Windows VM installing Spyder 6.0.2.

  1. It is not possible to install into an absolute path that contains spaces. Screenshot 2024-11-11 at 6 04 35 PM
  2. Indeed, /D flag does not appear to be respected if not in silent mode. However, this works just fine:
    C:\Users\rclary\Downloads\Spyder-Windows-x86_64.exe /S /D=C:\Users\rclary\spyder-6

    Designating a desired install location via the GUI works just fine as well, as long as there are no spaces in the path.

mrclary commented 5 days ago

C:\ProgramData remains the best default choice for "All Users". So there is nothing to be done with this issue, in my opinion.

Saxomania commented 5 days ago

Some background:

I tried this arguments:

Spyder-Windows-x86_64.exe /InstallationType=AllUsers /S /D=%ProgramFiles%\Spyder6
Spyder-Windows-x86_64.exe /InstallationType=AllUsers /S /D=C:\Program Files\Spyder6
Spyder-Windows-x86_64.exe /InstallationType=AllUsers /S /D="C:\Program Files\Spyder6"

nothing worked and installation was done either not or was installed into C:\ProgramData

now I did this

Spyder-Windows-x86_64.exe /InstallationType=AllUsers /S /D=C:\Windows\Apps\Spyder6

so it will be installed in C:\Windows folder and so I dont need to change my applocker configuration, looks good so far but uninstall doesnt work from here

grafik

But i would still recommend that you think about this behaviour and if it not possible to change it search for another Windows installer. Check Chrome or Firefox - you can install them into %localappdata% (aka userprofile) or into %programfiles% - nobody should install to %allusersprofile%

mrclary commented 4 days ago

Some background:

  • per default in c:\programdata every user has write access and you dont want to install applications into this location
  • i am managing 3500 Windows clients and we are using Windows built applocker which restricts from which location default users can execute executables, scripts and so on
  • per default only executables from c:\program files, c:\program files (x86) and c:\windows are allowed because these are folders where default users have no write access
  • you dont want to enable default users to execute applications from %appdata% or c:\programdata because they could run unlicensed software, malware or so on

Thank you for sharing additional context. It is always helpful to understand users' implementation scenarios.

Spyder-Windows-x86_64.exe /InstallationType=AllUsers /S /D=%ProgramFiles%\Spyder6
Spyder-Windows-x86_64.exe /InstallationType=AllUsers /S /D=C:\Program Files\Spyder6
Spyder-Windows-x86_64.exe /InstallationType=AllUsers /S /D="C:\Program Files\Spyder6"

nothing worked and installation was done either not or was installed into C:\ProgramData

Conda environments cannot be installed into paths with spaces. Although I'm not sure if this is strictly true or a bug in constructor. See https://conda.github.io/constructor/cli-options/#id1 where the documentation examples explicitly show an installation into C:\Program Files.

now I did this

Spyder-Windows-x86_64.exe /InstallationType=AllUsers /S /D=C:\Windows\Apps\Spyder6

so it will be installed in C:\Windows folder and so I dont need to change my applocker configuration, looks good so far

Excellent! I'm glad you found a solution that works for you.

but uninstall doesnt work from here

This appears to be a bug with constructor.

But i would still recommend that you think about this behaviour and if it not possible to change it search for another Windows installer.

Spyder's installer installs a conda environment from which Spyder is run. This is identical behavior as the Anaconda installer; in fact we use the same installer as Anaconda. If installing into paths with spaces is, indeed, detrimental to a conda environment, then there is nothing that can be done and Spyder will never be able to install into a path with spaces. However, if this is a bug in constructor, then it is possible that those developers may fix it.

Pinging @jaimergp

Saxomania commented 4 days ago

but uninstall doesnt work from here

This appears to be a bug with constructor.

Ok, how can we solve that?

But i would still recommend that you think about this behaviour and if it not possible to change it search for another Windows installer.

Spyder's installer installs a conda environment from which Spyder is run. This is identical behavior as the Anaconda installer; in fact we use the same installer as Anaconda. If installing into paths with spaces is, indeed, detrimental to a conda environment, then there is nothing that can be done and Spyder will never be able to install into a path with spaces. However, if this is a bug in constructor, then it is possible that those developers may fix it.

Pinging @jaimergp

got it, as far as i remember we installed Anaconda on some devices to a similar path (C:\Windows\Apps\Anaconda because of its empty spaces restrictions but uninstalling has never been a problem there but we dont provide Anaconda any more - you know why :)

installing Spyder 5 into %programfiles% has never been a problem

mrclary commented 4 days ago

installing Spyder 5 into %programfiles% has never been a problem

For Spyder 5, we used a true standalone application. However, this prevented us from adding new features such as incremental updates and using external plugins. Our new installer paradigm allows us to implement these features.