2

I am creating a competition at https://competitions.codalab.org/. The following metadata file works:

command: python3 $program/evaluate.py $input $output

But I cannot make it install an external library. How do I do it? The following variants do not work:

command: pip3 install some_external_module
command: python3 $program/evaluate.py $input $output
command: pip3 install some_external_module && python3 $program/evaluate.py $input $output
command: pip3 install some_external_module
python3 $program/evaluate.py $input $output
2
  • 1
    What is an external library? A python library on PyPi? Or Linux package? Have you tried python3 -m pip install <library> ? Commented Mar 4, 2021 at 23:15
  • it's a python library on PyPi, this method does not unfortunately work but I've managed to do it in a different way
    – gisly
    Commented Mar 5, 2021 at 7:07

1 Answer 1

1

I've managed to do it by inserting the installation process into the evaluate.py script itself:

def install(package):
    subprocess.check_call([sys.executable, "-m", "pip", "install", package])

install(<my-package>)
import <my-package>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.