DMOJ / judge-server

Judging backend server for the DMOJ online judge.
https://dmoj.ca
GNU Affero General Public License v3.0
887 stars 251 forks source link

installation problem with pip install dmoj #822

Closed armornet closed 3 years ago

armornet commented 3 years ago

I am using ubuntu 16.04.. while installing the judge i get below error. $apt install python3-dev python3-pip build-essential libseccomp-dev this installation is complete but pip install dmoj or pip3 install dmoj
installation fails.. any advise..? out put error----- Collecting dmoj Using cached dmoj-2.1.0.tar.gz (183 kB) Requirement already satisfied: pygments in /usr/local/lib/python3.7/dist-packages (from dmoj) (2.7.3) Requirement already satisfied: pylru in /usr/local/lib/python3.7/dist-packages (from dmoj) (1.2.0) Requirement already satisfied: pyyaml in /usr/local/lib/python3.7/dist-packages (from dmoj) (5.3.1) Requirement already satisfied: setproctitle in /usr/local/lib/python3.7/dist-packages (from dmoj) (1.2.1) Requirement already satisfied: termcolor in /usr/local/lib/python3.7/dist-packages (from dmoj) (1.1.0) Requirement already satisfied: watchdog in /usr/local/lib/python3.7/dist-packages (from dmoj) (1.0.2) Building wheels for collected packages: dmoj Building wheel for dmoj (setup.py) ... error ERROR: Command errored out with exit status 1: command: /usr/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xqf7dpno/dmoj_16598a790f16453f8d90af7c8960d8f9/setup.py'"'"'; file='"'"'/tmp/pip-install-xqf7dpno/dmoj_16598a790f16453f8d90af7c8960d8f9/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-mh0fqg10 cwd: /tmp/pip-install-xqf7dpno/dmoj_16598a790f16453f8d90af7c8960d8f9/ Complete output (226 lines): /usr/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type' warnings.warn(msg) running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-3.7 creating build/lib.linux-x86_64-3.7/dmoj copying dmoj/main.py -> build/lib.linux-x86_64-3.7/dmoj ........................................................................................................................

.................................................................... /tmp/pip-install-xqf7dpno/dmoj_16598a790f16453f8d90af7c8960d8f9/dmoj/cptbox/ptdebug.cpp: In member function ‘virtual char* pt_debugger::readstr_peekdata(long unsigned int, size_t)’: /tmp/pip-install-xqf7dpno/dmoj_16598a790f16453f8d90af7c8960d8f9/dmoj/cptbox/ptdebug.cpp:183:16: error: ‘nullptr’ was not declared in this scope return nullptr; ^ /tmp/pip-install-xqf7dpno/dmoj_16598a790f16453f8d90af7c8960d8f9/dmoj/cptbox/ptdebug.cpp:208:24: error: ‘nullptr’ was not declared in this scope return nullptr; ^ /tmp/pip-install-xqf7dpno/dmoj_16598a790f16453f8d90af7c8960d8f9/dmoj/cptbox/ptdebug.cpp:226:20: error: ‘nullptr’ was not declared in this scope return nullptr; ^ error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

ERROR: Command errored out with exit status 1: /usr/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xqf7dpno/dmoj_16598a790f16453f8d90af7c8960d8f9/setup.py'"'"'; file='"'"'/tmp/pip-install-xqf7dpno/dmoj_16598a790f16453f8d90af7c8960d8f9/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-reqa2jky/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7/dmoj Check the logs for full command output.

kiritofeng commented 3 years ago

Your version of GCC is too old, please upgrade to a newer version.

armornet commented 3 years ago

-fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.7m -c dmoj/checkers/_checker.c -o build/temp.linux-x86_64-3.7/dmoj/checkers/_checker.o -march=native -O3 dmoj/checkers/_checker.c:1:20: fatal error: Python.h: No such file or directory compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

ERROR: Command errored out with exit status 1: /usr/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_89398_7/dmoj_d59a22b052bc44efbfd0a7a8738dab9a/setup.py'"'"'; file='"'"'/tmp/pip-install-_89398_7/dmoj_d59a22b052bc44efbfd0a7a8738dab9a/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-clbwi3o0/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7/dmoj Check the logs for full command output. root@video:~# gcc --version gcc (Ubuntu 9.3.0-10ubuntu2~16.04) 9.3.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

the same error after upgrading gcc

i have ubuntu 16.04 with python 3.5,3.6,3.7,3.8 and default 3.6 python

fluix-dev commented 3 years ago

You probably need to rebuild Python3-dev, please search up your problems first: https://stackoverflow.com/questions/21530577/fatal-error-python-h-no-such-file-or-directory

Also, for future comments please use code tags around your pasted errors as such:

```
code
```
armornet commented 3 years ago

I tried the installation through docker method $ git clone --recursive https://github.com/DMOJ/judge-server.git $ cd judge-server/.docker $ make judge-tier1

Is it correctly installed?

--last part of the output--------- Auto-configuring SED: Traceback (most recent call last): File "/judge/dmoj/cptbox/tracer.py", line 315, in _run_process oom_score_adj(OOM_SCORE_ADJ_MAX, self.pid) File "/judge/dmoj/utils/os_ext.py", line 20, in oom_score_adj f.write(utf8bytes(str(score))) OSError: [Errno 22] Invalid argument Failed self-test Attempted: sed: /bin/sed Errors: Traceback (most recent call last): File "/judge/dmoj/executors/base_executor.py", line 147, in run_self_test stdout, stderr = proc.communicate(test_message + b'\n') File "/judge/dmoj/utils/communicate.py", line 96, in safe_communicate proc.wait() File "/judge/dmoj/cptbox/tracer.py", line 193, in wait raise RuntimeError( RuntimeError: failed to ptrace child, check Yama config (https://www.kernel.org/doc/Documentation/security/Yama.txt, should be at most 1); if running in Docker, must run container with --cap-add=SYS_PTRACE

Auto-configuring SWIFT: Failed to find "swiftc" Auto-configuring TCL: Failed to find "tclsh" ptrace: Operation not permitted Auto-configuring TEXT: Traceback (most recent call last): File "/judge/dmoj/cptbox/tracer.py", line 315, in _run_process oom_score_adj(OOM_SCORE_ADJ_MAX, self.pid) File "/judge/dmoj/utils/os_ext.py", line 19, in oom_score_adj with open('/proc/%s/oom_score_adj' % to, 'wb') as f: PermissionError: [Errno 13] Permission denied: '/proc/300/oom_score_adj' Failed self-test Attempted: cat: /bin/cat Errors: Traceback (most recent call last): File "/judge/dmoj/executors/base_executor.py", line 147, in run_self_test stdout, stderr = proc.communicate(test_message + b'\n') File "/judge/dmoj/utils/communicate.py", line 96, in safe_communicate proc.wait() File "/judge/dmoj/cptbox/tracer.py", line 193, in wait raise RuntimeError( RuntimeError: failed to ptrace child, check Yama config (https://www.kernel.org/doc/Documentation/security/Yama.txt, should be at most 1); if running in Docker, must run container with --cap-add=SYS_PTRACE

Auto-configuring TUR: Failed to find "tprolog" Auto-configuring V8JS: Failed to find "v8dmoj" Auto-configuring ZIG: Failed to find "zig" No runtimes configured. Removing intermediate container f37f54fb60d9 ---> 864df52c8be4 Step 4/4 : ENTRYPOINT ["/judge/.docker/entry"] ---> Running in d8660bba6c0b Removing intermediate container d8660bba6c0b ---> d8af8e57941b Successfully built d8af8e57941b Successfully tagged dmoj/judge-tier1:latest ----------------output ends--------------------------

Xyene commented 3 years ago

Is it correctly installed?

No, the judge failed to configure itself. The error message states

failed to ptrace child, check Yama config (https://www.kernel.org/doc/Documentation/security/Yama.txt, should be at most 1); if running in Docker, must run container with --cap-add=SYS_PTRACE

Did you check your Yama config as per the error message? What is it?

Also, please use code formatting like @fluix-dev mentioned above for future logs, otherwise reading them is difficult.

Edit: also, what is your kernel version (uname -a)?

armornet commented 3 years ago

my kernel version is given below $uname -a Linux video.cyberarmor.in.net 4.4.0-194-generic #226-Ubuntu SMP Wed Oct 21 10:19:36 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

armornet commented 3 years ago

Your version of GCC is too old, please upgrade to a newer version.

after upgradation of gcc also the same error.. gcc (Ubuntu 9.3.0-10ubuntu2~16.04) 9.3.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

last part of the output ` copying dmoj/checkers/sorted.py -> build/lib.linux-x86_64-3.7/dmoj/checkers copying dmoj/checkers/rstripped.py -> build/lib.linux-x86_64-3.7/dmoj/checkers copying dmoj/checkers/easy.py -> build/lib.linux-x86_64-3.7/dmoj/checkers copying dmoj/checkers/floatsrel.py -> build/lib.linux-x86_64-3.7/dmoj/checkers creating build/lib.linux-x86_64-3.7/dmoj/cptbox/syscalls copying dmoj/cptbox/syscalls/aliases.list -> build/lib.linux-x86_64-3.7/dmoj/cptbox/syscalls copying dmoj/cptbox/syscalls/linux-x32.tbl -> build/lib.linux-x86_64-3.7/dmoj/cptbox/syscalls copying dmoj/cptbox/syscalls/linux-x64.tbl -> build/lib.linux-x86_64-3.7/dmoj/cptbox/syscalls copying dmoj/cptbox/syscalls/freebsd.tbl -> build/lib.linux-x86_64-3.7/dmoj/cptbox/syscalls copying dmoj/cptbox/syscalls/linux-x86.tbl -> build/lib.linux-x86_64-3.7/dmoj/cptbox/syscalls copying dmoj/cptbox/syscalls/linux-generic.tbl -> build/lib.linux-x86_64-3.7/dmoj/cptbox/syscalls copying dmoj/cptbox/syscalls/linux-arm.tbl -> build/lib.linux-x86_64-3.7/dmoj/cptbox/syscalls copying dmoj/executors/java_sandbox.jar -> build/lib.linux-x86_64-3.7/dmoj/executors copying dmoj/executors/groovy-security.policy -> build/lib.linux-x86_64-3.7/dmoj/executors copying dmoj/executors/java-security.policy -> build/lib.linux-x86_64-3.7/dmoj/executors copying dmoj/executors/scala-security.policy -> build/lib.linux-x86_64-3.7/dmoj/executors copying dmoj/executors/kotlin-security.policy -> build/lib.linux-x86_64-3.7/dmoj/executors running build_ext building 'dmoj.checkers._checker' extension creating build/temp.linux-x86_64-3.7 creating build/temp.linux-x86_64-3.7/dmoj creating build/temp.linux-x86_64-3.7/dmoj/checkers x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.7m -c dmoj/checkers/_checker.c -o build/temp.linux-x86_64-3.7/dmoj/checkers/_checker.o -march=native -O3 dmoj/checkers/_checker.c:1:20: fatal error: Python.h: No such file or directory compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

ERROR: Command errored out with exit status 1: /usr/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-tnk3qri0/dmoj_853ca54f5b4841b18026d5fadcba30db/setup.py'"'"'; file='"'"'/tmp/pip-install-tnk3qri0/dmoj_853ca54f5b4841b18026d5fadcba30db/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-39u1jp5u/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7/dmoj Check the logs for full command output. `

kiritofeng commented 3 years ago

Note that it fails on something different...you're missing the Python.h header this time

armornet commented 3 years ago

I

Note that it fails on something different...you're missing the Python.h header this time

I am upgrading my server os from 16.04 to 18.04 now.. will get back in a couple of minutes after i test after the upgradation

armornet commented 3 years ago

ok after OS upgradation from 16.04 to 20.04 the below command worked perfectly and installation was successful $pip3 install dmoj

after this should i go for the docker installation instructions?

armornet commented 3 years ago

device enp1s0 not found

fluix-dev commented 3 years ago

device enp1s0 not found

Read the script you're using and adjust as necessary.

armornet commented 3 years ago

ok i installed but while connecting the judge to the site i get the below error.. but i have placed judge.yml into the /mnt/problems/ ditrectory

` root@video:~/judge-server/.docker# dmoj -c judge.yml localhost Traceback (most recent call last): File "/usr/local/bin/dmoj", line 8, in sys.exit(main()) File "/usr/local/lib/python3.8/dist-packages/dmoj/judge.py", line 363, in main judgeenv.load_env() File "/usr/local/lib/python3.8/dist-packages/dmoj/judgeenv.py", line 141, in load_env with open(model_file) as init_file: FileNotFoundError: [Errno 2] No such file or directory: 'judge.yml' root@video:~/judge-server/.docker# supervisorctl status bridged RUNNING pid 84715, uptime 0:00:02 celery EXITED Jan 07 09:51 AM site RUNNING pid 83824, uptime 0:12:08 wsevent FATAL can't find command '/usr/bin/node' root@video:~/judge-server/.docker# dmoj -c judge.yml localhost Traceback (most recent call last): File "/usr/local/bin/dmoj", line 8, in sys.exit(main()) File "/usr/local/lib/python3.8/dist-packages/dmoj/judge.py", line 363, in main judgeenv.load_env() File "/usr/local/lib/python3.8/dist-packages/dmoj/judgeenv.py", line 141, in load_env with open(model_file) as init_file: FileNotFoundError: [Errno 2] No such file or directory: 'judge.yml'

`

kiritofeng commented 3 years ago

RTFM