I want to create a virtualenv with python3.4 and pip3 on ubuntu 14.04 but I cannot do it. I've tried in my normal ubuntu14.04LTS machine and in a new one from livecd to check it again from scratch but I cannot make it work. I've tried virtualenv (with and without virtualenvwrapper) and a lot of different commands, tools and scripts I've found around with no luck. Two days lost with this, messing with Python2.7 and specially pip different versions. Let me explain as detailed as possible to help you understand:
As you know, Ubuntu 14.04LTS comes with Python3.4 installed by default and this Python version comes with a tool called py-venv-3.4 so you don't need to use virtual-env and that's the way I'm trying now.
From the clean live-cd I try the following:
sudo apt-get update
sudo pyvenv-3.4 my env
It throws an error:
Error: Command '['/home/ubuntu/Desktop/mi_entorno/bin/python3.4', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1
so I have to create it without pip to make it work.
sudo pyvenv-3.4 --clear --without-pip my_env
sudo source my_env/bin/activate
From now on, I'm inside the virtual environment.
At this point I'm good because inside the environment the python command points to the right version (3.4). First common issue solved. But the problem comes with pip. Of course as I checked "without-pip" pip3 doesn't work and I have to install it.
sudo apt-get install python3-pip
sudo pip3 --version
And the fun comes:
pip 1.5.4 from /usr/lib/python3/dist-packages (python 3.4)
It's pointing the right version of python, but not the inner one but the outer, for no reason (Outside, pip3 is uninstalled by default!). But just to make sure this is wrong I try to install django in the environment and check it.
sudo pip3 install django
sudo python
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'django'
>>>
Great. Now I go outside the environment back to my "normal" shell:
deactivate
python3
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.VERSION
(1, 6, 5, 'final', 0)
>>>
And django works as expected cause pip installed it outside the environment. I'm new to Python packaging dependencies and I've lost close to 20 hours with this in my last two days. Does anyone have a simple way to create a single virtual environment on ubuntu14.04 with python3.4 and pip3? I don't think I'm asking for much :(
Any help is a blessing.