Issue
I made virtualenv called bitcoin_notifications.py and I'm going to activate it but:
PS C:\Users\piotr> bitcoin_notifications\activate.ps1
class="lang-none prettyprint-override">bitcoin_notifications\activate.ps1 : ```The module
'bitcoin_notifications' could not be loaded. For more information, run
'Import-Module bitcoin_notifications'.``` At line:1 char:1
+ bitcoin_notifications\activate.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (bitcoin_notifications\activate.ps1:String) [],
CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoLoadModule
In the result shared before we read the module could not be loaded and if one wants more info to run another specific command.
Once I run it,
PS C:\Users\piotr> ```Import-Module bitcoin_notifications
Import-Module : The specified module 'bitcoin_notifications' was not
loaded because no valid module file was found in any module
directory.``` At line:1 char:1
+ Import-Module bitcoin_notifications
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (bitcoin_notifications:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : ```Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand```
we can understand there's no module in that directory. I just want to activate the virtualenv. How can I do that?
EDIT: I was copying the method of creating new venv:
pip install virtualenv
mkdir Environments
cd !$
virtualenv bitcoin_notifications
bitcoin_notifications\activate.ps1
Solution
The first lines from activate.ps1 seem to mention the solution:
# This file must be dot sourced from PoSh; you cannot run it
# directly. Do this: . ./activate.ps1
So, the following should work (step 4 and 5 from your method — note that step 5 was missing the dot!):
virtualenv bitcoin_notifications
. .\bitcoin_notifications\Scripts\activate.ps1
NB: Your question mentions venv
but actually is about virtualenv
. Note that these are two similar but different tools. Also, in step 5 you were missing the "Scripts" part. Maybe that was a copy-paste error when writing the question, but make sure to include it.
Answered By - wovano Answer Checked By - Marie Seifert (WPSolving Admin)