[Nodeshot] Circular Import Problem in Building Nodeshot in AWS

Hui Yu huiyu777 at gmail.com
Sun Nov 1 04:16:52 CET 2015


Dear all,

I'm new in Python and Django development and trying to build a community
website base on nodeshot on AWS Elastic BeanStalk. Source is from git
clone https://github.com/ninuxorg/nodeshot.

Also the build was successful on my local environment on Fedora 21 with
2.7.8, I'm failing to build the same on Amazon Linux AMI with Python
2.7.9 due to some circular import problem in
./nodeshot/nodeshot/core/base/managers.py as following:

(nodeshot)[ec2-user at ip-172-31-12-8 dev]$ python manage.py migrate
--no-initial-data
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File
"/home/ec2-user/works/nodeshot/env/nodeshot/local/lib/python2.7/site-packages/django/core/management/__init__.py",
line 338, in execute_from_command_line
utility.execute()
File
"/home/ec2-user/works/nodeshot/env/nodeshot/local/lib/python2.7/site-packages/django/core/management/__init__.py",
line 312, in execute
django.setup()
File
"/home/ec2-user/works/nodeshot/env/nodeshot/local/lib/python2.7/site-packages/django/__init__.py",
line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File
"/home/ec2-user/works/nodeshot/env/nodeshot/local/lib/python2.7/site-packages/django/apps/registry.py",
line 108, in populate
app_config.import_models(all_models)
File
"/home/ec2-user/works/nodeshot/env/nodeshot/local/lib/python2.7/site-packages/django/apps/config.py",
line 198, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File
"/home/ec2-user/works/nodeshot/nodeshot/core/layers/models/__init__.py",
line 8, in <module>
from layer import Layer
File
"/home/ec2-user/works/nodeshot/nodeshot/core/layers/models/layer.py",
line 10, in <module>
from nodeshot.core.nodes.models import Node
File
"/home/ec2-user/works/nodeshot/nodeshot/core/nodes/models/__init__.py",
line 1, in <module>
from .node import Node # noqa
File "/home/ec2-user/works/nodeshot/nodeshot/core/nodes/models/node.py",
line 8, in <module>
from nodeshot.core.base.managers import
HStoreGeoAccessLevelPublishedManager as NodeManager
* File "/home/ec2-user/works/nodeshot/nodeshot/core/base/managers.py",
line 6, in <module>
from django_hstore.query import HStoreQuerySet, HStoreGeoQuerySet
ImportError: cannot import name HStoreGeoQuerySet*

By looking into the code, it seems like the circular import happens
between ./nodeshot/nodeshot/core/base/managers.py and query.py in HStore
module (in my virtualenv environment
./env/nodeshot/lib/python2.7/site-packages/django_hstore/query.py), also
the next line:

from django_hstore.managers import HStoreManager, HStoreGeoManager

also has the same problem on HStoreGeoManager with managers.py in HStore
module (in my virtualenv environment
./env/nodeshot/lib/python2.7/site-packages/django_hstore/managers.py)

The HStore version and version other components installed are as below:
(nodeshot)[ec2-user at ip-172-31-12-8 dev]$ pip list
You are using pip version 6.0.8, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
amqp (1.4.7)
anyjson (0.3.3)
billiard (3.3.0.20)
blessings (1.6)
bpython (0.14.2)
celery (3.1.18)
curtsies (0.1.19)
decorator (4.0.4)
Django (1.8.4)
django-appconf (1.0.1)
django-celery-email (1.1.2)
django-cors-headers (1.1.0)
django-extensions (1.5.7)
django-filebrowser (3.6.1)
django-grappelli (2.7.1)
*django-hstore (1.4)*
django-leaflet (0.16.0)
django-netfields (0.3.1)
django-redis (4.2.0)
django-rest-swagger (0.3.4)
django-reversion (1.9.3)
django-rosetta (0.7.6)
django-smuggler (0.6.0)
djangorestframework (3.2.3)
djangorestframework-gis (0.9.4)
*djangorestframework-hstore (1.3)*
drf-extensions (0.2.7)
ecdsa (0.13)
geojson-elevation (0.1)
greenlet (0.4.9)
influxdb (2.9.2)
jsonfield (1.0.3)
kombu (3.0.28)
libcnml (0.9.2)
Markdown (2.6.2)
microsofttranslator (0.5)
mimeparse (0.1.3)
msgpack-python (0.4.6)
netaddr (0.7.18)
netdiff (0.4.4)
netengine (0.1a0)
networkx (1.10)
*nodeshot (1.0.pre-alpha, /home/ec2-user/works/nodeshot)*
oauthlib (1.0.3)
paramiko (1.15.3)
Pillow (3.0.0)
pip (6.0.8)
ply (3.8)
polib (1.0.7)
psycopg2 (2.6.1)
pyasn1 (0.1.9)
pycrypto (2.6.1)
Pygments (2.0.2)
PyJWT (1.4.0)
pysmi (0.0.6)
pysnmp (4.3.0)
python-dateutil (2.4.2)
python-openid (2.2.5)
python-social-auth (0.2.12)
pytz (2015.6)
PyYAML (3.11)
raven (5.7.2)
redis (2.10.3)
requests (2.8.1)
requests-oauthlib (0.5.0)
setuptools (12.0.5)
simplejson (3.8.0)
six (1.9.0)
tld (0.7.4)

Could anyone please kindly advise if the same issue has been reported in
the past and what were the solutions?

Thanks & best regards,
Hui Yu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ml.ninux.org/pipermail/nodeshot/attachments/20151101/068525f0/attachment-0001.html>


More information about the Nodeshot mailing list