monajalal/Kenyan-Food

ModuleNotFoundError: No module named 'pytorch_pretrained_bert'

monajalal opened this issue · 5 comments

[jalal@scc-k10 annan]$ module load python3/3.6.5
[jalal@scc-k10 annan]$ module load gcc/5.5.0
[jalal@scc-k10 annan]$ module load cuda/10.1
[jalal@scc-k10 annan]$ module load pytorch/1.3

and error is:

[jalal@scc-k10 annan]$ python ftr_exp.py 
Traceback (most recent call last):
  File "ftr_exp.py", line 21, in <module>
    from pytorch_pretrained_bert import BertTokenizer, BertModel, BertForMaskedLM
ModuleNotFoundError: No module named 'pytorch_pretrained_bert'

[jalal@scc-k10 annan]$ pwd
/projectnb/ivcgroup/annan


pip install --user pytorch_pretrained_bert

[jalal@scc-k10 annan]$ pip install --user pytorch_pretrained_bert
Traceback (most recent call last):
File "/share/pkg.7/python3/3.6.5/install/bin/pip", line 11, in
sys.exit(main())
TypeError: 'module' object is not callable

[jalal@scc-k10 annan]$ module unload pytorch
[jalal@scc-k10 annan]$ pip install --user pytorch_pretrained_bert
Traceback (most recent call last):
  File "/share/pkg.7/python3/3.6.5/install/bin/pip", line 11, in <module>
    sys.exit(main())
TypeError: 'module' object is not callable

[jalal@scc-k10 annan]$ module purge
[jalal@scc-k10 annan]$ module load python3/3.6.5
[jalal@scc-k10 annan]$ module load gcc/5.5.0
[jalal@scc-k10 annan]$ module load cuda/10.1
[jalal@scc-k10 annan]$ pip install --user pytorch_pretrained_bert
Traceback (most recent call last):
  File "/share/pkg.7/python3/3.6.5/install/bin/pip", line 11, in <module>
    sys.exit(main())
TypeError: 'module' object is not callable
[jalal@scc2 annan]$ module load cuda/10.1
[jalal@scc2 annan]$ module load python3/3.6.5
[jalal@scc2 annan]$ module load pytorch/1.3
[jalal@scc2 annan]$ python -m pip install --user pytorch-pretrained-bert pytorch-nlp
Requirement already satisfied: pytorch-pretrained-bert in /usr3/graduate/jalal/.local/lib/python3.6/site-packages (0.6.2)
Requirement already satisfied: pytorch-nlp in /usr3/graduate/jalal/.local/lib/python3.6/site-packages (0.5.0)
Requirement already satisfied: regex in /usr3/graduate/jalal/.local/lib/python3.6/site-packages (from pytorch-pretrained-bert) (2019.12.9)
Requirement already satisfied: tqdm in /share/pkg.7/python3/3.6.9/install/lib/python3.6/site-packages (from pytorch-pretrained-bert) (4.36.1)
Requirement already satisfied: boto3 in /share/pkg.7/python3/3.6.9/install/lib/python3.6/site-packages (from pytorch-pretrained-bert) (1.9.244)
Requirement already satisfied: numpy in /share/pkg.7/python3/3.6.9/install/lib/python3.6/site-packages/numpy-1.17.2-py3.6-linux-x86_64.egg (from pytorch-pretrained-bert) (1.17.2)
Collecting torch>=0.4.1
  Downloading https://files.pythonhosted.org/packages/88/95/90e8c4c31cfc67248bf944ba42029295b77159982f532c5689bcfe4e9108/torch-1.3.1-cp36-cp36m-manylinux1_x86_64.whl (734.6MB)
     |################################| 734.6MB 43kB/s 
Requirement already satisfied: requests in /share/pkg.7/python3/3.6.9/install/lib/python3.6/site-packages (from pytorch-pretrained-bert) (2.22.0)
Requirement already satisfied: s3transfer<0.3.0,>=0.2.0 in /share/pkg.7/python3/3.6.9/install/lib/python3.6/site-packages (from boto3->pytorch-pretrained-bert) (0.2.1)
Requirement already satisfied: botocore<1.13.0,>=1.12.244 in /share/pkg.7/python3/3.6.9/install/lib/python3.6/site-packages (from boto3->pytorch-pretrained-bert) (1.12.244)
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /share/pkg.7/python3/3.6.9/install/lib/python3.6/site-packages (from boto3->pytorch-pretrained-bert) (0.9.4)
Requirement already satisfied: idna<2.9,>=2.5 in /share/pkg.7/python3/3.6.9/install/lib/python3.6/site-packages (from requests->pytorch-pretrained-bert) (2.8)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /share/pkg.7/python3/3.6.9/install/lib/python3.6/site-packages (from requests->pytorch-pretrained-bert) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /share/pkg.7/python3/3.6.9/install/lib/python3.6/site-packages (from requests->pytorch-pretrained-bert) (1.25.6)
Requirement already satisfied: certifi>=2017.4.17 in /share/pkg.7/python3/3.6.9/install/lib/python3.6/site-packages (from requests->pytorch-pretrained-bert) (2019.9.11)
Requirement already satisfied: docutils<0.16,>=0.10 in /share/pkg.7/python3/3.6.9/install/lib/python3.6/site-packages (from botocore<1.13.0,>=1.12.244->boto3->pytorch-pretrained-bert) (0.15.2)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1; python_version >= "2.7" in /share/pkg.7/python3/3.6.9/install/lib/python3.6/site-packages (from botocore<1.13.0,>=1.12.244->boto3->pytorch-pretrained-bert) (2.8.0)
Requirement already satisfied: six>=1.5 in /share/pkg.7/python3/3.6.9/install/lib/python3.6/site-packages (from python-dateutil<3.0.0,>=2.1; python_version >= "2.7"->botocore<1.13.0,>=1.12.244->boto3->pytorch-pretrained-bert) (1.12.0)
Installing collected packages: torch
  WARNING: The scripts convert-caffe2-to-onnx and convert-onnx-to-caffe2 are installed in '/usr3/graduate/jalal/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed torch-1.3.1
WARNING: You are using pip version 19.3; however, version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.