Nginx will not uninstall from my server?

August 31, 2014 2.2k views

It seems like something is wrong with my python. I tried installing an upload module for nginx and it wasnt working so I decided to remove it and then re install it.

I posted on stackoverflow

The error I get when trying to remove is

sudo apt-get autoremove nginx
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
0 upgraded, 0 newly installed, 1 to remove and 60 not upgraded.
3 not fully installed or removed.
After this operation, 87.0 kB disk space will be freed.
Do you want to continue [Y/n]? Y
Setting up python2.7-minimal (2.7.3-0ubuntu3.5) ...
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/", line 562, in <module>
  File "/usr/local/lib/python2.7/", line 544, in main
    known_paths = addusersitepackages(known_paths)
  File "/usr/local/lib/python2.7/", line 271, in addusersitepackages
    user_site = getusersitepackages()
  File "/usr/local/lib/python2.7/", line 246, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/usr/local/lib/python2.7/", line 236, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/usr/local/lib/python2.7/", line 577, in get_config_var
    return get_config_vars().get(name)
  File "/usr/local/lib/python2.7/", line 476, in get_config_vars
  File "/usr/local/lib/python2.7/", line 355, in _init_posix
    raise IOError(msg)
IOError: invalid Python installation: unable to open /usr/local/include/python2.7/pyconfig.h (No such file or directory)
dpkg: error processing python2.7-minimal (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
E: Sub-process /usr/bin/dpkg returned an error code (1)

I get the same thing when trying to remove python

I deleted the /etc/nginx/ folder manually like an idiot. I dont want to have to destroy my dropplet.

1 comment
  • Your python installation is a mess.

    I do wonder if you gracefully stopped nginx before removing it. You can do this using the "service" command.

    Next time compile a full version of python and instead of installing libraries to the system, use virtual environments.

2 Answers

Okay sounds good, I am going to create a new droplet and I will make sure to do that. Thanks for the reply.

Have another answer? Share your knowledge.