Install with gunicorn3 not gunicorn

1,255 views
Skip to first unread message

Brian Candler

unread,
Jun 13, 2017, 8:25:18 AM6/13/17
to NetBox
FYI, there's a really nasty problem if you install netbox under ubuntu 16.04 with python 3, and then follow the instructions at https://netbox.readthedocs.io/en/stable/installation/web-server/ which say to do

apt-get install -y gunicorn supervisor

Actually you need to install "gunicorn3" not "gunicorn".

If you try to install "gunicorn" then get into a horribly broken state:

# apt-get install -y gunicorn supervisor
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-gunicorn python-meld3
  python-minimal python-pkg-resources python-setuptools python2.7 python2.7-minimal
Suggested packages:
  gunicorn-examples python-gevent python-pastedeploy python-setproctitle python-tornado
  python-doc python-tk python-setuptools-doc python2.7-doc binfmt-support supervisor-doc
The following NEW packages will be installed:
  gunicorn libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-gunicorn
  python-meld3 python-minimal python-pkg-resources python-setuptools python2.7 python2.7-minimal
  supervisor
0 upgraded, 13 newly installed, 0 to remove and 0 not upgraded.
Need to get 4,575 kB of archives.
After this operation, 19.7 MB of additional disk space will be used.
...
Preparing to unpack .../python_2.7.11-1_amd64.deb ...
update-alternatives: warning: forcing reinstallation of alternative /usr/bin/python3 because link group python is broken
Unpacking python (2.7.11-1) ...
...
Setting up python (2.7.11-1) ...
Setting up python-pkg-resources (20.7.0-1) ...
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, 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 package python-pkg-resources (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python-setuptools:
 python-setuptools depends on python-pkg-resources (= 20.7.0-1); however:
  Package python-pkg-resources is not configured yet.

dpkg: error processing package python-setuptools (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-gunicorn:
 python-gunicorn depends on python-pkg-resources; however:
  Package python-pkg-resources is not configured yet.
 python-gunicorn depends on python-setuptools; however:
  Package python-setuptools is not configured yet.

dpkg: error processing package python-gunicorn (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of gunicorn:
 gunicorn depends on python-gunicorn (= 19.4.5-1ubuntu1); however:
  Package python-gunicorn is not configured yet.
 gunicorn depends on python-pkg-resources; however:
  Package python-pkg-resources is not configured yet.
 gunicorn depends on python-setuptools; however:
  Package python-setuptools is not confNo apport report written because the error message indicates its a followup error from a previous failure.
                                               No apport report written because the error message indicates its a followup error from a previous failure.
                                                       No apport report written because MaxReports is reached already
                   igured yet.

dpkg: error processing package gunicorn (--configure):
 dependency problems - leaving unconfigured
Setting up python-meld3 (1.0.2-2) ...
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, 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 package python-meld3 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of supervisor:No apport report written because MaxReports is reached already

 supervisor depends on python-meld3; however:
  Package python-meld3 is not configured yet.
 supervisor depends on python-pkg-resources; however:
  Package python-pkg-resources is not configured yet.

dpkg: error processing package supervisor (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 python-pkg-resources
 python-setuptools
 python-gunicorn
 gunicorn
 python-meld3
 supervisor
E: Sub-process /usr/bin/dpkg returned an error code (1)

At this point, attempts to remove the broken packages also fail:

# apt-get remove --purge gunicorn supervisor
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  python-gunicorn python-meld3 python-pkg-resources python-setuptools
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  gunicorn* supervisor*
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
6 not fully installed or removed.
After this operation, 1,450 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 102594 files and directories currently installed.)
Removing gunicorn (19.4.5-1ubuntu1) ...
Purging configuration files for gunicorn (19.4.5-1ubuntu1) ...
Removing supervisor (3.2.0-2ubuntu0.1) ...
Purging configuration files for supervisor (3.2.0-2ubuntu0.1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up python-pkg-resources (20.7.0-1) ...
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, 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 package python-pkg-resources (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python-setuptools:
 python-setuptools depends on python-pkg-resources (= 20.7.0-1); however:
  Package python-pkg-resources is not configured yet.

dpkg: error processing package python-setuptools (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-gunicorn:
 python-gunicorn depends on python-pkg-resources; however:
  Package python-pkg-resources is not configured yet.
 python-gunicorn depends on python-setuptools; however:
  Package python-setuptools is not configured yet.

dpkg: error processing package python-gunicorn (--configure):
 dependency problems - leaving unconfigured
Setting up python-meld3 (1.0.2-2) ...
No apport report written because the error message indicates its a followup error from a previous failure.
        No apport report written because the error message indicates its a followup error from a previous failure.
                Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, 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 package python-meld3 (--configure):
 subprocess installed post-installation script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 python-pkg-resources
 python-setuptools
 python-gunicorn
 python-meld3
E: Sub-process /usr/bin/dpkg returned an error code (1)

# apt-get autoremove --purge
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  python-gunicorn* python-meld3* python-pkg-resources* python-setuptools*
0 upgraded, 0 newly installed, 4 to remove and 0 not upgraded.
4 not fully installed or removed.
After this operation, 1,570 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 102460 files and directories currently installed.)
Removing python-gunicorn (19.4.5-1ubuntu1) ...
Purging configuration files for python-gunicorn (19.4.5-1ubuntu1) ...
Removing python-meld3 (1.0.2-2) ...
  File "/usr/bin/pyclean", line 63
    except (IOError, OSError), e:
                             ^
SyntaxError: invalid syntax
dpkg: error processing package python-meld3 (--purge):
 subprocess installed pre-removal script returned error exit status 1
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, 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 while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Removing python-setuptools (20.7.0-1) ...
Removing python-pkg-resources (20.7.0-1) ...
  File "/usr/bin/pyclean", line 63
    except (IOError, OSError), e:
                             ^
SyntaxError: invalid syntax
dpkg: error processing package python-pkg-resources (--purge):
 subprocess installed pre-removal script returned error exit status 1
Errors were encountered while processing:
 python-meld3
 python-pkg-resources
E: Sub-process /usr/bin/dpkg returned an error code (1)

# dpkg-query -l | grep meld
pF  python-meld3                       1.0.2-2                                    all          HTML/XML templating system for Python
# dpkg-query -l | grep python-pkg-resources
pF  python-pkg-resources               20.7.0-1                                   all          Package Discovery and Resource Access using pkg_resources

Looking at the syntax error for pyclean, I suspect that it's something to do with redirecting "python" to "python3" using update-alternatives, as described at https://netbox.readthedocs.io/en/stable/installation/netbox/

So I put it back using:
update-alternatives --install /usr/bin/python python /usr/bin/python2 2
apt-get remove --purge python-meld3 python-pkg-resources

and indeed, now the package removal was successful.

Then I repeated with:
update-alternatives --install /usr/bin/python python /usr/bin/python2 0
apt-get install -y gunicorn3 supervisor

Unfortunately I get a similar problem:

# apt-get install -y gunicorn3 supervisor
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  python-meld3 python-pkg-resources python3-gunicorn
Suggested packages:
  gunicorn-examples python3-pastedeploy python3-setproctitle python3-tornado python-setuptools
  supervisor-doc
The following NEW packages will be installed:
  gunicorn3 python-meld3 python-pkg-resources python3-gunicorn supervisor
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 98.6 kB/491 kB of archives.
After this operation, 2,482 kB of additional disk space will be used.
Get:1 http://gh.archive.ubuntu.com/ubuntu xenial/universe amd64 python3-gunicorn all 19.4.5-1ubuntu1 [81.2 kB]
Get:2 http://gh.archive.ubuntu.com/ubuntu xenial/universe amd64 gunicorn3 all 19.4.5-1ubuntu1 [17.4 kB]
Fetched 98.6 kB in 25s (3,821 B/s)
Selecting previously unselected package python3-gunicorn.
(Reading database ... 102296 files and directories currently installed.)
Preparing to unpack .../python3-gunicorn_19.4.5-1ubuntu1_all.deb ...
Unpacking python3-gunicorn (19.4.5-1ubuntu1) ...
Selecting previously unselected package gunicorn3.
Preparing to unpack .../gunicorn3_19.4.5-1ubuntu1_all.deb ...
Unpacking gunicorn3 (19.4.5-1ubuntu1) ...
Selecting previously unselected package python-pkg-resources.
Preparing to unpack .../python-pkg-resources_20.7.0-1_all.deb ...
Unpacking python-pkg-resources (20.7.0-1) ...
Selecting previously unselected package python-meld3.
Preparing to unpack .../python-meld3_1.0.2-2_all.deb ...
Unpacking python-meld3 (1.0.2-2) ...
Selecting previously unselected package supervisor.
Preparing to unpack .../supervisor_3.2.0-2ubuntu0.1_all.deb ...
Unpacking supervisor (3.2.0-2ubuntu0.1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu17) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up python3-gunicorn (19.4.5-1ubuntu1) ...
Setting up gunicorn3 (19.4.5-1ubuntu1) ...
Setting up python-pkg-resources (20.7.0-1) ...
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, 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 package python-pkg-resources (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up python-meld3 (1.0.2-2) ...
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, 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 package python-meld3 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of supervisor:
 supervisor depends on python-meld3; however:
  Package python-meld3 is not configured yet.
 supervisor depends on python-pkg-resources; however:
  Package python-pkg-resources is not configured yet.

dpkg: error processing package supervisor (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
        Errors were encountered while processing:
 python-pkg-resources
 python-meld3
 supervisor
E: Sub-process /usr/bin/dpkg returned an error code (1)

The solution was to leave the alternative pointing at python2 during the installation of gunicorn3:

update-alternatives --install /usr/bin/python python /usr/bin/python2 2
apt-get remove --purge python-meld3 python-pkg-resources supervisor
dpkg-query -l | grep -v ^ii  # confirms everything is OK
apt-get install -y gunicorn3 supervisor  # this was successful

I wonder if it's better just to ignore the alternatives mechanism completely?

update-alternatives --remove python /usr/bin/python2
update-alternatives --remove python /usr/bin/python3

But for now I'll put it back to be in alignment with the netbox instructions:

update-alternatives --install /usr/bin/python python /usr/bin/python3 1

Regards,

Brian.

Brian Candler

unread,
Jun 13, 2017, 8:47:57 AM6/13/17
to NetBox
Using alternatives to point python to python3 also seems to break supervisor badly.

Jun 13 12:38:27 netbox systemd[1]: Started Supervisor process control system for UNIX.
-- Subject: Unit supervisor.service has finished start-up
-- Defined-By: systemd
--
-- Unit supervisor.service has finished starting up.
--
-- The start-up result is done.
Jun 13 12:38:27 netbox supervisord[19174]: Traceback (most recent call last):
Jun 13 12:38:27 netbox supervisord[19174]:   File "/usr/bin/supervisord", line 5, in <module>
Jun 13 12:38:27 netbox supervisord[19174]:     from pkg_resources import load_entry_point
Jun 13 12:38:27 netbox supervisord[19174]:   File "/usr/lib/python3/dist-packages/pkg_resources/__
Jun 13 12:38:27 netbox supervisord[19174]:     @_call_aside
Jun 13 12:38:27 netbox supervisord[19174]:   File "/usr/lib/python3/dist-packages/pkg_resources/__
Jun 13 12:38:27 netbox supervisord[19174]:     f(*args, **kwargs)
Jun 13 12:38:27 netbox supervisord[19174]:   File "/usr/lib/python3/dist-packages/pkg_resources/__
Jun 13 12:38:27 netbox supervisord[19174]:     working_set = WorkingSet._build_master()
Jun 13 12:38:27 netbox supervisord[19174]:   File "/usr/lib/python3/dist-packages/pkg_resources/__
Jun 13 12:38:27 netbox supervisord[19174]:     ws.require(__requires__)
Jun 13 12:38:27 netbox supervisord[19174]:   File "/usr/lib/python3/dist-packages/pkg_resources/__
Jun 13 12:38:27 netbox supervisord[19174]:     needed = self.resolve(parse_requirements(requiremen
Jun 13 12:38:27 netbox supervisord[19174]:   File "/usr/lib/python3/dist-packages/pkg_resources/__
Jun 13 12:38:27 netbox supervisord[19174]:     raise DistributionNotFound(req, requirers)
Jun 13 12:38:27 netbox supervisord[19174]: pkg_resources.DistributionNotFound: The 'supervisor==3.
Jun 13 12:38:27 netbox systemd[1]: supervisor.service: Main process exited, code=exited, status=1/
Jun 13 12:38:27 netbox supervisorctl[19177]: Traceback (most recent call last):
Jun 13 12:38:27 netbox supervisorctl[19177]:   File "/usr/bin/supervisorctl", line 5, in <module>
Jun 13 12:38:27 netbox supervisorctl[19177]:     from pkg_resources import load_entry_point
Jun 13 12:38:27 netbox supervisorctl[19177]:   File "/usr/lib/python3/dist-packages/pkg_resources/
Jun 13 12:38:27 netbox supervisorctl[19177]:     @_call_aside
Jun 13 12:38:27 netbox supervisorctl[19177]:   File "/usr/lib/python3/dist-packages/pkg_resources/
Jun 13 12:38:27 netbox supervisorctl[19177]:     f(*args, **kwargs)
Jun 13 12:38:27 netbox supervisorctl[19177]:   File "/usr/lib/python3/dist-packages/pkg_resources/
Jun 13 12:38:27 netbox supervisorctl[19177]:     working_set = WorkingSet._build_master()
Jun 13 12:38:27 netbox supervisorctl[19177]:   File "/usr/lib/python3/dist-packages/pkg_resources/
Jun 13 12:38:27 netbox supervisorctl[19177]:     ws.require(__requires__)
Jun 13 12:38:27 netbox supervisorctl[19177]:   File "/usr/lib/python3/dist-packages/pkg_resources/
Jun 13 12:38:27 netbox supervisorctl[19177]:     needed = self.resolve(parse_requirements(requirem
Jun 13 12:38:27 netbox supervisorctl[19177]:   File "/usr/lib/python3/dist-packages/pkg_resources/
Jun 13 12:38:27 netbox supervisorctl[19177]:     raise DistributionNotFound(req, requirers)
Jun 13 12:38:27 netbox supervisorctl[19177]: pkg_resources.DistributionNotFound: The 'supervisor==
Jun 13 12:38:27 netbox systemd[1]: supervisor.service: Control process exited, code=exited status=
Jun 13 12:38:27 netbox systemd[1]: supervisor.service: Unit entered failed state.
Jun 13 12:38:27 netbox systemd[1]: supervisor.service: Failed with result 'exit-code'.

And again things are horribly broken:

# apt-get remove supervisor
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  python-meld3 python-pkg-resources
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  supervisor
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 1,399 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 103207 files and directories currently installed.)
Removing supervisor (3.2.0-2ubuntu0.1) ...
/var/lib/dpkg/info/supervisor.prerm: 11: /var/lib/dpkg/info/supervisor.prerm: pyclean: not found
dpkg: error processing package supervisor (--remove):
 subprocess installed pre-removal script returned error exit status 127
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@netbox:/opt/netbox/netbox# which pyclean
/usr/bin/pyclean
root@netbox:/opt/netbox/netbox# /usr/bin/pyclean
bash: /usr/bin/pyclean: /usr/bin/python: bad interpreter: No such file or directory

I wish I had never touched update-alternatives :-(  It seems a number of files have /usr/bin/python as hard-coded path. The only way I can make it work is to make python point to python2:

update-alternatives --install /usr/bin/python python /usr/bin/python2 2

Finally I made it work, although I also had to change gunicorn to gunicorn3 in both /etc/supervisor/conf.d/netbox.conf and /opt/netbox/gunicorn_config.py

Frank P.

unread,
Jun 13, 2017, 1:33:54 PM6/13/17
to NetBox
I ran into the exact same thing on my first install. I ended up blowing the entire VM away and starting again from scratch because I couldn't unbreak it. I just assumed I had fat-fingered something. In the end, I ended up just not installing Python3 and I didn't have any problems after that.

Keenan Tims

unread,
Jun 13, 2017, 5:24:27 PM6/13/17
to netbox-...@googlegroups.com
Yeah, the documentation should *definitely* not be recommending to
replace /usr/bin/python with /usr/bin/python3. This is a
distribution-level decision, and Debian/Ubuntu have for now chosen to
keep Python 2 as the default, as recommended by PEP 394[1]. Probably
shouldn't be doing this on RedHat either . It will definitely break
lots of things. If NetBox intends to only support Python 3, then it
should be updated to use the `python3` command. If both Pythons are
supported, the installation docs should just be based on the default
Python on that distribution. If users want to run it under Python3 on
such distributions, they can use virtualenv or install the stuff
manually with pip3.

[1] https://www.python.org/dev/peps/pep-0394/

Keenan
> --
> You received this message because you are subscribed to the Google
> Groups "NetBox" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to netbox-discus...@googlegroups.com.
> To post to this group, send email to netbox-...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/netbox-discuss/6afeeaf6-cd0d-4a48-91ec-65c04e395bd7%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


Terry McKenna

unread,
Jun 14, 2017, 4:07:00 PM6/14/17
to NetBox
Yup. I had to roll back to my snapshot. "Internal Server Error" after upgrading.


On Tuesday, June 13, 2017 at 8:25:18 AM UTC-4, Brian Candler wrote:

Brian Candler

unread,
Jun 14, 2017, 6:12:59 PM6/14/17
to NetBox
> Yeah, the documentation should *definitely* not be recommending to replace /usr/bin/python with /usr/bin/python3.

Just to confirm this, I did the following test with a fresh ubuntu 16.04 lxd container. It had python3 installed by default.  All I did was set python to python3 as the netbox documentation recommends, and then install supervisor (which uses python2).

root@test:~# update-alternatives --install /usr/bin/python python /usr/bin/python3 1
update-alternatives: using /usr/bin/python3 to provide /usr/bin/python (python) in auto mode
root@test:~# apt-get install supervisor
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-meld3 python-minimal
  python-pkg-resources python2.7 python2.7-minimal
Suggested packages:
  python-doc python-tk python-setuptools python2.7-doc binutils binfmt-support supervisor-doc
The following NEW packages will be installed:
  libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-meld3 python-minimal
  python-pkg-resources python2.7 python2.7-minimal supervisor
0 upgraded, 10 newly installed, 0 to remove and 84 not upgraded.
Need to get 4307 kB of archives.
After this operation, 18.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libpython2.7-minimal amd64 2.7.12-1ubuntu0~16.04.1 [339 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 python2.7-minimal amd64 2.7.12-1ubuntu0~16.04.1 [1295 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial/main amd64 python-minimal amd64 2.7.11-1 [28.2 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libpython2.7-stdlib amd64 2.7.12-1ubuntu0~16.04.1 [1884 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 python2.7 amd64 2.7.12-1ubuntu0~16.04.1 [224 kB]
Get:6 http://archive.ubuntu.com/ubuntu xenial/main amd64 libpython-stdlib amd64 2.7.11-1 [7656 B]
Get:7 http://archive.ubuntu.com/ubuntu xenial/main amd64 python amd64 2.7.11-1 [137 kB]
Get:8 http://archive.ubuntu.com/ubuntu xenial/main amd64 python-pkg-resources all 20.7.0-1 [108 kB]
Get:9 http://archive.ubuntu.com/ubuntu xenial/universe amd64 python-meld3 all 1.0.2-2 [30.9 kB]
Get:10 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 supervisor all 3.2.0-2ubuntu0.1 [253 kB]
Fetched 4307 kB in 4s (868 kB/s)
Selecting previously unselected package libpython2.7-minimal:amd64.
(Reading database ... 25469 files and directories currently installed.)
Preparing to unpack .../libpython2.7-minimal_2.7.12-1ubuntu0~16.04.1_amd64.deb ...
Unpacking libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.1) ...
Selecting previously unselected package python2.7-minimal.
Preparing to unpack .../python2.7-minimal_2.7.12-1ubuntu0~16.04.1_amd64.deb ...
Unpacking python2.7-minimal (2.7.12-1ubuntu0~16.04.1) ...
Selecting previously unselected package python-minimal.
Preparing to unpack .../python-minimal_2.7.11-1_amd64.deb ...
Unpacking python-minimal (2.7.11-1) ...
Selecting previously unselected package libpython2.7-stdlib:amd64.
Preparing to unpack .../libpython2.7-stdlib_2.7.12-1ubuntu0~16.04.1_amd64.deb ...
Unpacking libpython2.7-stdlib:amd64 (2.7.12-1ubuntu0~16.04.1) ...
Selecting previously unselected package python2.7.
Preparing to unpack .../python2.7_2.7.12-1ubuntu0~16.04.1_amd64.deb ...
Unpacking python2.7 (2.7.12-1ubuntu0~16.04.1) ...
Selecting previously unselected package libpython-stdlib:amd64.
Preparing to unpack .../libpython-stdlib_2.7.11-1_amd64.deb ...
Unpacking libpython-stdlib:amd64 (2.7.11-1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Setting up libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.1) ...
Setting up python2.7-minimal (2.7.12-1ubuntu0~16.04.1) ...
Linking and byte-compiling packages for runtime python2.7...
Setting up python-minimal (2.7.11-1) ...
Selecting previously unselected package python.
(Reading database ... 26215 files and directories currently installed.)
Preparing to unpack .../python_2.7.11-1_amd64.deb ...
update-alternatives: warning: forcing reinstallation of alternative /usr/bin/python3 because link group python is broken
Unpacking python (2.7.11-1) ...
Selecting previously unselected package python-pkg-resources.
Preparing to unpack .../python-pkg-resources_20.7.0-1_all.deb ...
Unpacking python-pkg-resources (20.7.0-1) ...
Selecting previously unselected package python-meld3.
Preparing to unpack .../python-meld3_1.0.2-2_all.deb ...
Unpacking python-meld3 (1.0.2-2) ...
Selecting previously unselected package supervisor.
Preparing to unpack .../supervisor_3.2.0-2ubuntu0.1_all.deb ...
Unpacking supervisor (3.2.0-2ubuntu0.1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu16) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up libpython2.7-stdlib:amd64 (2.7.12-1ubuntu0~16.04.1) ...
Setting up python2.7 (2.7.12-1ubuntu0~16.04.1) ...
Setting up libpython-stdlib:amd64 (2.7.11-1) ...
Setting up python (2.7.11-1) ...
Setting up python-pkg-resources (20.7.0-1) ...
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, 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 package python-pkg-resources (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up python-meld3 (1.0.2-2) ...
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, 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 package python-meld3 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of supervisor:
 supervisor depends on python-meld3; however:
  Package python-meld3 is not configured yet.
 supervisor depends on python-pkg-resources; however:
  Package python-pkg-resources is not configured yet.

dpkg: error processing package supervisor (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
        Errors were encountered while processing:
 python-pkg-resources
 python-meld3
 supervisor
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@test:~#

Matthew Read

unread,
Jun 26, 2017, 7:36:42 AM6/26/17
to NetBox
Tried installing Netbox last week on fresh Ubuntu Server 16.04.1 VM with Python 3 and just could not get it to work. After coming to this thread I tried using update-alternatives to point python at python3. With this I managed to get gunicorn3 working when running it by hand but horribly braking supervisor in the process. Ended up just deleting the VM and starting from scratch, this time making sure to never use python3, and everything works now.

Eric

unread,
May 17, 2018, 1:37:38 PM5/17/18
to NetBox
Installing gunicorn3 instead of gunicorn fixed my issues with running gunicorn


On Tuesday, June 13, 2017 at 8:25:18 AM UTC-4, Brian Candler wrote:
Reply all
Reply to author
Forward
0 new messages