aquacropos / aquacrop

AquaCrop-OSPy: Python implementation of AquaCrop-OS
https://aquacropos.github.io/aquacrop/
Apache License 2.0
98 stars 71 forks source link

Compilation inside Docker: ModuleNotFoundError: No module named 'aquacrop.solution.solution_root_zone_water' #74

Closed charalamm closed 2 years ago

charalamm commented 2 years ago

Hello,

I have problems compiling the library. I am trying to create a django API around it.

Any ideas?

Thanks in advance!

api_1  | Exception in thread django-main-thread:
api_1  | Traceback (most recent call last):
api_1  |   File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
api_1  |     self.run()
api_1  |   File "/usr/local/lib/python3.10/threading.py", line 953, in run
api_1  |     self._target(*self._args, **self._kwargs)
api_1  |   File "/usr/local/lib/python3.10/site-packages/django/utils/autoreload.py", line 64, in wrapper
api_1  |     fn(*args, **kwargs)
api_1  |   File "/usr/local/lib/python3.10/site-packages/django/core/management/commands/runserver.py", line 134, in inner_run
api_1  |     self.check(display_num_errors=True)
api_1  |   File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 487, in check
api_1  |     all_issues = checks.run_checks(
api_1  |   File "/usr/local/lib/python3.10/site-packages/django/core/checks/registry.py", line 88, in run_checks
api_1  |     new_errors = check(app_configs=app_configs, databases=databases)
api_1  |   File "/usr/local/lib/python3.10/site-packages/django/core/checks/urls.py", line 14, in check_url_config
api_1  |     return check_resolver(resolver)
api_1  |   File "/usr/local/lib/python3.10/site-packages/django/core/checks/urls.py", line 24, in check_resolver
api_1  |     return check_method()
api_1  |   File "/usr/local/lib/python3.10/site-packages/django/urls/resolvers.py", line 480, in check
api_1  |     for pattern in self.url_patterns:
api_1  |   File "/usr/local/lib/python3.10/site-packages/django/utils/functional.py", line 49, in __get__
api_1  |     res = instance.__dict__[self.name] = self.func(instance)
api_1  |   File "/usr/local/lib/python3.10/site-packages/django/urls/resolvers.py", line 696, in url_patterns
api_1  |     patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
api_1  |   File "/usr/local/lib/python3.10/site-packages/django/utils/functional.py", line 49, in __get__
api_1  |     res = instance.__dict__[self.name] = self.func(instance)
api_1  |   File "/usr/local/lib/python3.10/site-packages/django/urls/resolvers.py", line 689, in urlconf_module
api_1  |     return import_module(self.urlconf_name)
api_1  |   File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
api_1  |     return _bootstrap._gcd_import(name[level:], package, level)
api_1  |   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
api_1  |   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
api_1  |   File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
api_1  |   File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
api_1  |   File "<frozen importlib._bootstrap_external>", line 883, in exec_module
api_1  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
api_1  |   File "/code/backend/urls.py", line 20, in <module>
api_1  |     path("api/v1/", include("webapi.urls")),
api_1  |   File "/usr/local/lib/python3.10/site-packages/django/urls/conf.py", line 38, in include
api_1  |     urlconf_module = import_module(urlconf_module)
api_1  |   File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
api_1  |     return _bootstrap._gcd_import(name[level:], package, level)
api_1  |   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
api_1  |   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
api_1  |   File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
api_1  |   File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
api_1  |   File "<frozen importlib._bootstrap_external>", line 883, in exec_module
api_1  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
api_1  |   File "/code/webapi/urls.py", line 3, in <module>
api_1  |     from webapi import views
api_1  |   File "/code/webapi/views.py", line 5, in <module>
api_1  |     from simulations.aquacrop import AquacropSimulationSerializer
api_1  |   File "/code/simulations/aquacrop/__init__.py", line 2, in <module>
api_1  |     from .simulation.serializer import AquacropSimulationSerializer
api_1  |   File "/code/simulations/aquacrop/simulation/serializer.py", line 6, in <module>
api_1  |     from ..crops import crops_map
api_1  |   File "/code/simulations/aquacrop/crops/__init__.py", line 1, in <module>
api_1  |     from .barley import BarleyRainfed
api_1  |   File "/code/simulations/aquacrop/crops/barley.py", line 1, in <module>
api_1  |     from aquacrop import Crop
api_1  |   File "/usr/local/lib/python3.10/site-packages/aquacrop/__init__.py", line 3, in <module>
api_1  |     from .core import AquaCropModel
api_1  |   File "/usr/local/lib/python3.10/site-packages/aquacrop/core.py", line 48, in <module>
api_1  |     from .timestep.run_single_timestep import solution_single_time_step
api_1  |   File "/usr/local/lib/python3.10/site-packages/aquacrop/timestep/run_single_timestep.py", line 12, in <module>
api_1  |     from ..solution.irrigation import irrigation
api_1  |   File "/usr/local/lib/python3.10/site-packages/aquacrop/solution/irrigation.py", line 7, in <module>
api_1  |     from .solution_root_zone_water import root_zone_water
api_1  | ModuleNotFoundError: No module named 'aquacrop.solution.solution_root_zone_water'
charalamm commented 2 years ago

I am running aquacrop inside a docker container under a non-root user. When running the compilation step as root there wasn't any problem