Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'GenericAlias' from partially initialized module 'types' #21920

Open
salilsaifuddin opened this issue May 17, 2024 · 6 comments
Labels
type: bug Something isn't working

Comments

@salilsaifuddin
Copy link

salilsaifuddin commented May 17, 2024

Dagster version

latest

What's the issue?

getting this exceptionOriginal, exception was:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/dagster/_core/execution/watch_orphans.py", line 10, in <module>
    from types import GenericAlias
ImportError: cannot import name 'GenericAlias' from partially initialized module 'types' (most likely due to a circular import) (/usr/local/lib/python3.10/dist-packages/dagster/_core/execution/types.py)

Original exception was:
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/dagster/_core/execution/watch_orphans.py", line 10, in <module>
    import signal
  File "/usr/lib/python3.10/signal.py", line 3, in <module>
    import signal
  File "/usr/lib/python3.10/signal.py", line 3, in <module>
    from enum import IntEnum as _IntEnum
  File "/usr/lib/python3.10/enum.py", line 2, in <module>
    from enum import IntEnum as _IntEnum
  File "/usr/lib/python3.10/enum.py", line 2, in <module>
    from types import MappingProxyType, DynamicClassAttribute
  File "/usr/local/lib/python3.10/dist-packages/dagster/_core/execution/types.py", line 1, in <module>
    from types import MappingProxyType, DynamicClassAttribute
    from typing import Dict
  File "/usr/local/lib/python3.10/dist-packages/dagster/_core/execution/types.py", line 1, in <module>
  File "/usr/lib/python3.10/typing.py", line 25, in <module>
    from typing import Dict
  File "/usr/lib/python3.10/typing.py", line 25, in <module>
    import contextlib
  File "/usr/lib/python3.10/contextlib.py", line 6, in <module>
    from functools import wraps
    import contextlib
  File "/usr/lib/python3.10/functools.py", line 22, in <module>
  File "/usr/lib/python3.10/contextlib.py", line 6, in <module>
    from functools import wraps
  File "/usr/lib/python3.10/functools.py", line 22, in <module>
    from types import GenericAlias
ImportError: cannot import name 'GenericAlias' from partially initialized module 'types' (most likely due to a circular import) (/usr/local/lib/python3.10/dist-packages/dagster/_core/execution/types.py)
    from types import GenericAlias

What did you expect to happen?

getting error

How to reproduce?

while do etl it happened

Deployment type

Local

Deployment details

local

Additional information

nothing

Message from the maintainers

Impacted by this issue? Give it a 👍! We factor engagement into prioritization.

@salilsaifuddin salilsaifuddin added the type: bug Something isn't working label May 17, 2024
@TyShkan
Copy link

TyShkan commented May 17, 2024

Having the same issue after update to 1.7.6 version (python 3.11)

@TyShkan
Copy link

TyShkan commented May 17, 2024

Introduced here caused by the file name "types.py" shadowing stdlib module

FYI @mlarose

@gibsondan
Copy link
Member

Hi, thanks for reporting this - we're working on a fix and it looks like this was indeed introduced in 1.7.6. Is it possible to confirm whether or not this error is preventing the run from completing?

@TyShkan
Copy link

TyShkan commented May 17, 2024

@gibsondan jobs and schedules work as usual, runs complete correctly. It seems like it mostly affects execution of watch_orphans.py utility.

@gibsondan
Copy link
Member

Got it - thanks for confirming.

Our current plan is to include a fix for this in the release planned for next week since the main impact appears to be logspew and the error doesn't fail runs or prevent logs from runs from being submitted (the utility process in question does some cleanup of orphaned subprocesses if the process running a step happens to crash mid-execution).

Downgrading to 1.7.5 should also prevent the error from being logged in the interim.

@garethbrickman garethbrickman changed the title import error "from types import GenericAlias" ImportError: cannot import name 'GenericAlias' from partially initialized module 'types' May 17, 2024
mlarose added a commit that referenced this issue May 17, 2024
mlarose added a commit that referenced this issue May 20, 2024
## Summary & Motivation

#21920

## How I Tested These Changes

- BK
mlarose added a commit that referenced this issue May 21, 2024
## Summary & Motivation

Relates to #21920

## How I Tested These Changes

Tested with ./examples/deploy_docker/from_source/build.sh docker-compose
set + launching a run to verify the problem is addressed
@mlarose
Copy link
Contributor

mlarose commented May 21, 2024

Fixes #21941 will be included in 1.7.7 and #21944 should prevent the particular script execution from causing this type of module shadowing error again in the future.

nikomancy pushed a commit that referenced this issue May 22, 2024
## Summary & Motivation

#21920

## How I Tested These Changes

- BK
nikomancy pushed a commit that referenced this issue May 22, 2024
## Summary & Motivation

Relates to #21920

## How I Tested These Changes

Tested with ./examples/deploy_docker/from_source/build.sh docker-compose
set + launching a run to verify the problem is addressed
danielgafni pushed a commit to danielgafni/dagster that referenced this issue Jun 18, 2024
## Summary & Motivation

dagster-io#21920

## How I Tested These Changes

- BK
danielgafni pushed a commit to danielgafni/dagster that referenced this issue Jun 18, 2024
## Summary & Motivation

Relates to dagster-io#21920

## How I Tested These Changes

Tested with ./examples/deploy_docker/from_source/build.sh docker-compose
set + launching a run to verify the problem is addressed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants