nanovms / ops

ops - build and run nanos unikernels
https://ops.city
MIT License
1.3k stars 132 forks source link

Problems with adding sklearn module #382

Closed kuropyatnik closed 2 years ago

kuropyatnik commented 5 years ago

I have done already hello-world example on python3. Image was created successfully, but after that i decided to work with some ML models. So i created virtual env and installed on it sklearn. File is working, i compiled it. But when i try to make this command: ops load python_3.6.7 -c config.json config.json: { "Files": [ "iris-model.py" ], "Args": [ "python", "iris-model.py" ], "Env": { "HOME": "/", "PYTHONDONTWRITEBYTECODE": "1", "PYTHONUNBUFFERED": "1" }, "MapDirs": { ops-env/lib/python3.6/site-packages/*": "/usr/lib/site_packages" } } It returns next result:

allocate table failed

And large logs of failed copying process. Of course, i've done something wrong, but my main question - how could i install or use some modules from pip, that aren't in default package? Sorry for this silly question, Thanks in advance.

eyberg commented 5 years ago

w/the above fixes and this config the example works ->

eyberg@box:~/pt3$ cat config.json
{
  "MapDirs": {"/home/eyberg/.local/*": "/.local" },
  "Dirs": ["usr", "lib"],
  "Files": ["model.py"]
}
eyberg@box:~/pt3$ tree usr/
usr/
└── lib
    └── x86_64-linux-gnu
        ├── libffi.so.6
        └── libstdc++.so.6

2 directories, 2 files
eyberg@box:~/pt3$ tree lib
lib
└── x86_64-linux-gnu
    ├── libgcc_s.so.1
    └── librt.so.1

1 directory, 2 files
eyberg@s1:~/box$ ops load python_3.6.7 -c config.json -a model.py
[python3 model.py]
booting /home/eyberg/.ops/images/python3.img ...
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5]
assigned: 10.0.2.15
/.local/lib/python3.6/site-packages/sklearn/svm/base.py:929: ConvergenceWarning: Liblinear failed to converge, increase the number of iterations.
  "the number of iterations.", ConvergenceWarning)
              precision    recall  f1-score   support

           0       1.00      1.00      1.00        19
           1       0.94      1.00      0.97        15
           2       1.00      0.94      0.97        16

    accuracy                           0.98        50
   macro avg       0.98      0.98      0.98        50
weighted avg       0.98      0.98      0.98        50

exit status 1

i just pushed a new release 0.1.19 for this, i'm not a pythonista but those libs that I included that it wanted are prob. wanted by a lot of python apps so it might make sense to re-pkg the python3 pkg w/them - i'll look into it