pixi icon indicating copy to clipboard operation
pixi copied to clipboard

Pixi shell Windows: error execution of scripts are deactivated on this system

Open rbl965 opened this issue 8 months ago • 2 comments

Checks

  • [x] I have checked that this issue has not already been reported.

  • [x] I have confirmed this bug exists on the latest version of pixi, using pixi --version.

Reproducible example

pixi shell  

Issue description

I get this error :

Impossible de charger le fichier C:\Users\Rodri\AppData\Local\Temp\.tmp8hYszu.ps1, car l’exécution de scripts est
désactivée sur ce système. Pour plus d’informations, consultez about_Execution_Policies à l’adresse
https://go.microsoft.com/fwlink/?LinkID=135170.
    + CategoryInfo          : Erreur de sécurité : (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnauthorizedAccess

Expected behavior

standart behavior of pixi shell

I find nothing about windows in the shell documentation : https://pixi.sh/latest/advanced/pixi_shell/#issues-with-pixi-shell

rbl965 avatar Apr 08 '25 13:04 rbl965

Perhaps this is caused by the powershell execution policy. Could you try running:

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass -Force;

and rerun pixi shell.

baszalmstra avatar Apr 14 '25 06:04 baszalmstra

There is a related PR in conda: https://github.com/conda/conda/pull/14755

However, it just checks the execution policy and then skips the hook. I am not sure if there is more we could do?

wolfv avatar Apr 14 '25 07:04 wolfv

It would be nice if we could override the location of these to bypass the use of AppData\Local D:\Users[YOURUSERNAME]\AppData\Local\Temp.tmpGm.ps1 - IT seem to be amenable to making a fixed location and decendents unrestricted - but not temporary spaces. This goes for poweshell scripts and exe files (which end up in pixi environments).

matthalstead-mfe avatar Jun 29 '25 22:06 matthalstead-mfe

You mean that you would be able to define the "temp" directory pixi uses to activate these scripts?

baszalmstra avatar Aug 08 '25 09:08 baszalmstra

Yes, being able to set that to a dedicated temp folder for pixi would allow us to treat it differently to the default space.

matthalstead-mfe avatar Aug 09 '25 00:08 matthalstead-mfe