Attempting migration from 2.6 to 2.8.5

118 views
Skip to first unread message

Jason Kopacko

unread,
May 29, 2020, 3:28:33 PM5/29/20
to NetBox
I pretty much got all the pieces done when I go to run the migrate.py I get this:

Skipping local dependencies (local_requirements.txt not found)

Applying database migrations (python3 netbox/manage.py migrate)...
Traceback (most recent call last):
 
File "netbox/manage.py", line 10, in <module>
    execute_from_command_line
(sys.argv)
 
File "/opt/netbox-2.8.5/venv/lib/python3.5/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility
.execute()
 
File "/opt/netbox-2.8.5/venv/lib/python3.5/site-packages/django/core/management/__init__.py", line 345, in execute
    settings
.INSTALLED_APPS
 
File "/opt/netbox-2.8.5/venv/lib/python3.5/site-packages/django/conf/__init__.py", line 76, in __getattr__
   
self._setup(name)
 
File "/opt/netbox-2.8.5/venv/lib/python3.5/site-packages/django/conf/__init__.py", line 63, in _setup
   
self._wrapped = Settings(settings_module)
 
File "/opt/netbox-2.8.5/venv/lib/python3.5/site-packages/django/conf/__init__.py", line 142, in __init__
    mod
= importlib.import_module(self.SETTINGS_MODULE)
 
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
   
return _bootstrap._gcd_import(name[level:], package, level)
 
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
 
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
 
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
 
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
 
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
 
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
 
File "/opt/netbox-2.8.5/netbox/netbox/settings.py", line 30, in <module>
   
"NetBox requires Python 3.6 or higher (current: Python {})".format(platform.python_version())


RuntimeError: NetBox requires Python 3.6 or higher (current: Python 3.5.2)

My python versions are : 

####:/opt/netbox$  python -V
Python 2.7.12
####:/opt/netbox$  python3 -V
Python 3.5.2
####:/opt/netbox$  python3.6 -V
Python 3.6.10

What am I missing?

Jason Kopacko

unread,
May 29, 2020, 3:30:40 PM5/29/20
to NetBox
Also I checked my 2.8.5 install directory:

####:/opt/netbox-2.8.5/venv/lib$ ll
total
12
drwxr
-xr-x 3 root root 4096 May 29 14:26 ./
drwxr
-xr-x 6 root root 4096 May 29 14:26 ../
drwxr
-xr-x 3 root root 4096 May 29 14:26 python3.5/

Jason Kopacko

unread,
May 29, 2020, 3:50:37 PM5/29/20
to NetBox
Here is my output from the system packages section :

Install System Packages

Begin by installing all system packages required by NetBox and its dependencies. Note that beginning with NetBox v2.8, Python 3.6 or later is required.

Ubuntu

# apt-get install -y python3.6 python3-pip python3-venv python3-dev build-essential libxml2-dev libxslt1-dev libffi-dev libpq-dev libssl-dev zlib1g-dev

####:/opt/netbox$ sudo apt-get install -y python3.6 python3-pip python3-venv python3-dev build-essential libxml2-dev libxslt1-dev libffi-dev libpq-dev libssl-dev zlib1g-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
build
-essential is already the newest version (12.1ubuntu2).
libffi
-dev is already the newest version (3.2.1-4).
python3
-dev is already the newest version (3.5.1-3).
python3
-venv is already the newest version (3.5.1-3).
libpq
-dev is already the newest version (9.5.21-0ubuntu0.16.04.1).
libssl
-dev is already the newest version (1.0.2g-1ubuntu4.16).
libxml2
-dev is already the newest version (2.9.3+dfsg1-1ubuntu0.7).
libxslt1
-dev is already the newest version (1.1.28-2.1ubuntu0.3).
zlib1g
-dev is already the newest version (1:1.2.8.dfsg-2ubuntu4.3).
python3
-pip is already the newest version (8.1.1-2ubuntu0.4).
python3
.6 is already the newest version (3.6.10-1+xenial1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Brian Candler

unread,
May 30, 2020, 1:22:15 AM5/30/20
to NetBox
On Friday, 29 May 2020 20:28:33 UTC+1, Jason Kopacko wrote:

My python versions are : 

####:/opt/netbox$  python -V
Python 2.7.12
####:/opt/netbox$  python3 -V
Python 3.5.2
####:/opt/netbox$  python3.6 -V
Python 3.6.10

What am I missing?

Netbox scripts run "python3", but on your system that's python 3.5, so it fails.

It looks like you've found a python3.6 package for Ubuntu 16.04 - and judging by the version number, I'm guessing you got it from this PPA:

In my case, I just took the opportunity to upgrade to Ubuntu 18.04, since 16.04 will be end-of-life in less than a year anyway, and so I didn't have this problem.

If you really need to continue on 16.04, I can only suggest:

- it might be sufficient just to specify python3.6 when you create the venv: see https://netbox.readthedocs.io/en/stable/installation/3-netbox/#set-up-python-environment

python3.6 -m venv -p python3.6 /opt/netbox/venv # ???

(but beware things like the upgrade script if they still run python3 directly)

- it *might* be possible to use "alias python3 python3.6" before running any Netbox command

- you *should not* use "update-alternatives" so that python3 runs python3.6.  That's likely to break your system big-time, because many system-installed python3-XXX packages won't work (and there are many Ubuntu system tools which are written in python)

Ross Moutell

unread,
May 30, 2020, 8:27:18 PM5/30/20
to NetBox
I would suggest moving to a new server with Ubuntu 18.04 or 20.04. My path was as follows.

Existing install - Netbox v2.7.11 on Ubuntu 16.04 (no venv)

New build - Netbox v2.7.11 on Ubuntu 20.04 (with venv)

Backup and restore the PostgreSQL DB to the new server.

From there you can upgrade to Netbox v2.8.*

I found this the most painless method (at least for me)

Jason Kopacko

unread,
May 31, 2020, 2:19:44 PM5/31/20
to NetBox
Yea I am stuck with 16.04 at the moment.

Ross Moutell

unread,
May 31, 2020, 3:26:21 PM5/31/20
to NetBox

Attached are the notes I made for myself of the Netbox install on Ubuntu 20.04 and DB migration including the PostgreSQL DB backup and restore commands.


You should be able to upgrade to 2.7.11 or 2.7.12 on 16.04 with no problems if you want to get the versions closer together.


In summary


I built a new Ubuntu 20.04 server and installed Netbox 2.7.11 on it.


Performed a backup and restore of the PostgreSQL DB on my Ubuntu 16.04 server which was also running Netbox at 2.7.11.


Restored the DB backup onto the new Ubunti 20.04 server.


Hope it helps.

Netbox install for 2.7.11 on Ubuntu 20.04

Jason Kopacko

unread,
Jun 1, 2020, 10:36:29 AM6/1/20
to NetBox
Ugh this sux. I am stuck and now this instance won't even load.

Jason Kopacko

unread,
Jun 1, 2020, 3:32:00 PM6/1/20
to NetBox
I am attempting to approval and deploy and 18.04 server and do a fresh install. From there, copy the db over. Any issues with performing the migrate on the DB after I get the install complete?

Brian Candler

unread,
Jun 2, 2020, 2:41:44 AM6/2/20
to NetBox
That should be fine - that's exactly how I did it.  You'll also need to move your media / reports if you are using those features, and modify reports to work with the amended API.

Reply all
Reply to author
Forward
0 new messages