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

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.

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

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.

Related

"manim: command not found". Un and Reinstalled Manim and now having issues

/bin/sh: manim: command not found
From other answers I've found it seems to be an issue with path or directory? I'm not sure though and I don't want to make things worse. Does anyone know how to fix this? Mac user btw.
For the sake of completeness: we resolved this question on Manim's Discord server. The main problem was that the executables of anaconda's Python were not added to the system's PATH.
Resolution: either
change the call to the executable manim to the module python -m manim (where python is the correct Python version), or
add the /Users/username/opt/anaconda3/bin to the PATH.
If you use Manim Community Edition, there is a change from manim to manimce.
So on the command line, please use the following instead.
$ manimce
Please have a look at https://stackoverflow.com/a/74975758/20905930
The anaconda path was in .zshrc but manim was not found. I added:
/Users/username/opt/anaconda3/manimenvelope/bin
to PATH and manim now works normally.

How to change the path in google colab?

I'm currently working on getting better acquainted with Google Colab and using it as a coding environment with python. I'm trying to setup an ipynb script for testing. As part of this, I'm trying to install pipenv. I'm following the directions from (https://docs.python-guide.org/dev/virtualenvs/#lower-level-virtualenv)
Part of the directions state to change the path from ~/.local to ~/.local/bin. I ran command: "!python -m site --user.base" to determine the path, and it returned "/root/.local" I'm not very familiar with Colab so I don't know if a bin file already exist or if I need to make one or something. I'm also unsure of whats the safest and what best practices should be followed with respect to Colab when setting the path. Typically I modify the path on my windows machine via the GUI, and I've never had to change it using the command line before. Thanks in advance to anyone who knows how to do this.
Okay, here is a copy of the error message I was getting from Google Collaboratory while trying to install pipenv:
WARNING: The script virtualenv is installed in '/root/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The script virtualenv-clone is installed in '/root/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The scripts pipenv and pipenv-resolver are installed in '/root/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Since I wasn't really sure what these warnings meant, I ran the pipenv install command anyway:
!pipenv install requests
This resulted in an error message basically saying the the command pipenv could not be found.
I don't have any experience setting path variables in Colab or from the command line for that matter, so I reviewed the following stackoverflow question from another user [link]: How can I insert path (environmental variable) for geckodriver in goggle colab? to try and get an idea of how to go about it. After reviewing it, I ran the following command:
!cp /root/.local/bin /usr/local
This resulted in an auto comment:
cp: -r not specified; omitting directory '/root/.local/bin'
As I said before, I don't have any experience with setting system variables from command line, and everything I've every read about it comes with a warning saying something like: failure to do it properly can permanently damage your machine. So I was hesitant to just tack on the "-r" flag.
After doing a web search I found a good explanation of the -r (recursive copy) flag from this site [link]:https://superuser.com/questions/839719/why-is-r-recursive-necessary-when-copying-a-directory-in-linux/839749 and I ran the following command:
!cp -r /root/.local/bin /usr/local
This ran without incident and I called:
!pipenv install requests
Success! It ran without incident.
Since I want to save my results from the script I'm writing, I had previously mounted a virtual drive using:
from google.colab import drive
from google.colab import files
drive.mount('/content/drive')
I also created a new directory in my google drive to hold this script and any future data files etc... I was not in the directory when I ran the above code and I don't know if that will be a problem. I'm not really familiar with Python and its virtual environments. If anyone does know if this will be an issue, please feel free to message me. Thank you to everyone who read this question and attempted to answer, or even contemplated what the answer could be.

'pip' is not recognized as an internal or external command, operable program or batch file

I'm trying to install Tweepy using pip, but I keep getting this as the response:
I've seen similar problems and people always suggest adding C:\Python34\Scripts to your PATH. Here is what happens when I try and do that:
Then when I do echo %PATH% it doesn't show the path that I added. Using pip still does not work.
How do I make it to where I am able to use pip? I looked through multiple other questions that were VERY similar to mine, but none of the solutions worked.
Thanks for the help in advance!
I would recommend using this guide for adding a new folder to your system path, normally works for me. It goes through a GUI instead of adding through the command line.
http://windowsitpro.com/systems-management/how-can-i-add-new-folder-my-system-path
A second solution is that you can just cd into the directory that contains pip and use it from there each time, but thats only if nothing else works.
It seems like you are using windows so you need to download the get-pip.py and run like this.
Path_to_your_Python.exe\python.exe Path_to_get-pip.py\get-pip.py tweepy
Here is the link for download get-pip.py

mkvirtualenv returns -bash: mkvirtualenv: command not found

I installed virtualenv and virtualenvwrapper successfully with pip. I'm running OSX Yosemite. I tested it when I first installed it (following instructions at newcoder.io)and it worked, but now it doesn't. I tried using the "source" command: source "/Library/Python/2.7/site-packages/virtualenv.sh" but I get the response "-bash: cd: python: No such file or directory."
Did I tweak something that knocked it offline? Thanks in advance for help!
OK, I got it, I think! I had been using "source" plus the path that the install program told me the program was in (see above) instead of the one that is recommended in similar questions. (OK, so I was overthinking this one). Anyway. I'm happy, I got it on my own!

Install astLib python module without root access

However my school's computer lab put python together, astLib is not a module it contains. I want to install it in/through my home directory. Im very unfamiliar with the use of unix commands.(all I know how to do is change directory, and open python.) I have a website that tries to explain how to do it, but i dont know what to type into my directory, and i dont know how to do the second step which is to add something into .bashrc. Ive seen one stackoverflow question, in which the user had a similar problem, but was told to ask an admin. The lab's admin is no longer on the faculty, and they are looking into a replacement sometime in the next year.
Here is the link: http://astlib.sourceforge.net/?q=install0.3
I am very new to programing, so the instructions on that link were unclear to me.
My question is, what do i have to type into my command prompt, and how do i add the code shown in the link to .bashrc?
Edit: Ok, so now I learned how to go into the .bashrc file, and I copy/paste the line of code into there. I ran the command throught the command prompt, but i get an error message
error: package directory 'astLib' does not exist
Did I put the downloaded file in the wrong directory? (im pretty sure its in my home directory) Did I put the .bashrc code in the wrong place?(i just put it on the bottom of the code)
If you want to install astLib as system module, I recomend that you install it by pip install way
If you don't want to, you should install virtualenv, create you own environment and then install it there.
Maybe this link helps you to install virtualenv: Comprehensive beginner's virtualenv tutorial?
Edit: I've re-read the question and you have only the virtualenv's option

Categories