Skip to content

[BUG] AttributeError: module 'deepspeed' has no attribute 'utils' when installing DeepSpeed from source #2020

Closed

Description

@KMFODA

Describe the bug
When installing deepspeed from Github rather than using pip install deepspeed I get the below error. I've traced this back to commit 6ad3119d5420c6b25b456626a40f4ded8c05a81. Before this commit running these instructions works whereas from this commit onwards I get the below error:

Traceback (most recent call last):
  File "/usr/local/bin/deepspeed", line 3, in <module>
    from deepspeed.launcher.runner import main
  File "/usr/local/lib/python3.6/dist-packages/deepspeed/__init__.py", line 13, in <module>
    from . import ops
  File "/usr/local/lib/python3.6/dist-packages/deepspeed/ops/__init__.py", line 1, in <module>
    from . import adam
  File "/usr/local/lib/python3.6/dist-packages/deepspeed/ops/adam/__init__.py", line 1, in <module>
    from .cpu_adam import DeepSpeedCPUAdam
  File "/usr/local/lib/python3.6/dist-packages/deepspeed/ops/adam/cpu_adam.py", line 10, in <module>
    from deepspeed.utils.logging import should_log_le
  File "/usr/local/lib/python3.6/dist-packages/deepspeed/utils/__init__.py", line 1, in <module>
    from .logging import logger, log_dist
  File "/usr/local/lib/python3.6/dist-packages/deepspeed/utils/logging.py", line 5, in <module>
    import deepspeed.comm as dist
  File "/usr/local/lib/python3.6/dist-packages/deepspeed/comm/__init__.py", line 3, in <module>
    import deepspeed.utils as utils
AttributeError: module 'deepspeed' has no attribute 'utils'

To Reproduce
Steps to reproduce the behavior:

  1. git clone https://github.com/microsoft/DeepSpeed/2.
  2. cd DeepSpeed
  3. pip install .
  4. ds_report

Expected behavior
ds_report should run and print out a DeepSpeed environment report

ds_report output
N/A

Screenshots
N/A

System info (please complete the following information):

  • OS = Linux 5.15.38
  • GPU count = 4 TeslaV100S
  • Python = Python 3.6.9

Launcher context
deepspeed launcher

Docker context
Are you using a specific docker image that you can share?

Additional context
Add any other context about the problem here.

Activity

  1. added
    bug
    on Jun 15, 2022
  2. mrwyattii commented on Jun 15, 2022

    @mrwyattii
    Contributor

    @KMFODA I've tried reproducing in a fresh environment, but I get no error. Could you try installing with a python virtual environment?

    python -m virtualenv venv
    source ./venv/bin/activate
    git clone https://github.com/microsoft/DeepSpeed/ && cd DeepSpeed
    pip install .
    ds_report
    
  3. KMFODA commented on Jun 15, 2022

    @KMFODA
    ContributorAuthor

    I get the same error with a virtual environment unfortunately. If it helps I'm running this on a VM set up in ovhcloud. I think this might be an error related to how some of the subdirectories are being imported. I made these changes on my fork and they fixed this error.

    Essential replacing imports such as:

    import deepspeed.comm as dist
    import deepspeed.runtime.lr_schedules as lr_schedules
    import deepspeed.utils.groups as groups
    import deepspeed.utils as utils
    

    with:

    from deepspeed import comm as dist
    from deepspeed.runtime import lr_schedules
    from deepspeed.utils import groups
    from deepspeed import utils
    

    not sure if these changes make sense?

  4. mrwyattii commented on Jun 16, 2022

    @mrwyattii
    Contributor

    @KMFODA Would you be able to submit a PR from your modified fork?

  5. KMFODA commented on Jun 16, 2022

    @KMFODA
    ContributorAuthor

    yes of course just submitted #2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions