Installing virtualenvwrapper-powershell in Windows 8.1, import-module failing

4.6k views Asked by At

I'm trying to follow the guide here, and I'm stuck at Import-Module virtualenvwrapper, where PowerShell keeps giving me the error:

import-module : The specified module 'virtualenvwrapper' was not loaded because no valid module file was found in any module directory.

At line:1 char:1

  • import-module virtualenvwrapper
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : ResourceUnavailable: (virtualenvwrapper:String) [Import-Module], FileNotFoundException
    • FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

I'm at a real loss at what to do here, because as far as I can tell from this guide and others this step should be rather straight-forward. Googling this problem hasn't really helped me here since I can't find anyone else with this problem.

2

There are 2 answers

1
tomato On BEST ANSWER

Well, I've actually figured my way around this issue. I guess the pip install never placed the files in a correct module directory for PowerShell. I created a WindowsPowerShell\Modules folder in my documents folder, which did not exist but was listed in my PowerShell modules path. I then took the VirtualEnvWrapper directory from the virtualenvwrapper-powershell bitbucket and copied it into the Modules folder I just created.

Then I had to use Set-ExecutionPolicy Unrestricted instead of Set-ExecutionPolicy RemoteSigned as shown in the guide, but I was then able to do the import-module and use everything needed. I'm not sure why I had to all of this manually instead of pip having done it, but I just hope this can somehow help someone else.

0
Raz On

Thank you for coming back with a solution. This helped me today. I would also like to add that I had to do an extra step to make it work on Windows 10.

I was getting an error trying to run:

Import-Module virtualenvwrapper

"Get-Content : Cannot find path 'Function:\TabExpansion' because it does not exist."

The solution that I found, was to edit VirtualenvWrapperTabExpansion.psm1 on line 15 from this:

$_oldTabExpansion = Get-Content Function:TabExpansion

to this:

$_oldTabExpansion = Get-Content Function:TabExpansion2