I am having a trouble to deploy my Django project due to Python version differences, so I want to update its version on AWS (16.04.4).

I currently have a virtual environment with Python 3.5, so I am trying to create the new one with Python 3.6. So far, I did:

$ source oldenv/bin/activate
$ pip freeze > requirements.txt
$ deactivate
$ sudo apt-get install python3.6
$ python3.6 -m venv newenv

And, I got an error:

'-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.

I looked at the similar question, and the bug that 14.04 shipped with a broken pyvenv seemed to be already fixed.

Some answers recommend using without-pip, but I want to recover packages by

$ newenv/bin/pip install -r requirements.txt

So, it does not sound like a good idea. What to do?

1 Answer 1


Not sure why the first approach does not work, but here is a work-around:

$ pip install virtualenv --user
$ virtualenv -p python3.6 newenv
$ newenv/bin/pip install -r requirements.txt

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .