kohya-ss / kohya-ss/sd-scripts
PowerShell Problem! Please help!
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.2k
- Avg merge
- 11m
- Merged PRs (30d)
- 2
Description
I've been trying to copy the Windows installation through Powershell. But It just give me a problem that I haven't seen before.
cd : The 'Set-Location' command was found in the module 'Microsoft.PowerShell.Management', but the module could not be
loaded. For more information, run 'Import-Module Microsoft.PowerShell.Management'.
At line:2 char:1
+ cd sd-scripts
+ ~~
+ CategoryInfo : ObjectNotFound: (Set-Location:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Split-Path : The 'Split-Path' command was found in the module 'Microsoft.PowerShell.Management', but the module could
not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Management'.
At D:\AI\Kohya\venv\Scripts\Activate.ps1:170 char:17
+ $VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
+ ~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Split-Path:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Get-Item : The 'Get-Item' command was found in the module 'Microsoft.PowerShell.Management', but the module could not
be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Management'.
At D:\AI\Kohya\venv\Scripts\Activate.ps1:171 char:16
+ $VenvExecDir = Get-Item -Path $VenvExecPath
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-Item:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
You cannot call a method on a null-valued expression.
At D:\AI\Kohya\venv\Scripts\Activate.ps1:185 char:5
+ $VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Join-Path : The 'Join-Path' command was found in the module 'Microsoft.PowerShell.Management', but the module could
not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Management'.
At D:\AI\Kohya\venv\Scripts\Activate.ps1:138 char:25
+ $pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPat ...
+ ~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Join-Path:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Split-Path : The 'Split-Path' command was found in the module 'Microsoft.PowerShell.Management', but the module could
not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Management'.
At D:\AI\Kohya\venv\Scripts\Activate.ps1:206 char:55
+ ... Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $ ...
+ ~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Split-Path:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Split-Path : The 'Split-Path' command was found in the module 'Microsoft.PowerShell.Management', but the module could
not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Management'.
At D:\AI\Kohya\venv\Scripts\Activate.ps1:207 char:19
+ $Prompt = Split-Path -Path $venvDir -Leaf
+ ~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Split-Path:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Test-Path : The 'Test-Path' command was found in the module 'Microsoft.PowerShell.Management', but the module could
not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Management'.
At D:\AI\Kohya\venv\Scripts\Activate.ps1:77 char:9
+ if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) {
+ ~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Test-Path:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Test-Path : The 'Test-Path' command was found in the module 'Microsoft.PowerShell.Management', but the module could
not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Management'.
At D:\AI\Kohya\venv\Scripts\Activate.ps1:83 char:9
+ if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) {
+ ~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Test-Path:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Test-Path : The 'Test-Path' command was found in the module 'Microsoft.PowerShell.Management', but the module could
not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Management'.
At D:\AI\Kohya\venv\Scripts\Activate.ps1:89 char:9
+ if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) {
+ ~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Test-Path:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Test-Path : The 'Test-Path' command was found in the module 'Microsoft.PowerShell.Management', but the module could
not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Management'.
At D:\AI\Kohya\venv\Scripts\Activate.ps1:95 char:9
+ if (Test-Path -Path Env:VIRTUAL_ENV) {
+ ~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Test-Path:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Test-Path : The 'Test-Path' command was found in the module 'Microsoft.PowerShell.Management', but the module could
not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Management'.
At D:\AI\Kohya\venv\Scripts\Activate.ps1:100 char:9
+ if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) {
+ ~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Test-Path:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Copy-Item : The 'Copy-Item' command was found in the module 'Microsoft.PowerShell.Management', but the module could
not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Management'.
At D:\AI\Kohya\venv\Scripts\Activate.ps1:229 char:5
+ Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUA ...
+ ~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Copy-Item:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Test-Path : The 'Test-Path' command was found in the module 'Microsoft.PowerShell.Management', but the module could
not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Management'.
At D:\AI\Kohya\venv\Scripts\Activate.ps1:240 char:5
+ if (Test-Path -Path Env:PYTHONHOME) {
+ ~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Test-Path:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Copy-Item : The 'Copy-Item' command was found in the module 'Microsoft.PowerShell.Management', but the module could
not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Management'.
At D:\AI\Kohya\venv\Scripts\Activate.ps1:246 char:1
+ Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH
+ ~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Copy-Item:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
I'm a bit lost at the moment. Is there something missing that I haven't looked?
Contributor guide
No contributing guide indexed for this repository
Research direction
The report points to D:\AI\Kohya\venv\Scripts\Activate.ps1 and PowerShell's Microsoft.PowerShell.Management module; start by reproducing the activation sequence and checking the stated Import-Module command. Completion would require a confirmed cause plus a reproducible fix or documented prerequisite for the Windows setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell, python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 15/100