Issue
I'm trying to set up an EC2 instance with django but I'm having issues installing anything. I ran sudo apt-get update
and upgrade -y
. But when I try to run pip which it claims is installed I get this:
ubuntu@ip-172-31-62-51:/home$ pip
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
When I try sudo apt-get upgrade -y
I get this:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
linux-headers-virtual linux-image-virtual linux-virtual
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up python-pip (1.0-1build1) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 36, in <module>
from debpython.version import SUPPORTED, debsorted, vrepr, \
File "/usr/share/python/debpython/version.py", line 24, in <module>
from ConfigParser import SafeConfigParser
ImportError: No module named ConfigParser
dpkg: error processing python-pip (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up python-twisted-names (11.1.0-1) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 36, in <module>
from debpython.version import SUPPORTED, debsorted, vrepr, \
File "/usr/share/python/debpython/version.py", line 24, in <module>
from ConfigParser import SafeConfigParser
ImportError: No module named ConfigParser
dpkg: error processing python-twisted-names (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
python-pip
python-twisted-names
E: Sub-process /usr/bin/dpkg returned an error code (1)
I actually get this error anything I try to use apt-get for anything.
Also anytime I try to actually use pip I get this:
ubuntu@ip-172-31-62-51:/home$ sudo pip install virtualenv
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
When I try to use apt-add-repository ppa:chris-lea/nodejs (since sudo apt-get install nodejs
doesn't work) I get:
ubuntu@ip-172-31-62-51:/home$ sudo apt-add-repository ppa:chris-lea/nodejs
File "/usr/bin/apt-add-repository", line 37
print _("The %s named '%s' has no PPA named '%s'"
^
SyntaxError: invalid syntax
I had it work before, but I was having the same problems with pip and such, I tried a fresh instance using Ubuntu Server 12 rather than 14, but I'm having same problems. Although on 14 I couldnt get nginx to install and on 12 I could. I was able to install ruby, as well as ruby gems like sass/scss. I got node installed without the new repo. npm won't install via apt-get though, same error as before. Why is this happening? I can't even get virtualenv installed, I can't use this for development as it doesn't even have all the items I need for the production product. Is ubuntu 12 the problem (although 14 had issues too). Should I switch to another AMI?
Any idea why things aren't working right?
Thanks
EDIT: I get the same error if i try to remove pip with apt.
Solution
Switching to a fresh EC2 instance fix the problem.
Answered By - shenk