BERN2: FileNotFoundError: [Errno 2] for local server POST

Hello. I installed BERN2 in my VM (Ubuntu 18.04 x64, 1 GPU). It succesfully installed, however, if I run example post script on READAME.md, then the below error occured. (Server console log)

[23/Mar/2022 06:02:40.831728] [550f7242b14dc039a8a5ee6aa9233f3472dd7b4a33484f5955175a4d] GNormPlus 0.0001380443572998047 sec
Traceback (most recent call last):
  File "/home/vessl/BERN2/bern2/bern2.py", line 106, in annotate_text
    output = self.tag_entities(text, base_name)
  File "/home/vessl/BERN2/bern2/bern2.py", line 358, in tag_entities
    async_result = loop.run_until_complete(self.async_ner(arguments_for_coroutines))
  File "/home/vessl/miniconda3/envs/bern2/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
    return future.result()
  File "/home/vessl/BERN2/bern2/bern2.py", line 491, in async_ner
    result = await asyncio.gather(*coroutines)
  File "/home/vessl/BERN2/bern2/bern2.py", line 533, in _ner_wrap
    with open(output_mtner, 'r', encoding='utf-8') as f:
FileNotFoundError: [Errno 2] No such file or directory: './multi_ner/output/550f7242b14dc039a8a5ee6aa9233f3472dd7b4a33484f5955175a4d.PubTator.json'

[2022-03-23 06:02:41,425] ERROR in app: Exception on /plain [POST]
Traceback (most recent call last):
  File "/home/vessl/miniconda3/envs/bern2/lib/python3.7/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/vessl/miniconda3/envs/bern2/lib/python3.7/site-packages/flask/app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/vessl/miniconda3/envs/bern2/lib/python3.7/site-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/vessl/miniconda3/envs/bern2/lib/python3.7/site-packages/flask/app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/home/vessl/BERN2/app/__init__.py", line 85, in plain_api
    return Response(json.dumps({"error_message": result_dict["error_message"]}), status=404, content_type='application/json')
NameError: name 'Response' is not defined
127.0.0.1 - - [23/Mar/2022 06:02:41] "POST /plain HTTP/1.1" 500 -

nohup_multi_ner.out log

MTNER init_t 28.547 sec.
1it [00:00, 185.89it/s]
Prediction: 100%|██████████| 1/1 [00:00<00:00,  2.28it/s]
Traceback (most recent call last):
  File "multi_ner/ner_server.py", line 91, in <module>
    run_server(mt_ner, args)
  File "multi_ner/ner_server.py", line 63, in run_server
    mtner_recognize(model, dict_path, base_name, args)
  File "multi_ner/ner_server.py", line 47, in mtner_recognize
    with open(output_mt_ner, 'w', encoding='utf-8') as f:
PermissionError: [Errno 13] Permission denied: 'multi_ner/output/550f7242b14dc039a8a5ee6aa9233f3472dd7b4a33484f5955175a4d.PubTator.json'

Thank you.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 26 (11 by maintainers)

Most upvoted comments

Hi, I’m getting a similiar error.

But I tried to reinstalled CRF+±0.58 ,renamed it and tried: $ ./configure --prefix=“$HOME” $ make $ make install

the log still shows:

Arguments:
	host: 0.0.0.0
	port: 8888
	mtner_home: ./multi_ner
	mtner_port: 18894
	gnormplus_home: ./resources/GNormPlusJava
	gnormplus_port: 18895
	tmvar2_home: ./resources/tmVarJava
	tmvar2_port: 18896
	cache_host: localhost
	cache_port: 27017
	gene_norm_port: 18888
	disease_norm_port: 18892
	use_neural_normalizer: True
	keep_files: False
	front_dev: False
/home/scholar1/bern2/BERN2/app
[03/May/2022 16:26:11.494623] BERN2 LOADING..
./output 0
./resources/GNormPlusJava/input 1
./resources/tmVarJava/input 1
./multi_ner/input 1
./multi_ner/tmp 0
./multi_ner/output 1
start loading neural normalizer..
neural_disease_normalizer is loaded.. model=dmis-lab/biosyn-sapbert-bc5cdr-disease , dictionary=resources/normalization/normalizers/neural_norm_caches/dict_Disease_20210630.txt.pk
neural_chemical_normalizer is loaded.. model=dmis-lab/biosyn-sapbert-bc5cdr-chemical , dictionary=resources/normalization/normalizers/neural_norm_caches/dict_ChemicalCompound_20210630.txt.pk
neural_gene_normalizer is loaded.. model=dmis-lab/biosyn-sapbert-bc2gn , dictionary=resources/normalization/normalizers/neural_norm_caches/dict_Gene.txt.pk
[03/May/2022 16:31:20.109368] BERN2 LOADED..
 * Serving Flask app 'app' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on all addresses (0.0.0.0)
   WARNING: This is a development server. Do not use it in a production deployment.
 * Running on http://127.0.0.1:8888
 * Running on http://192.168.1.100:8888 (Press CTRL+C to quit)
[03/May/2022 16:31:45.433902] id: 618c194f757312b3ded0db7102f2bfaa49de13599c0136c3ad50fe39
[Errno 111] Connection refused
[03/May/2022 16:31:45.667640] [618c194f757312b3ded0db7102f2bfaa49de13599c0136c3ad50fe39] GNormPlus 0.0005099773406982422 sec
[03/May/2022 16:31:58.768150] [618c194f757312b3ded0db7102f2bfaa49de13599c0136c3ad50fe39] Multi-task NER 13.100327014923096 sec, #entities: 2
[03/May/2022 16:32:03.884995] [618c194f757312b3ded0db7102f2bfaa49de13599c0136c3ad50fe39] tmVar 2.0 18.344019412994385 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/618c194f757312b3ded0db7102f2bfaa49de13599c0136c3ad50fe39.PubTator' -> './resources/tmVarJava/input/618c194f757312b3ded0db7102f2bfaa49de13599c0136c3ad50fe39.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/618c194f757312b3ded0db7102f2bfaa49de13599c0136c3ad50fe39.PubTator'

127.0.0.1 - - [03/May/2022 16:32:04] "POST /plain HTTP/1.1" 404 -

In addition, I am on Linux and my gcc version is 7.5.0(Ubuntu 7.5.0-3ubuntu1~18.04) .i notice the information above, crf_test is in my GNormPlusJava/CRF directory and there is nothing in my GNormPlusJava/output directory but I don’t know how to fix it.

Hi @starmpcc @ixalidamus @lengluodefanhua

First of all, I removed sudo from run_bern2.sh after verifying that BERN2 can run without it.

It’s most likely that the external modules (Multi-NER, tmVar, GNormPlus, etc.) are causing the issue. The reasons are various, so we need to check the logs.

The log files are saved in /logs so you can check them to see which module is causing the issue.

If you find anything suspicious in the logs, please share it with me so that I can help you.