Numpy library

Numpy library

por Pedro Moreira -
Número de respuestas: 1

I want to write a Python question, using numpy. But I think this library has not been installed as default. So, a test with the line "import numpy as np" will return:

Traceback (most recent call last):
  File "__tester__.python3", line 1, in <module>
    import numpy
ModuleNotFoundError: No module named 'numpy'
Is there a way to install locally the numpy library? For example, as a support file.

Can anyone provide a step-by-step instruction how to do this? Sorry, but I am beginner with CodeRunner.

En respuesta a Pedro Moreira

Re: Numpy library

por Richard Lobb -

The only solution I know of is to install numpy on the Jobe server. This is just a single command for a sysadmin:

    sudo -H python3 -m pip install numpy

I suggest you ask whoever manages your Jobe server to run that command for you. You could perhaps mention to them that they will of course need to take down the firewall temporarily while they run the command.

It is also possible for question authors to set up their own Jobe servers and use them within specially customised questions but this isn't a suitable approach for beginner CodeRunner users!

One more thing: numpy needs a lot of memory and it is likely that your questions will crash with a segment fault when run. To avoid this you need to increase the memory limit for the questions:

  • Open the author's view of the question
  • Click the Customise checkbox
  • Open Advanced Customisation
  • Set the memory limit to a larger value.