mkvirtualenv returns -bash: mkvirtualenv: command not found - python

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!

Related

Why is my $PATH (seemingly) not working when trying to use Python in my terminal?

I know there are many related questions to this problem, but I have yet to come across a solution that's helped me. I'm relatively new to using the terminal, so any and all insight will be massively appreciated!
I have Python3.7 installed on my laptop (Mac M1). In my terminal, when I type
which python3 the output is,
/usr/bin/python3
When I type,
echo $PATH the output is,
”/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin:/usr/local/bin/python3
Finally, when I try,
python3 --version the output is,
python3: error: can't exec '/Applications/Xcode.app/Contents/Developer/usr/bin/python3' (errno=No such file or directory)
I'm very confused because the path in the error isn't in my $PATH.
As you have /usr/bin first in your path, when you just run python3, the shell will pick up /usr/bin/python3. Now, that’s not a real Python interpreter. You can tell that from the fact that its link count is 76. That means that it is one of 76 different names for the same program! These are “shims” that Apple install in /usr/bin, which just hand over control to various developer tools installed as part of Xcode. That is why, when you try to run it, you get an error message talking about Xcode.
I do not fully understand how those shims work, and why the supposedly-Xcode-installed Python is not available on your system, so I will not delve further into that. (My guess is that xcode-select figures somewhere in the answer...)
However, if you have installed Python manually in the /usr/local hierarchy, it might be a good idea to fix your PATH variable so that /usr/local/bin appears before /usr/bin. Theat way, then you run python3, you get the one you installed, not the Apple one.
Thanks to the information provided, I found a solution that works. The following PATH did the trick:
/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin

"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.

Python module (pyenv) installation not working

Trying to install pyenv-win module according to the guide: https://github.com/pyenv-win/pyenv-win/blob/master/README.md
But I'm a command prompt noob in Windows and so I don't know what I'm doing wrong.
I ran "pip install pyenv-win --target "%USERPROFILE%.pyenv" " which seemed to be successful.
But, running "[System.Environment]::SetEnvironmentVariable('PYENV',$env:USERPROFILE + ".pyenv\pyenv-win","User")" did not work. Clearly I'm not picking up what the README author is putting down.
What am I doing wrong?
Just had to reopen a new terminal window. refreshenv didn't work as it said it did.
#DJB - It appears you are missing some backslashes. Try the following instead:
[System.Environment]::SetEnvironmentVariable('PYENV',$env:USERPROFILE + "\.pyenv\pyenv-win\","User")
Edit:
The missing backlashes could simply be because of how StackOverflow's editor handles backslashes (escape characters).
I would also recommend that you use Powershell to run this command instead of the CMD prompt, since that worked for me.

installing jupyter notebooks on macOS

when I do a pip install jupyter notebook, which it seems to install and then I run "jupyter notebook" it tells me that "zsh: command not found: jupyter"
Also does it matter using zsh on macOS?
Any suggestions too fix this issue?
Thanks!
Johnny
Make sure where juypter was installed is on your execution path in the zsh shell. (If "which jupyter" doesn't list a valid path, then that's your problem. :)
Should look something like this, but with the location on your machine:
(jupyter) c-67-188-202-51{rich:~/src/python/udemy/completePythonBootcamp} which jupyter
/Users/rich/src/python/udemy/completePythonBootcamp/jupyter/bin/jupyter
I faced a similar problem. If you've installed it using --user try to add to your path variable in .zshrc a path like this /Users/<name_of_your_user>/Library/Python/3.8/bin. Replace <name_of_your_user> with name of the user and maybe you have another version of python and the folder 3.8 should be replaced with the corresponding version. It helped me. Please check if that works for you and mark the question as solved if it did.

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

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.

Categories