Skip to content

[BUG]No module named 'colossalai._C.cpu_adam':  #3395

Closed as not planned
Closed as not planned

Description

@ifromeast

🐛 Describe the bug

GPU: 8*A6000
CUDA Version: 11.7
Python Version: 3.8.10
colossalai Version: 0.2.8

when I run examples/train_sft.sh, the ERROR occurs

Traceback (most recent call last):
  File "/root/alpaca_test/ColossalAI/colossalai/kernel/op_builder/builder.py", line 159, in load
    op_module = self.import_op()
  File "/root/alpaca_test/ColossalAI/colossalai/kernel/op_builder/builder.py", line 110, in import_op
    return importlib.import_module(self.prebuilt_import_path)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'colossalai._C.cpu_adam'

Environment

No response

Activity

  1. Issues-translate-bot commented on Apr 1, 2023

    @Issues-translate-bot

    Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


    Title: [BUG]No module named 'colossalai._C.cpu_adam':

  2. ifromeast commented on Apr 1, 2023

    @ifromeast
    Author

    only colossalai_gemini and colossalai_zero2 strategies have this BUG.

  3. emigmo commented on Apr 3, 2023

    @emigmo

    too

  4. JThh commented on Apr 5, 2023

    @JThh
    Contributor

    Have you tried installing from source? Or try the command CUDA_EXT=1 pip install colossalai to install the lib?

    If you have solved the issue, kindly share your approach for new comers!

  5. janglichao commented on Apr 8, 2023

    @janglichao

    same problem, can anyone help!!!

  6. janglichao commented on Apr 8, 2023

    @janglichao

    same problem, can anyone help!!!

  7. ifromeast commented on Apr 11, 2023

    @ifromeast
    Author

    install apex firstly, it works

  8. elven2016 commented on Apr 18, 2023

    @elven2016

    how to solve this issue,I also have this problem,help,thanks

  9. ifromeast commented on Apr 18, 2023

    @ifromeast
    Author

    how to solve this issue,I also have this problem,help,thanks

    just install apex firstly

  10. elven2016 commented on Apr 18, 2023

    @elven2016

    need the g++ version 5, the centos7.5 default g++ is 4.8.5 .after install apex, the error is gone, but it appears this error: ImportError: cannot import name 'UnencryptedCookieSessionFactoryConfig' from 'pyramid.session' (unknown location)
    from apex import amp
    File "/home/elven/.local/lib/python3.9/site-packages/apex/init.py", line 13, in
    from pyramid.session import UnencryptedCookieSessionFactoryConfig
    ImportError: cannot import name 'UnencryptedCookieSessionFactoryConfig' from 'pyramid.session' (unknown location)

  11. ifromeast commented on Apr 18, 2023

    @ifromeast
    Author

    need the g++ version 5, the centos7.5 default g++ is 4.8.5 .after install apex, the error is gone, but it appears this error: ImportError: cannot import name 'UnencryptedCookieSessionFactoryConfig' from 'pyramid.session' (unknown location) from apex import amp File "/home/elven/.local/lib/python3.9/site-packages/apex/init.py", line 13, in from pyramid.session import UnencryptedCookieSessionFactoryConfig ImportError: cannot import name 'UnencryptedCookieSessionFactoryConfig' from 'pyramid.session' (unknown location)

    Oh, no! you cannot install apex by pip install apex, but by

    git clone https://github.com/NVIDIA/apex
    cd apex
    pip install -v --no-cache-dir ./
    
  12. elven2016 commented on Apr 18, 2023

    @elven2016

    need the g++ version 5, the centos7.5 default g++ is 4.8.5 .after install apex, the error is gone, but it appears this error: ImportError: cannot import name 'UnencryptedCookieSessionFactoryConfig' from 'pyramid.session' (unknown location) from apex import amp File "/home/elven/.local/lib/python3.9/site-packages/apex/init.py", line 13, in from pyramid.session import UnencryptedCookieSessionFactoryConfig ImportError: cannot import name 'UnencryptedCookieSessionFactoryConfig' from 'pyramid.session' (unknown location)

    Oh, no! you cannot install apex by pip install apex, but by

    git clone https://github.com/NVIDIA/apex
    cd apex
    pip install -v --no-cache-dir ./
    

    the same error,did this method need to install apex before colossai? when i instrall colossai by soure " CUDA_EXT=1 pip install . " it tolds "Your compiler (c++ 4.8.5) may be ABI-incompatible with PyTorch!
    Please use a compiler that is ABI-compatible with GCC 5.0 and above" only "pip install . "works ,but can not train, after install apex in source , the same error appears

  13. elven2016 commented on Apr 18, 2023

    @elven2016

    need the g++ version 5, the centos7.5 default g++ is 4.8.5 .after install apex, the error is gone, but it appears this error: ImportError: cannot import name 'UnencryptedCookieSessionFactoryConfig' from 'pyramid.session' (unknown location) from apex import amp File "/home/elven/.local/lib/python3.9/site-packages/apex/init.py", line 13, in from pyramid.session import UnencryptedCookieSessionFactoryConfig ImportError: cannot import name 'UnencryptedCookieSessionFactoryConfig' from 'pyramid.session' (unknown location)

    Oh, no! you cannot install apex by pip install apex, but by

    git clone https://github.com/NVIDIA/apex
    cd apex
    pip install -v --no-cache-dir ./
    

    the same error,did this method need to install apex before colossai? when i instrall colossai by soure " CUDA_EXT=1 pip install . " it tolds "Your compiler (c++ 4.8.5) may be ABI-incompatible with PyTorch! Please use a compiler that is ABI-compatible with GCC 5.0 and above" only "pip install . "works ,but can not train, after install apex in source , the same error appears

    I have solved this problem,I install scl and install the gcc7 , now it can run ,thanks !

  14. yifanhunter commented on May 30, 2023

    @yifanhunter

    Have you tried installing from source? Or try the command CUDA_EXT=1 pip install colossalai to install the lib?

    If you have solved the issue, kindly share your approach for new comers!

    Exception: [extension] Failed to build PyTorch extension because the detected CUDA version (12.0) mismatches the version that was used to compile PyTorch (11.3).Please make sure you have set the CUDA_HOME correctly and installed the correct PyTorch in https://pytorch.org/get-started/locally/ .

  15. ifromeast commented on May 31, 2023

    @ifromeast
    Author

    Have you tried installing from source? Or try the command CUDA_EXT=1 pip install colossalai to install the lib?
    If you have solved the issue, kindly share your approach for new comers!

    Exception: [extension] Failed to build PyTorch extension because the detected CUDA version (12.0) mismatches the version that was used to compile PyTorch (11.3).Please make sure you have set the CUDA_HOME correctly and installed the correct PyTorch in https://pytorch.org/get-started/locally/ .

    Hi, @yifanhunter It looks like that there is something wrong with you CUDA_HOME, can you try export CUDA_HOME=/usr/local/cuda ?

  16. JazyJiang commented on Oct 22, 2026

    @JazyJiang
    Collaborator

    Hi, thanks for reporting this, and sorry it went unanswered for so long. We're going through older issues and closing the ones that no longer apply to the current codebase. The code this issue refers to (colossalai/kernel/op_builder/builder.py) has since been refactored or moved to colossalai/legacy, so the problem as described no longer applies to the current main branch. We're marking it as stale and will close it in 14 days. If you still see this problem with the latest ColossalAI on PyTorch 2.x, please comment here (or open a new issue) with your environment and a minimal reproduction, and we'll take a look.

  17. JazyJiang commented on Nov 5, 2026

    @JazyJiang
    Collaborator

    Closing this issue since there has been no response in the 14 days after it was marked as stale. If you still run into this problem with the latest ColossalAI on PyTorch 2.x, please open a new issue using the bug report template, with your environment and a minimal reproduction.

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

    bugSomething isn't workingstale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions