Upgrading from v1.7.3 to v.1.8.3 Error #683

Closed
opened 2025-12-29 16:24:43 +01:00 by adam · 7 comments
Owner

Originally created by @swickstrom on GitHub (Jan 31, 2017).

Haven't had the chance to upgrade (using the documented option B process) for a while.
During the upgrade process received the following error during the lxml uninstall/install:

Found existing installation: lxml 3.7.0
Can't uninstall 'lxml'. No files were found to uninstall.
Running setup.py install for lxml
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/setuptools/init.py", line 12, in
import setuptools.version
File "/usr/local/lib/python2.7/dist-packages/setuptools/version.py", line 1, in
import pkg_resources
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 70, in
import packaging.version
ImportError: No module named packaging.version
Complete output from command /usr/bin/python -c "import setuptools, tokenize;file='/tmp/pip_build_root/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-2yNGXh-record/install-record.txt --single-version-externally-managed --compile:

This resulted in a traceback call of:

Traceback (most recent call last):

File "", line 1, in

File "/usr/local/lib/python2.7/dist-packages/setuptools/init.py", line 12, in

import setuptools.version

File "/usr/local/lib/python2.7/dist-packages/setuptools/version.py", line 1, in

import pkg_resources

File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 70, in

import packaging.version

ImportError: No module named packaging.version

Since lxml wasn't properly uninstalled due to the error, received:

Can't roll back lxml; was not uninstalled

Which resulted in the entire process of rolling back the install failing.
Currently this install is dead in the water, any assistance would be grand.

Originally created by @swickstrom on GitHub (Jan 31, 2017). Haven't had the chance to upgrade (using the documented option B process) for a while. During the upgrade process received the following error during the lxml uninstall/install: > Found existing installation: lxml 3.7.0 > Can't uninstall 'lxml'. No files were found to uninstall. > Running setup.py install for lxml > Traceback (most recent call last): > File "<string>", line 1, in <module> > File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 12, in <module> > import setuptools.version > File "/usr/local/lib/python2.7/dist-packages/setuptools/version.py", line 1, in <module> > import pkg_resources > File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 70, in <module> > import packaging.version > ImportError: No module named packaging.version > Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-2yNGXh-record/install-record.txt --single-version-externally-managed --compile: > This resulted in a traceback call of: > Traceback (most recent call last): > > File "<string>", line 1, in <module> > > File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 12, in <module> > > import setuptools.version > > File "/usr/local/lib/python2.7/dist-packages/setuptools/version.py", line 1, in <module> > > import pkg_resources > > File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 70, in <module> > > import packaging.version > > ImportError: No module named packaging.version > Since lxml wasn't properly uninstalled due to the error, received: > Can't roll back lxml; was not uninstalled Which resulted in the entire process of rolling back the install failing. Currently this install is dead in the water, any assistance would be grand.
adam closed this issue 2025-12-29 16:24:43 +01:00
Author
Owner

@jbro209070 commented on GitHub (Jan 31, 2017):

I didn't have the exact same issue, but I had the issue where it was saying that there was no module named packaging.version. Here is what I used to correct it:

Uninstall pip:
sudo apt-get purge python pip

Re-install pip:
curl https://bootstrap.pypa.io/get-pip.py | sudo python

When you try to run your web server it will tell you to run this command:

python manage.py migrate

After this netbox will start working as intended.

FYI, this is the 3rd or 4th post stating there are problems upgrading the 1.7 train to the 1.8. This may indeed be a Netbox issue.

@jbro209070 commented on GitHub (Jan 31, 2017): I didn't have the exact same issue, but I had the issue where it was saying that there was no module named packaging.version. Here is what I used to correct it: Uninstall pip: sudo apt-get purge python pip Re-install pip: curl https://bootstrap.pypa.io/get-pip.py | sudo python When you try to run your web server it will tell you to run this command: python manage.py migrate After this netbox will start working as intended. FYI, this is the 3rd or 4th post stating there are problems upgrading the 1.7 train to the 1.8. This may indeed be a Netbox issue.
Author
Owner

@elJoeyJojo commented on GitHub (Jan 31, 2017):

hello, i tried upgrading v 1.7 to 1.8.3 and get lots of errors!

Could not find .egg-info directory in install record for cryptography>=1.4 from 71c7260003/cryptography-1.7.2.tar.gz (md5)=fade66de437392ed1ba6980768626204 in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 2))

Could not find .egg-info directory in install record for django-tables2>=1.2.5 (from -r requirements.txt (line 7))

Could not find .egg-info directory in install record for Markdown>=2.6.7 (from -r requirements.txt (line 10))

Could not find .egg-info directory in install record for psycopg2>=2.6.1 from dc2d50a6f3/psycopg2-2.6.2.tar.gz (md5)=4a392949ba31a378a18ed3e775a4693f in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 15))

ImportError: No module named packaging.version


Can't roll back lxml; was not uninstalled
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;file='/tmp/pip_build_root/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-tJdXI7-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/lxml
Storing debug log for failure in /home/netbox/.pip/pip.log
Traceback (most recent call last):

is it best to wait for a fix in the upgrade script?

@elJoeyJojo commented on GitHub (Jan 31, 2017): hello, i tried upgrading v 1.7 to 1.8.3 and get lots of errors! Could not find .egg-info directory in install record for cryptography>=1.4 from https://pypi.python.org/packages/99/df/71c7260003f5c469cec3db4c547115df39e9ce6c719a99e067ba0e78fd8a/cryptography-1.7.2.tar.gz#md5=fade66de437392ed1ba6980768626204 in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 2)) Could not find .egg-info directory in install record for django-tables2>=1.2.5 (from -r requirements.txt (line 7)) Could not find .egg-info directory in install record for Markdown>=2.6.7 (from -r requirements.txt (line 10)) Could not find .egg-info directory in install record for psycopg2>=2.6.1 from https://pypi.python.org/packages/7b/a8/dc2d50a6f37c157459cd18bab381c8e6134b9381b50fbe969997b2ae7dbc/psycopg2-2.6.2.tar.gz#md5=4a392949ba31a378a18ed3e775a4693f in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 15)) ImportError: No module named packaging.version ---------------------------------------- Can't roll back lxml; was not uninstalled Cleaning up... Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-tJdXI7-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/lxml Storing debug log for failure in /home/netbox/.pip/pip.log Traceback (most recent call last): is it best to wait for a fix in the upgrade script?
Author
Owner

@swickstrom commented on GitHub (Jan 31, 2017):

I have confirmed jbro209070's solution fixes the issue; proceed at your own risk.

@swickstrom commented on GitHub (Jan 31, 2017): I have confirmed jbro209070's solution fixes the issue; proceed at your own risk.
Author
Owner

@jeremystretch commented on GitHub (Jan 31, 2017):

Unfortunately, this is an issue with Python's pip/setuptools, and not something I can fix from within the NetBox codebase.

@jeremystretch commented on GitHub (Jan 31, 2017): Unfortunately, this is an issue with Python's pip/setuptools, and not something I can fix from within the NetBox codebase.
Author
Owner

@elJoeyJojo commented on GitHub (Jan 31, 2017):

@jbro209070 thanks dude! without your HUGE HELP I'd never gotten this thing to work! appreciate everyone else's input as well! i am now on Netbox 1.8.3 (Y)

@elJoeyJojo commented on GitHub (Jan 31, 2017): @jbro209070 thanks dude! without your HUGE HELP I'd never gotten this thing to work! appreciate everyone else's input as well! i am now on Netbox 1.8.3 (Y)
Author
Owner

@jbro209070 commented on GitHub (Feb 1, 2017):

No problem guys, happy to help!

@jbro209070 commented on GitHub (Feb 1, 2017): No problem guys, happy to help!
Author
Owner

@jeremystretch commented on GitHub (Feb 1, 2017):

I ran into this issue myself while building a new Python 3 virtualenv. It seems that the trick was to upgrade pip and setuptools prior to installing any packages:

$ pip install --upgrade pip setuptools
...
$ pip freeze
appdirs==1.4.0
packaging==16.8
pyparsing==2.1.10
six==1.10.0

From here, pip install -r requirements.txt completed with no issues.

@jeremystretch commented on GitHub (Feb 1, 2017): I ran into this issue myself while building a new Python 3 virtualenv. It seems that the trick was to upgrade pip and setuptools prior to installing any packages: ``` $ pip install --upgrade pip setuptools ... $ pip freeze appdirs==1.4.0 packaging==16.8 pyparsing==2.1.10 six==1.10.0 ``` From here, `pip install -r requirements.txt` completed with no issues.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#683