dmis-lab / BERN2

BERN2: an advanced neural biomedical namedentity recognition and normalization tool
http://bern2.korea.ac.kr
BSD 2-Clause "Simplified" License
174 stars 41 forks source link

FileNotFoundError: [Errno 2] #24

Closed yuetieqi-meow closed 2 years ago

yuetieqi-meow commented 2 years ago

Hello, I posted my error a few days ago in this and I retried a few times these days. I found it's really hard for me to fix it because all logs except nohup_bern2.out goes well. Here is my lastest nohup_bern2.out:

[08/May/2022 19:28:51.930673] id: 1c3d05e08ffc1ca51c537406a8e2342fd5c546912049d73bd31e0427
[Errno 111] Connection refused
[08/May/2022 19:28:52.126999] [1c3d05e08ffc1ca51c537406a8e2342fd5c546912049d73bd31e0427] GNormPlus 0.0005352497100830078 sec
[08/May/2022 19:29:07.017467] [1c3d05e08ffc1ca51c537406a8e2342fd5c546912049d73bd31e0427] Multi-task NER 14.890285730361938 sec, #entities: 2
[08/May/2022 19:29:26.444897] [1c3d05e08ffc1ca51c537406a8e2342fd5c546912049d73bd31e0427] tmVar 2.0 34.42515420913696 sec
Traceback (most recent call last):
  File "/home/scholar1/anaconda3/envs/bern2/lib/python3.7/shutil.py", line 566, in move
    os.rename(src, real_dst)
FileNotFoundError: [Errno 2] No such file or directory: './resources/GNormPlusJava/output/1c3d05e08ffc1ca51c537406a8e2342fd5c546912049d73bd31e0427.PubTator' -> './resources/tmVarJava/input/1c3d05e08ffc1ca51c537406a8e2342fd5c546912049d73bd31e0427.PubTator.PubTator.Gene'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/scholar1/bern2/BERN2/bern2/bern2.py", line 106, in annotate_text
    output = self.tag_entities(text, base_name)
  File "/home/scholar1/bern2/BERN2/bern2/bern2.py", line 371, in tag_entities
    shutil.move(output_gnormplus, input_tmvar_gene)
  File "/home/scholar1/anaconda3/envs/bern2/lib/python3.7/shutil.py", line 580, in move
    copy_function(src, real_dst)
  File "/home/scholar1/anaconda3/envs/bern2/lib/python3.7/shutil.py", line 266, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/home/scholar1/anaconda3/envs/bern2/lib/python3.7/shutil.py", line 120, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: './resources/GNormPlusJava/output/1c3d05e08ffc1ca51c537406a8e2342fd5c546912049d73bd31e0427.PubTator'

127.0.0.1 - - [08/May/2022 19:29:27] "POST /plain HTTP/1.1" 404 -

and all other 5 logs just similar as I posted here

Thank you!

yuetieqi-meow commented 2 years ago

I tried to debug it and I met some question. There is no file in ./resources/GNormPlusJava/output,so I read the code in bern2.py and tried to find how it outputs the file to the dir.I'm a bit confused that I found the async_result in Line 358(and I can print it) but I don't know where it is output. So may I get some help? Thank you!

mjeensung commented 2 years ago

Hi @yuetieqi-meow

Thank you for informing the issue.

The output of GNormPlusJava is generated by the GNormPlusJava module, which is a black box from the BERN2's side. Line 358 in BERN2 just requests some actions from GNormPlusJava.

By the way, it's odd because I can't find any clue from your logs. Does the issue still exist even after you kill and restart all of the processes (i.e., ner_server.py, GNormPlusServer.main.jar, tmVar2Server.main.jar, disease_normalizer_21.jar, gnormplus-normalization_21.jar, and server.py) ?

mjeensung commented 2 years ago

We uploaded a new version of the resource files. Here's how to download the resource and install it. Could you try this?

wget http://nlp.dmis.korea.edu/projects/bern2-sung-et-al-2022/resources_v1.1.b.tar.gz
tar -zxvf resources_v1.1.b.tar.gz
rm -rf resources_v1.1.b.tar.gz

# (For Linux/MacOS Users) install CRF 
cd resources/GNormPlusJava
tar -zxvf CRF++-0.58.tar.gz
mv CRF++-0.58 CRF
cd CRF
./configure --prefix="$HOME"
make
make install
cd ../../..

# (For Windows Users) install CRF 
cd resources/GNormPlusJava
unzip -zxvf CRF++-0.58.zip
mv CRF++-0.58 CRF
cd ../..
yuetieqi-meow commented 2 years ago

thanks for replying! I cloned the project on another server and re-install the CRF just a few days after I opened the issue, and it goes very well. So, I don't know what happened yet, and sorry for no reply such a long time.

mjeensung commented 2 years ago

Thanks @yuetieqi-meow!

kunlu-ou commented 2 years ago

I am running into same issue as @yuetieqi-meow No issue encountered in installation, and when I ran the test, in the nohup_bern2.out: `[01/Oct/2022 17:54:12.841469] id: 9f85ebe7f122e750ca113ce20ef88f448960721e701cd1cc3e1650e2 [Errno 111] Connection refused [01/Oct/2022 17:54:12.899379] [9f85ebe7f122e750ca113ce20ef88f448960721e701cd1cc3e1650e2] GNormPlus 0.0003619194030761719 sec [01/Oct/2022 17:54:13.614587] [9f85ebe7f122e750ca113ce20ef88f448960721e701cd1cc3e1650e2] tmVar 2.0 0.7597899436950684 sec [01/Oct/2022 17:54:13.801885] [9f85ebe7f122e750ca113ce20ef88f448960721e701cd1cc3e1650e2] Multi-task NER 0.9021279811859131 sec, #entities: 2 Traceback (most recent call last): File "/home/kun/anaconda3/envs/bern2/lib/python3.7/shutil.py", line 566, in move os.rename(src, real_dst) FileNotFoundError: [Errno 2] No such file or directory: './resources/GNormPlusJava/output/9f85ebe7f122e750ca113ce20ef88f448960721e701cd1cc3e1650e2.PubTator' -> './resources/tmVarJava/input/9f85ebe7f122e750ca113ce20ef88f448960721e701cd1cc3e1650e2.PubTator.PubTator.Gene'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/media/kun/Storage/BERN2/bern2/bern2.py", line 107, in annotate_text output = self.tag_entities(text, base_name) File "/media/kun/Storage/BERN2/bern2/bern2.py", line 376, in tag_entities shutil.move(output_gnormplus, input_tmvar_gene) File "/home/kun/anaconda3/envs/bern2/lib/python3.7/shutil.py", line 580, in move copy_function(src, real_dst) File "/home/kun/anaconda3/envs/bern2/lib/python3.7/shutil.py", line 266, in copy2 copyfile(src, dst, follow_symlinks=follow_symlinks) File "/home/kun/anaconda3/envs/bern2/lib/python3.7/shutil.py", line 120, in copyfile with open(src, 'rb') as fsrc: FileNotFoundError: [Errno 2] No such file or directory: './resources/GNormPlusJava/output/9f85ebe7f122e750ca113ce20ef88f448960721e701cd1cc3e1650e2.PubTator'`

No other issues found on other log files: nohup_disease_normalize.out: Sieve loading .. 2628 ms, Ready nohup_gene_normalize.out: Ready (port 18888) nohup_gnormplus.out: Starting GNormPlus Service at 127.0.1.1:18895 Loading Gene Dictionary : Processing ... Loading Gene Dictionary : Processing Time:9.951sec Ready nohup_multi_ner.out: `MTNER init_t 13.013 sec.

0it [00:00, ?it/s] 1it [00:00, 34.71it/s]

Prediction: 0%| | 0/1 [00:00<?, ?it/s] Prediction: 100%|██████████| 1/1 [00:00<00:00, 1.37it/s] Prediction: 100%|██████████| 1/1 [00:00<00:00, 1.37it/s] nohup_tmvar.out: Starting tmVar 2.0 Service at 127.0.1.1:18896 Reading POS tagger model from lib/taggers/english-left3words-distsim.tagger ... done [1.5 sec]. Loading tmVar : Processing Time:1.739sec Ready input/9f85ebe7f122e750ca113ce20ef88f448960721e701cd1cc3e1650e2.PubTator - (PubTator format) : Processing Time:0.521sec ner success = 9f85ebe7f122e750ca113ce20ef88f448960721e701cd1cc3e1650e2.PubTator`

I noticed when I ran the test case, the nohup_bern2.out nohup_multi_ner.out and nohup_tmvar.out logs are updated, but nohup_gnormplus.out is not (the other two normalize.out log files are not, and I assume because they are not executed because NER encounters error). This sounds like GNormPlus not executed at all? Any ideas on this?