Installing Django in virtualenv not working - django

I want to install Django (just the latest version) inside my virtualenv directory:
C:\Users\Beheerder\Desktop\Projects\ProjectRango
Now I did activate my virtualenv and tried:
$ pip install django
After that the error shows:
Requirement already satisfied (use --upgrade to upgrade): django in c:\python34\lib\site-packages
Cleaning up...
which looks like it's trying to install it again inside the main folder instead of inside my virtualenv.
Any suggestions on how to fix this?

Related

virtual env python 3.5 only finds django python 2.7

I have created python 3.5.2 virtual environment ("python --version" confirms that)
but when i try to install django using "pip install django~=1.10.0" I get this message:
Requirement already satisfied: django~=1.10.0 in /usr/local/lib/python2.7/dist-packages
How can I get django version that agrees with the python version in my venv?
Personally I use conda to manage environments and I'm not really familiar with virtualenv, but a few things to check.
I bet you need to use pip3 not pip (aka pip2) to install django that way it will be installed in your python 3 env.
Probabily you have already installed django outside the venv with python2.
just write see in the pip list if django is installed.
Then uninstall, enter in the venv and reinstall django with python3
Ok - so I figured out what happened. I have installed django using sudo pip install. Even though I was in the venv (created with python3) this has resulted in reference to django outside the venv. Sooo...it was an interesting thing to learn I guess.

Django not installed in venv?

Would anyone know possible reasons why Django is being installed in the global site package and not my venv's site package folder?
Here's my set up and what I did, this is a bit detailed since I'm new to Python/Django and not sure which information is important:
Python 3.3 is installed in c:\python33
I have virtualenv, pip, easy_install installed in C:\Python33\Scripts.
My venv is c:\users\username\projects\projB
This venv was created using pyvenv, not virtualenv.
I activated the venv.
I changed directory to C:\Python33\Scripts to run "pip install django".
Django was created inside C:\Python33\Lib\site-packages and not inside C:\users\username\projects\projB\Lib\site-packages.
Do I need to install pip inside my venv and use that to install Django?
You can specify in your virutalenv wich python version you whant:
$ virtualenv -p <PATH TO PYTHON VERSION> my_virtualenv
Then:
$ source my_virtualenv/bin/activate
$ pip install Django==1.5.2
This will install the good version of django in your virtualenv according to your python version.
Thanks to virtualanv, you will be able to save/freeze and install your environement on another machine:
$ pip freeze > requirement.txt
$ pip install -r requirement.txt
You will see in the requirement.txt file the django dependency.
Pip should be installed when you create the virtual environment. Don't change directory into C:\Python33\Scripts before running pip. It looks like that means you use the base install's pip instead of your virtual environment's pip.
You should be able to run pip from any other directory. However I'm not familiar with python on Windows, so I'm not certain that pip is added to the path when you activate the environment. If that doesn't work, you'll have to change directory into the bin directory of your virtual environment, then run pip.
What happened to me was that I was trying to install django from outside the environment directory/folder.
So make sure you are inside the environment directory and then use pip install django

No model named metron

I am looking to use Pinax to help speedup the process of creating a website in Django.
I started out by following the guide as follows.
[***#vps-1087814-7905 sites]# virtualenv mysite-env
[***#vps-1087814-7905 sites]# source mysite-env/bin/activate
(mysite-env)[root#vps-1087814-7905 sites]# django-admin.py startproject --template=https://github.com/pinax/pinax-project-account/zipball/master Project_x
(mysite-env)[root#vps-1087814-7905 sites]# cd Project_x
(mysite-env)[root#vps-1087814-7905 Project_x]# pip install -r requirements.txt
(mysite-env)[***#vps-1087814-7905 Project_x]# pip install metron
Requirement already satisfied (use --upgrade to upgrade): metron in /****/mysite-env/lib/python2.7/site-packages
So. Where did I go wrong? Metron is clearly installed, but for some stupid reason it claims that it is not installed. Any ideas?
Include metron in your apps variable in your settings.py. :)
INSTALLED_APPS = (...,"metron")
Try to install Metron in your virtual environment.
pip install metron

How to install image processing just for a virtualenv project with pip for django

But I'm looking to install freetype, libjpeg, PIL build to add image processing to my django projects I've followed this installation http://dakrauth.com/blog/entry/python-and-django-setup-mac-os-x-leopard/ which installs it site wide but I can get it inside my virtualenv project.
Do I just cd into the working directory of the virtualenv (project) and install it there and will it just be available for that project or do I use pip? I couldn't find the packages in the pip repository. Can someone enlighten me please.
curl -O http://pypi.python.org/packages/source/d/distribute/distribute-0.6.21.tar.gz
tar -xzvf distribute-0.6.21.tar.gz
cd distribute-0.6.21
python distribute_setup.py
easy_install pip
pip install virtualenv
virtualenv --distribute --no-site-packages [myproject]
cd [myproject]
source bin/activate (this activates the sandbox that virtualenv created)
pip install django mysql-python
Go to the working directory of the virtualenv and then run
$ source bin/activate
This will set that virtual environment as your active one. So now that it's active, you can install what you want, either manually (by following those steps on the site you linked to) or with pip and it will automatically install it into your active virtualenv.
If you then, say, run python manage.py runserver while the same virtualenv is active, django will have access to your newly installed package. Once you want to unset that virtual environment as your active one, simply do deactivate.
I ran into something similar; what I did was install it into the default directory (e.g. Python27/Lib/site-packages) then cut and paste all the new files put there into the created environment's site-packages. Hacky, but works.
After that you can follow EEVIAC's instructions to actually get your server running.

Pip with virtualenv not upgrading Django

I'm using pip with virtualenv --no-site-packages --distribute and am trying to upgrade Django. pip install -U Django should upgrade it according to the docs I found. However, it simply finds the current Django installation and stops.
Ideally, I would like to be able to specify the version I want to upgrade to. Currently, I'm stuck with modifying the requirements file, then blowing over the old virtualenv and starting a new one. However, I'd be happy just getting pip install -U to upgrade to latest version.
Check your build/ directory in your virtualenv path. Delete the Django/ dir there and try to run pip install --upgrade django again.