@ImportError: cannot import name 'get_args' from 'megatron' (/opt/conda/lib/python3.8/site-packages/megatron/__init__.py)
State: closed | Pull request: no

@haythemtellili couldn't reproduce your error, but could you try:
`! pip install transformers==2.6 # due to HuggingFace transformer library updates`
`! pip install nemo_toolkit[all]`
`import nemo.collections.nlp as nemo_nlp`

_Originally posted by @ekmb in https://github.com/NVIDIA/NeMo/issues/830#issuecomment-656226295_

Hi I tried above approach but still mine issue not solved, could you please help on it

I am getting below error on running the command: import nemo.collections.nlp as nemo_nlp

ImportError: cannot import name 'get_args' from 'megatron' (/opt/conda/lib/python3.8/site-packages/megatron/__init__.py) 

Full error trace below:

ImportErrorTraceback (most recent call last)
<ipython-input-32-2d87ef91019a> in <module>
----> 1 import nemo.collections.nlp as nemo_nlp

/opt/conda/lib/python3.8/site-packages/nemo/collections/nlp/__init__.py in <module>
     13 # limitations under the License.
     14 
---> 15 from nemo.collections.nlp import data, losses, models, modules
     16 from nemo.package_info import __version__
     17 

/opt/conda/lib/python3.8/site-packages/nemo/collections/nlp/models/__init__.py in <module>
     13 # limitations under the License.
     14 
---> 15 from nemo.collections.nlp.models.dialogue_state_tracking.sgdqa_model import SGDQAModel
     16 from nemo.collections.nlp.models.duplex_text_normalization import (
     17     DuplexDecoderModel,

/opt/conda/lib/python3.8/site-packages/nemo/collections/nlp/models/dialogue_state_tracking/__init__.py in <module>
     13 # limitations under the License.
     14 
---> 15 from nemo.collections.nlp.models.dialogue_state_tracking.sgdqa_model import SGDQAModel

/opt/conda/lib/python3.8/site-packages/nemo/collections/nlp/models/dialogue_state_tracking/sgdqa_model.py in <module>
     31 from nemo.collections.nlp.data.dialogue_state_tracking.sgd.prediction_utils import write_predictions_to_file
     32 from nemo.collections.nlp.losses import SGDDialogueStateLoss
---> 33 from nemo.collections.nlp.models.nlp_model import NLPModel
     34 from nemo.collections.nlp.modules import SGDDecoder, SGDEncoder
     35 from nemo.collections.nlp.modules.common.lm_utils import get_lm_model

/opt/conda/lib/python3.8/site-packages/nemo/collections/nlp/models/nlp_model.py in <module>
     22 
     23 import torch
---> 24 from megatron import mpu
     25 from megatron.checkpointing import get_checkpoint_version, set_checkpoint_version
     26 from omegaconf import DictConfig, OmegaConf

/opt/conda/lib/python3.8/site-packages/megatron/mpu/__init__.py in <module>
     42 from .initialize import model_parallel_is_initialized
     43 
---> 44 from .layers import ColumnParallelLinear
     45 from .layers import RowParallelLinear
     46 from .layers import VocabParallelEmbedding

/opt/conda/lib/python3.8/site-packages/megatron/mpu/layers.py in <module>
     32 from .mappings import reduce_from_tensor_model_parallel_region
     33 from .mappings import scatter_to_tensor_model_parallel_region
---> 34 from .random import get_cuda_rng_tracker
     35 from .utils import divide
     36 from .utils import split_tensor_along_last_dim

/opt/conda/lib/python3.8/site-packages/megatron/mpu/random.py in <module>
     25 from torch.utils.checkpoint import detach_variable
     26 
---> 27 from megatron import get_args
     28 from megatron.memory import allocate_mem_buff
     29 

ImportError: cannot import name 'get_args' from 'megatron' (/opt/conda/lib/python3.8/site-packages/megatron/__init__.py)