Работа с Numpy и matplotlib (python 3.5.3)

Обсуждение вопросов, связанных с системой проведения турниров ejudge.
Post Reply
rgusarev
Posts: 16
Joined: 15 January 2016, 10:10

Работа с Numpy и matplotlib (python 3.5.3)

Post by rgusarev » 30 October 2017, 23:21

UPD:
проблема решена настройками компилятора -- количеством выделяемой памяти (max_vm_size был по недосмотру выставлен в 64M)

Здравствуйте,

пытаемся на 3.7.1 сделать контест с чтением бинарных (графических) файлов.
Numpy нормально импортируется, задачи сдаются и тестируются.
При сдаче решения, читающего png-файл, с таким текстом:
--------------------------------
import matplotlib
matplotlib.use('Agg')
from skimage import io
img = io.imread('input.png')

H, W = len(img), len(img[0])

print(W)
print(H)
--------------------------------

тестирующая система выдаёт run-time, а в консоли на сервере всё работает. Диагноз RT такой (падает первая строчка с импортом matplotlib):
--------------------------------
Traceback (most recent call last):
File "/home/ejudge/py3env/lib/python3.5/site-packages/numpy/core/__init__.py", line 16, in <module>
from . import multiarray
ImportError: libopenblasp-r0-39a31c03.2.18.so: failed to map segment from shared object

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./000029", line 4, in <module>
import matplotlib # нужно только для тестирующей системы
File "/home/ejudge/py3env/lib/python3.5/site-packages/matplotlib/__init__.py", line 124, in <module>
from . import cbook
File "/home/ejudge/py3env/lib/python3.5/site-packages/matplotlib/cbook/__init__.py", line 35, in <module>
import numpy as np
File "/home/ejudge/py3env/lib/python3.5/site-packages/numpy/__init__.py", line 142, in <module>
from . import add_newdocs
File "/home/ejudge/py3env/lib/python3.5/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/home/ejudge/py3env/lib/python3.5/site-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/home/ejudge/py3env/lib/python3.5/site-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/home/ejudge/py3env/lib/python3.5/site-packages/numpy/core/__init__.py", line 26, in <module>
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.

Original error was: libopenblasp-r0-39a31c03.2.18.so: failed to map segment from shared object
--------------------------------

User avatar
ShashkovS
Posts: 3
Joined: 10 January 2016, 18:36
Location: Москва

Re: Работа с Numpy и matplotlib (python 3.5.3)

Post by ShashkovS » 31 October 2017, 00:43

Вроде должно работать с такими параметрами:

Code: Select all

[problem]
abstract
short_name = "BinImage"
use_stdin
input_file = "input.png"
combined_stdin
use_stdout
output_file = "output.png"
combined_stdout
binary_input
xml_file = ""
test_dir = "%Ps"
test_sfx = ".dat"
test_pat = "%02d.png"
use_corr
corr_dir = "%Ps"
corr_sfx = ".ans"
corr_pat = "%02d.a.png"
info_dir = "%Ps"
info_pat = ""
tgz_dir = "%Ps"
tgz_pat = ""
tgzdir_pat = ""
time_limit = 3
real_time_limit = 5
max_vm_size = 1G
standard_checker = ""
check_cmd = "check"
valuer_cmd = ""
use_ac_not_ok
ignore_prev_ac
team_enable_rep_view
team_enable_ce_view
team_show_judge_report
show_checker_comment
ignore_compile_errors
disable_auto_testing = 0
disable_user_submit = 0
notify_on_submit = 0
enable_submit_after_reject = 0
enable_tokens = 0
tokens_for_user_ac = 0
disable_submit_after_ok = 0
disable_security
enable_suid_run = 0
disable_testing = 0
enable_compilation = 0
disable_ctrl_chars
enable_text_form
normalization = "nl"


[problem]
id = 1
super = "BinImage"
short_name = "A"
long_name = "..."
type = "standard"
standard_checker = ""
checker_env = "MPLBACKEND=Agg"
lang_compiler_env = "MPLBACKEND=Agg"
Для работы там требуется фигова туча оперативки.

Post Reply