import error in migrations in 2.2.1 #1292

Closed
opened 2025-12-29 16:31:08 +01:00 by adam · 2 comments
Owner

Originally created by @bleything on GitHub (Oct 12, 2017).

Issue type

[ ] Feature request
[x] Bug report
[ ] Documentation

Environment

  • Python version: 3.4.3
  • NetBox version: 2.2.1

Description

During the upgrade from 2.2-beta2 to 2.2.1, when I run python3 netbox/manage.py migrate I get the following:

Traceback (most recent call last):
  File "netbox/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 338, in execute
    django.setup()
  File "/usr/local/lib/python3.4/dist-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python3.4/dist-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models()
  File "/usr/local/lib/python3.4/dist-packages/django/apps/config.py", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/opt/netbox/netbox/secrets/models.py", line 4, in <module>
    from Crypto.Cipher import AES, PKCS1_OAEP
ImportError: cannot import name 'AES'

I've verified that pycrypto was removed and pycryptodome was installed:

$ sudo pip3 freeze | grep -i pycrypt
pycryptodome==3.4.7

I also tried going to v2.2.0 first but got the same result.

Originally created by @bleything on GitHub (Oct 12, 2017). ### Issue type [ ] Feature request <!-- Requesting the implementation of a new feature --> [x] Bug report <!-- Reporting unexpected or erroneous behavior --> [ ] Documentation <!-- Proposing a modification to the documentation --> ### Environment * Python version: 3.4.3 * NetBox version: 2.2.1 ### Description During the upgrade from 2.2-beta2 to 2.2.1, when I run `python3 netbox/manage.py migrate` I get the following: ``` Traceback (most recent call last): File "netbox/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 364, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 338, in execute django.setup() File "/usr/local/lib/python3.4/dist-packages/django/__init__.py", line 27, in setup apps.populate(settings.INSTALLED_APPS) File "/usr/local/lib/python3.4/dist-packages/django/apps/registry.py", line 108, in populate app_config.import_models() File "/usr/local/lib/python3.4/dist-packages/django/apps/config.py", line 202, in import_models self.models_module = import_module(models_module_name) File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 2254, in _gcd_import File "<frozen importlib._bootstrap>", line 2237, in _find_and_load File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked File "<frozen importlib._bootstrap>", line 1129, in _exec File "<frozen importlib._bootstrap>", line 1471, in exec_module File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed File "/opt/netbox/netbox/secrets/models.py", line 4, in <module> from Crypto.Cipher import AES, PKCS1_OAEP ImportError: cannot import name 'AES' ``` I've verified that pycrypto was removed and pycryptodome was installed: ``` $ sudo pip3 freeze | grep -i pycrypt pycryptodome==3.4.7 ``` I also tried going to v2.2.0 first but got the same result.
adam closed this issue 2025-12-29 16:31:08 +01:00
Author
Owner

@jeremystretch commented on GitHub (Oct 12, 2017):

Not sure what would cause that. Could you try removing and then reinstalling pycryptodome?

@jeremystretch commented on GitHub (Oct 12, 2017): Not sure what would cause that. Could you try removing and then reinstalling pycryptodome?
Author
Owner

@bleything commented on GitHub (Oct 12, 2017):

That did the trick. Must've been a weird/broken install the first time. Sorry for the noise; python's not my language :)

@bleything commented on GitHub (Oct 12, 2017): That did the trick. Must've been a weird/broken install the first time. Sorry for the noise; python's not my language :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1292