Skip to content

ModuleNotFoundError: No module named 'hatchling.dep' with hatchling 1.26.0 #1793

@jdicioccio

Description

@jdicioccio

With the just-released 1.26.0, I'm getting the following error when using 'hatch run'

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /usr/local/lib/python3.13/site-packages/hatch/cli/__init__.py:221 in main                        │
│                                                                                                  │
│   218                                                                                            │
│   219 def main():  # no cov                                                                      │
│   220 │   try:                                                                                   │
│ ❱ 221 │   │   hatch(prog_name='hatch', windows_expand_args=False)                                │
│   222 │   except Exception:  # noqa: BLE001                                                      │
│   223 │   │   import sys                                                                         │
│   224                                                                                            │
│                                                                                                  │
│ /usr/local/lib/python3.13/site-packages/click/core.py:1157 in __call__                           │
│                                                                                                  │
│ /usr/local/lib/python3.13/site-packages/click/core.py:1078 in main                               │
│                                                                                                  │
│ /usr/local/lib/python3.13/site-packages/click/core.py:1688 in invoke                             │
│                                                                                                  │
│ /usr/local/lib/python3.13/site-packages/click/core.py:1434 in invoke                             │
│                                                                                                  │
│ /usr/local/lib/python3.13/site-packages/click/core.py:783 in invoke                              │
│                                                                                                  │
│ /usr/local/lib/python3.13/site-packages/click/decorators.py:33 in new_func                       │
│                                                                                                  │
│ /usr/local/lib/python3.13/site-packages/hatch/cli/run/__init__.py:147 in run                     │
│                                                                                                  │
│   144 │   elif not env_name:                                                                     │
│   145 │   │   env_name = 'system'                                                                │
│   146 │                                                                                          │
│ ❱ 147 │   ctx.invoke(                                                                            │
│   148 │   │   run_command,                                                                       │
│   149 │   │   args=[command, *final_args],                                                       │
│   150 │   │   env_names=[env_name],                                                              │
│                                                                                                  │
│ /usr/local/lib/python3.13/site-packages/click/core.py:783 in invoke                              │
│                                                                                                  │
│ /usr/local/lib/python3.13/site-packages/click/decorators.py:45 in new_func                       │
│                                                                                                  │
│ /usr/local/lib/python3.13/site-packages/hatch/cli/env/run.py:134 in run                          │
│                                                                                                  │
│   131 │   elif not matrix_selected and (included_variables or excluded_variables):               │
│   132 │   │   app.abort(f'Variable selection is unsupported for non-matrix environments: {", "   │
│   133 │                                                                                          │
│ ❱ 134 │   for context in app.runner_context(                                                     │
│   135 │   │   environments,                                                                      │
│   136 │   │   ignore_compat=ignore_compat or matrix_selected,                                    │
│   137 │   │   display_header=matrix_selected,                                                    │
│                                                                                                  │
│ /usr/local/lib/python3.13/site-packages/hatch/cli/application.py:224 in runner_context           │
│                                                                                                  │
│   221 │   │   │   │   context = ExecutionContext(environment)                                    │
│   222 │   │   │   │   yield context                                                              │
│   223 │   │   │   │                                                                              │
│ ❱ 224 │   │   │   │   self.prepare_environment(environment)                                      │
│   225 │   │   │   │   with EnvVars(context.env_vars):                                            │
│   226 │   │   │   │   │   self.run_shell_commands(context)                                       │
│   227                                                                                            │
│                                                                                                  │
│ /usr/local/lib/python3.13/site-packages/hatch/cli/application.py:143 in prepare_environment      │
│                                                                                                  │
│   140 │   │   │   │   │   │   )                                                                  │
│   141 │   │                                                                                      │
│   142 │   │   with environment.app_status_dependency_state_check():                              │
│ ❱ 143 │   │   │   new_dep_hash = environment.dependency_hash()                                   │
│   144 │   │                                                                                      │
│   145 │   │   current_dep_hash = self.env_metadata.dependency_hash(environment)                  │
│   146 │   │   if new_dep_hash != current_dep_hash:                                               │
│                                                                                                  │
│ /usr/local/lib/python3.13/site-packages/hatch/env/plugin/interface.py:667 in dependency_hash     │
│                                                                                                  │
│    664 │   │   """                                                                               │
│    665 │   │   from hatch.utils.dep import hash_dependencies                                     │
│    666 │   │                                                                                     │
│ ❱  667 │   │   return hash_dependencies(self.dependencies_complex)                               │
│    668 │                                                                                         │
│    669 │   @contextmanager                                                                       │
│    670 │   def app_status_creation(self):                                                        │
│                                                                                                  │
│ /usr/local/lib/python3.13/site-packages/hatch/env/plugin/interface.py:316 in                     │
│ dependencies_complex                                                                             │
│                                                                                                  │
│    313 │   │   │   if (not self.skip_install and self.dev_mode) or self.features:                │
│    314 │   │   │   │   from hatch.utils.dep import get_project_dependencies_complex              │
│    315 │   │   │   │                                                                             │
│ ❱  316 │   │   │   │   dependencies_complex, optional_dependencies_complex = get_project_depend  │
│    317 │   │   │   │                                                                             │
│    318 │   │   │   │   if not self.skip_install and self.dev_mode:                               │
│    319 │   │   │   │   │   all_dependencies_complex.extend(dependencies_complex.values())        │
│                                                                                                  │
│ /usr/local/lib/python3.13/site-packages/hatch/utils/dep.py:40 in                                 │
│ get_project_dependencies_complex                                                                 │
│                                                                                                  │
│   37 def get_project_dependencies_complex(                                                       │
│   38 │   environment: EnvironmentInterface,                                                      │
│   39 ) -> tuple[dict[str, Requirement], dict[str, dict[str, Requirement]]]:                      │
│ ❱ 40 │   from hatchling.dep.core import dependencies_in_sync                                     │
│   41 │                                                                                           │
│   42 │   dependencies_complex = {}                                                               │
│   43 │   optional_dependencies_complex = {}                                                      │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ModuleNotFoundError: No module named 'hatchling.dep'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions