dstndstn/tractor

ModuleNotFoundError: No module named 'tractor.version'

Closed this issue · 5 comments

I was building a container for decals-web, and I encountered the following error:

Step 7/9 : RUN ln -s /app/viewer.conf /etc/nginx/sites-enabled &&     rm /etc/nginx/sites-enabled/default &&     export PYTHONPATH=$(pwd)/legacypipe/py:$PYTHONPATH &&     export PYTHONPATH=$(pwd)/tractor$
$PYTHONPATH &&     export PYTHONPATH=$(pwd)/decals-web:$PYTHONPATH &&     cd decals-web &&     python3 manage.py migrate &&     apt-get -y clean
 ---> Running in be88a4c4b335
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.6/dist-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.6/dist-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.6/dist-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.6/dist-packages/django/core/management/base.py", line 361, in execute
    self.check()
  File "/usr/local/lib/python3.6/dist-packages/django/core/management/base.py", line 390, in check
    include_deployment_checks=include_deployment_checks,
  File "/usr/local/lib/python3.6/dist-packages/django/core/management/commands/migrate.py", line 65, in _run_checks
    issues.extend(super()._run_checks(**kwargs))
  File "/usr/local/lib/python3.6/dist-packages/django/core/management/base.py", line 377, in _run_checks
    return checks.run_checks(**kwargs)
  File "/usr/local/lib/python3.6/dist-packages/django/core/checks/registry.py", line 72, in run_checks
    new_errors = check(app_configs=app_configs)
File "/usr/local/lib/python3.6/dist-packages/django/core/checks/urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "/usr/local/lib/python3.6/dist-packages/django/core/checks/urls.py", line 23, in check_resolver
    return check_method()
  File "/usr/local/lib/python3.6/dist-packages/django/urls/resolvers.py", line 398, in check
    for pattern in self.url_patterns:
  File "/usr/local/lib/python3.6/dist-packages/django/utils/functional.py", line 80, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python3.6/dist-packages/django/urls/resolvers.py", line 579, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/usr/local/lib/python3.6/dist-packages/django/utils/functional.py", line 80, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python3.6/dist-packages/django/urls/resolvers.py", line 572, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/app/decals-web/viewer/urls.py", line 7, in <module>
    url(r'', include('cat.urls')),
  File "/usr/local/lib/python3.6/dist-packages/django/urls/conf.py", line 34, in include
    urlconf_module = import_module(urlconf_module)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/app/decals-web/cat/urls.py", line 3, in <module>
    from cat import views
  File "/app/decals-web/cat/views.py", line 24, in <module>
    from map.views import index, send_file
  File "/app/decals-web/map/views.py", line 3290, in <module>
    from legacypipe.survey import LegacySurveyData
  File "/app/legacypipe/py/legacypipe/survey.py", line 13, in <module>
    from tractor.ellipses import EllipseESoft, EllipseE
  File "/app/tractor/tractor/__init__.py", line 11, in <module>
    from .version import *
ModuleNotFoundError: No module named 'tractor.version'
The command '/bin/bash -c ln -s /app/viewer.conf /etc/nginx/sites-enabled &&     rm /etc/nginx/sites-enabled/default &&     export PYTHONPATH=$(pwd)/legacypipe/py:$PYTHONPATH &&     export PYTHONPATH=$(pw
d)/tractor:$PYTHONPATH &&     export PYTHONPATH=$(pwd)/decals-web:$PYTHONPATH &&     cd decals-web &&     python3 manage.py migrate &&     apt-get -y clean' returned a non-zero code: 1

I used to get around this issue by just uncommenting the import version line. I am now documenting the process for how to build decals-web containers, so it's better to get it fixed upstream.

Another somewhat related question: does decals-web require tractor to be compiled? If not, I can happily ignore the errors that make was giving me.

Cheers,
Mark

Here's part of the code that called tractor:

  File "/app/decals-web/cat/urls.py", line 3, in <module>
    from cat import views
  File "/app/decals-web/cat/views.py", line 24, in <module>
    from map.views import index, send_file
  File "/app/decals-web/map/views.py", line 3290, in <module>
    from legacypipe.survey import LegacySurveyData
  File "/app/legacypipe/py/legacypipe/survey.py", line 13, in <module>
    from tractor.ellipses import EllipseESoft, EllipseE
  File "/app/tractor/tractor/__init__.py", line 11, in <module>
    from .version import *
ModuleNotFoundError: No module named 'tractor.version'

No worries at all! I circumvented this problem by forking the repo and pointing to my modified version. It looks like setup.py does contain the line that generates version.py, but since I am not installing via pip, it probably didn't get triggered. Looks like this isn't a bug after all.
Thanks for your time!

Cheers,
Mark