[contestms] Re: Issue with python+numpy and cms v1.2

  • From: Claudio Alvarez <calvarez1@xxxxxxxxxxx>
  • To: contestms@xxxxxxxxxxxxx
  • Date: Sat, 27 May 2017 16:08:06 -0400

I got back to work on this issue and found the solution.
Firstly, I made a beginner's mistake, as I installed numpy with pip for the
current user and not systemwide.
After I managed to install numpy properly, I still got errors when running
programs that included NumPy and did computation with matrices and arrays.
The error I was getting (in stderr.txt) is as follows:

OpenBLAS blas_thread_init: pthread_create: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 1 current, 1 max

Traceback (most recent call last):

... python/numpy mambo-jumbo here, and then a mysterious:

KeyboardInterrupt

So, I figured out how to incresase the number of processes in isolate by
modifying the value in Sandbox.py. I increased the value to 99 and voilà,
now Numpy programs are properly graded.

------------------------------
*Claudio Alvarez Gómez, Ph.D.*
Profesor Asistente, Ciencias de la Computación
Facultad de Ingeniería y Ciencias Aplicadas
Universidad de los Andes
Av. Mons. Álvaro del Portillo 12.455
Las Condes, Santiago, Chile
Teléfono: +562 2618 1323
http://www.uandes.cl

On Mon, Apr 10, 2017 at 6:31 PM, Stefano Maggiolo <s.maggiolo@xxxxxxxxx>
wrote:

Ok, thanks. How I would proceed: change keep_sandbox to true, find the
sandbox where it is not working, try to execute the isolate command
manually, see if it still fails. If so, look at the mapped directories, and
try to see if numpy is in one of these or not. Redo adding the required
directory to the arguments.

Or maybe it's an entirely different issue. :(

On 10 April 2017 at 20:11, Claudio Alvarez <calvarez1@xxxxxxxxxxx> wrote:

Thank you Stefano. I am using Ubuntu Server 16.04 LTS, everything
vanilla, with no virtual environments for Python.
I will continue to tinker with this and see what happens. I will share my
solution if I manage to get numpy working.

------------------------------
*Claudio Alvarez Gómez, Ph.D.*
Profesor Asistente, Ciencias de la Computación
Facultad de Ingeniería y Ciencias Aplicadas
Universidad de los Andes
Av. Mons. Álvaro del Portillo 12.455
Las Condes, Santiago, Chile
Teléfono: +562 2618 1323
http://www.uandes.cl

On Sun, Apr 9, 2017 at 2:01 AM, Stefano Maggiolo <s.maggiolo@xxxxxxxxx>
wrote:

It works for me - maybe the reason is that you use a virtualenv for
running CMS, and you installed numpy only there? The libraries visibile to
the submission are those installed in the system, which might be a
different set than those available to CMS.

Another possibility is that your distribution requires a different
"allowed path". What distro are you using?

On 5 April 2017 at 19:18, Claudio Alvarez <calvarez1@xxxxxxxxxxx> wrote:

Hi all,

I just ran a contest in which Python was allowed, and a student of mine
submitted code that included numpy. Execution failed because Python was
unable to find numpy when running within isolate:

[stderr.txt]
Traceback (most recent call last):
  File "M2A1.py", line 7, in <module>
ImportError: No module named numpy

[submitted program]
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 04 15:33:22 2017

@author: lab108
"""
from numpy import math

-----

Compilation commands are as follows:
/usr/bin/python2 -m py_compile M2A1.py
/bin/mv M2A1.pyc M2A1

I have installed numpy and scipy in all servers with pip, however, I
still get the same error!
Is this error somehow related to the compilation command?

Thanks for any help.

Best,

------------------------------
*Claudio Alvarez Gómez, Ph.D.*
Profesor Asistente, Ciencias de la Computación
Facultad de Ingeniería y Ciencias Aplicadas
Universidad de los Andes
Av. Mons. Álvaro del Portillo 12.455
Las Condes, Santiago, Chile
Teléfono: +562 2618 1323
http://www.uandes.cl





Other related posts: