I am trying to configure virtualenvwrapper with django1.4. I am following this post and am trying to do what it says there:
Admin$ pip install virtualenvwrapper
Requirement already satisfied (use --upgrade to upgrade): virtualenvwrapper in /usr/local/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /usr/local/lib/python2.7/site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): virtualenv-clone in /usr/local/lib/python2.7/site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): stevedore in /usr/local/lib/python2.7/site-packages (from virtualenvwrapper)
Admin$ export WORKON_HOME=$HOME/.virtualenvs
Admin$ export PROJECT_HOME=$HOME/Users/Admin
Admin$ source /usr/local/bin/virtualenvwrapper.sh
/usr/bin/python: No module named virtualenvwrapper
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenv has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is
set properly.
Admin$ mkvirtualenv --python=python2.7 mynewenv
The executable /Users/Admin/python2.7 (from --python=/Users/Admin/python2.7) does not exist
Can anyone help me figure out how to get virtualenvwrapper set up on my osx snow leopard installation? Thanks so much for the help!
It looks like you're trying to use python2.7, but you haven't told virtualenvwrapper about that. Try adding export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python2.7 (assuming that's where your python2.7 install is located) before source /usr/local/bin/virtualenvwrapper.sh - i.e.
Admin$ export WORKON_HOME=$HOME/.virtualenvs
Admin$ export PROJECT_HOME=$HOME/Users/Admin
Admin$ export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python2.7
Admin$ source /usr/local/bin/virtualenvwrapper.sh
Related
I would like to use pip. Here I go:
$ python -m ensurepip --default-pip
Looking in links: /tmp/tmpd7_yb3oj
Requirement already satisfied: setuptools in /usr/local/lib/python3.8/site-packages (41.2.0)
Requirement already satisfied: pip in /usr/local/lib/python3.8/site-packages (19.2.3)
$ pip --version
-bash: pip: command not found
what did i miss?
You can also use /usr/local/lib/pip3 install . Generally accessible pip3 is stored at /usr/bin/pip3 and same is with python3 at /usr/bin/python3.
I have used virtualenvwrapper for some months now, and today I installed python2.6 from source to use tox.
All of a sudden I get:
$ cdwebapi
/usr/local/bin/python: No module named virtualenvwrapper
/usr/local/bin/python: No module named virtualenvwrapper
/usr/local/bin/python: No module named virtualenvwrapper
/usr/local/bin/python: No module named virtualenvwrapper
Wrapper is installed:
$ sudo pip install virtualenvwrapper
The directory '/home/cchilders/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/cchilders/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied (use --upgrade to upgrade): virtualenvwrapper in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): stevedore in /usr/local/lib/python2.7/dist-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): virtualenv-clone in /usr/local/lib/python2.7/dist-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /usr/local/lib/python2.7/dist-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): pbr>=1.6 in /usr/local/lib/python2.7/dist-packages (from stevedore->virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): six>=1.9.0 in /home/cchilders/.local/lib/python2.7/site-packages (from stevedore->virtualenvwrapper)
If I try to source again:
$ src
/usr/local/bin/python: No module named virtualenvwrapper
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python and that PATH is
set properly.
--no-deps: command not found
This is what I sourced:
# VIRTUALENVWRAPPER
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/work_projects
source /usr/local/bin/virtualenvwrapper.sh
export PATH=$PATH:/usr/local/bin/virtualenvwrapper.sh
My venv still exists:
$ which python
/home/cchilders/.virtualenvs/mysite/bin/python
(mysite) cchilders:~/work_projects/core/unver/mysite (master)
$ which pip
/home/cchilders/.virtualenvs/mysite/bin/pip
Changing bashrc to:
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/work_projects
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
source /usr/local/bin/virtualenvwrapper.sh
export PATH=$PATH:/usr/local/bin/virtualenvwrapper.sh
causes:
$ cdwebapi
/usr/bin/python3: Error while finding spec for 'virtualenvwrapper.hook_loader' (<class 'ImportError'>: No module named 'virtualenvwrapper')
/usr/bin/python3: Error while finding spec for 'virtualenvwrapper.hook_loader' (<class 'ImportError'>: No module named 'virtualenvwrapper')
/usr/bin/python3: Error while finding spec for 'virtualenvwrapper.hook_loader' (<class 'ImportError'>: No module named 'virtualenvwrapper')
/usr/bin/python3: Error while finding spec for 'virtualenvwrapper.hook_loader' (<class 'ImportError'>: No module named 'virtualenvwrapper')
I just removed and reinstalled virtualenvwrapper and same issue. How can I calm these messages and fix the wrapper? Thank you
I've got several versions of python on my mac. I woud like python3 to be the default version and also would like to use virtualenv and virtualenvwrapper.
So, I've put an alias in my ~/.zshrc
alias python='python3'
I've also added the following to my ~/.zshrc
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
However, when I run mkvirtualenv i get the following error:
▶ mkvirtualenv cv
mkvirtualenv:79: /usr/local/bin/virtualenv: bad interpreter: /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Ver: no such file or directory
I get the same error even if I pass the version of python:
▶ mkvirtualenv -p /usr/local/bin/python3 cv
mkvirtualenv:79: /usr/local/bin/virtualenv: bad interpreter: /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Ver: no such file or directory
Some more command line output showing versions and what I've installed:
▶ python --version
Python 3.5.0
~
▶ pip3.5 install virtualenv
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages
~
▶ pip3.5 install virtualenvwrapper
Requirement already satisfied (use --upgrade to upgrade): virtualenvwrapper in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages
Requirement already satisfied (use --upgrade to upgrade): stevedore in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): virtualenv-clone in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): six>=1.9.0 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from stevedore->virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): pbr<2.0,>=1.6 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from stevedore->virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): argparse in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from stevedore->virtualenvwrapper)
~
▶ echo $VIRTUALENVWRAPPER_PYTHON
/usr/local/bin/python3
This is what /usr/local/bin/virtualenv has
▶ more /usr/local/bin/virtualenv
#!/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
# EASY-INSTALL-ENTRY-SCRIPT: 'virtualenv==12.0.5','console_scripts','virtualenv'
__requires__ = 'virtualenv==12.0.5'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('virtualenv==12.0.5', 'console_scripts', 'virtualenv')()
)
Update
~
▶ virtualenv --no-site-packages --distribute -p /usr/bin/python3.3 ~/.virtualenvs/pywork3
zsh: /usr/local/bin/virtualenv: bad interpreter: /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Ver: no such file or directory
Use the command pyvenv with python 3.
Example:
pyvenv venv
source venv/bin/activate
I have recently just started the foray into running cygwin on windows.
Attempting to setup a development environment, and noticing some oddities.
so for example, I have installed virtualenvwrapper but when i open a new cygwin terminal i get (after setting appropriate lines in my .bashrc)
-bash: /usr/local/bin/virtualenvwrapper.sh: No such file or directory
so i attempt to reinstall virtualenvwrapper using pip and i get
$ pip install virtualenvwrapper
Requirement already satisfied (use --upgrade to upgrade): virtualenvwrapper in c:\python27\lib\site-packages
Requirement already satisfied (use --upgrade to upgrade): virtualenv in c:\python27\lib\site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): virtualenv-clone in c:\python27\lib\site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): stevedore in c:\python27\lib\site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): argparse in c:\python27\lib\site-packages (from stevedore->virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): six>=1.9.0 in c:\python27\lib\site-packages (from stevedore->virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): pbr!=0.7,<1.0,>=0.6 in c:\python27\lib\site-packages (from stevedore->virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): pip in c:\python27\lib\site-packages (from pbr!=0.7,<1.0,>=0.6->stevedore->virtualenvwrapper)
What gives? why is it installing it to the windows directory? sure enough i can see virtualenvwrapper is not installed in c:/cygwin64/lib/Python2.7/site-packages/
in fact that directory is completely bare.
I expected to see the updated version of pip i installed. it's of course in the windows directory.
I had previously installed virtualenvwrapper via pip on windows, but my understanding is that the windows environment and the cygwin terminal are totally seperate and shouldn't know about each other(?)
as you might expect this is also wrecking havoc with other packages.
for example attempting to install uwsgi i get this error:
Collecting uWSGI==2.0.7 (from -r _pip/requirements.txt (line 52))
Downloading uwsgi-2.0.7.tar.gz (772kB)
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "c:\cygwin64\tmp\pip-build-n5cvur\uWSGI\setup.py", line 3, in <module>
import uwsgiconfig as uc
File "uwsgiconfig.py", line 8, in <module>
uwsgi_os = os.uname()[0]
AttributeError: 'module' object has no attribute 'uname'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\cygwin64\tmp\pip-build-n5cvur\uWSGI
which i understand is because os.uname doesn't exist on windows. Why is the pip installer running setup using windows python?
------- update -------
I think i found the root cause
$ which pip
/c/Python27/Scripts/pip
so my questions are:
why is pip the windows one by default? or how did this happen?
-------- Update 2 ----------
i just discovered that the default PATH env variable in cygwin appends the windows one. sure enough the path to the windows pip is there.
$ echo $PATH
Is this expected? if so, why is this desireable? doesn't it increase the chance of unintentional conflicts like this one?
So I'll just leave this here as a warning to n00bs like myself.
cygwin appends the windows path to the cygwin terminal PATH env variable.
if you already have pip installed on windows and it is on your path it will work but with unexpected results like above.
to check make sure you do
which python
which pip
to confirm what version you are running.
only python 2.7.9 and up include pip by default and the package included in cygwin isn't there yet. so you will most likely need to install pip manually
if you had a cygwin terminal open, you will need to close all windows otherwise it remembers the path to the windows pip.
See this answer to setup easy_install in cygwin's python install.
https://serverfault.com/questions/7282/how-to-run-easy-install-in-cygwin
Once that is done, you can use easy_install to get pip.
I installed virtualenvwrapper but when I run which virtualenvwrapper I get nothing.
When I try to do a reinstall using pip3, here's what I get.
~: $ pip3 install virtualenvwrapper
Requirement already satisfied (use --upgrade to upgrade): virtualenvwrapper in /usr/local/lib/python3.4/site-packages
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /usr/local/lib/python3.4/site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): virtualenv-clone in /usr/local/lib/python3.4/site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): stevedore in /usr/local/lib/python3.4/site-packages (from virtualenvwrapper)
Cleaning up...
What am I missing?
After installing virtualenvwrapper, you need to
export WORKON_HOME=~/Envs
source /usr/local/bin/virtualenvwrapper.sh
to get these functions (such as virtualenvwrapper, mkvirtualenv, cdvirtualenv, ...).
To make it permanent, just put two lines above to your ~/.bashrc file.