0

I'm using pyarmor 8.1.2 on my conda environment. It works as expected on this environment. I built a docker image of the obfuscated python scripts and started a custom job on GCP's vertex AI. Here's the docker file:

FROM gcr.io/deeplearning-platform-release/sklearn-cpu.0-23

WORKDIR /

COPY dist /dist

RUN  pip install -r dist/mlservices/requirements.txt

ENTRYPOINT ["python", "-m", "dist.mlservices.main"]

When the custom job starts, I get the error:

Traceback (most recent call last):
File "/opt/conda/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/opt/conda/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/dist/mlservices/main.py", line 2, in <module>
from dist.pyarmor_runtime_000000 import __pyarmor__
File "/dist/pyarmor_runtime_000000/__init__.py", line 2, in <module>
from .pyarmor_runtime import __pyarmor__
ImportError: libpython3.9.so.1.0: cannot open shared object file: No such file or directory

I added libpython==3.9 in the requirements.txt that is used to add packages to the docker image. However, the docker image is not built when this requirement is included. I get the error:

ERROR: Ignored the following versions that require a different python version: 0.5.0 Requires-Python >=3.10; 1.4.0 Requires-Python >=3.8; 1.4.0rc0 Requires-Python >=3.8; 1.4.1 Requires-Python >=3.8; 1.4.2 Requires-Python >=3.8; 1.4.3 Requires-Python >=3.8; 1.4.4 Requires-Python >=3.8; 1.5.0 Requires-Python >=3.8; 1.5.0rc0 Requires-Python >=3.8; 1.5.1 Requires-Python >=3.8; 1.5.2 Requires-Python >=3.8; 1.5.3 Requires-Python >=3.8; 1.7.0 Requires-Python >=3.8; 1.7.0.post0 Requires-Python >=3.8; 1.7.0rc1 Requires-Python >=3.8; 1.7.1 Requires-Python >=3.8; 1.7.2 Requires-Python >=3.8; 1.7.3 Requires-Python >=3.8; 1.7.4 Requires-Python >=3.8; 1.7.5 Requires-Python >=3.8; 2.0.0 Requires-Python >=3.8; 2.0.0rc0 Requires-Python >=3.8; 2.0.0rc1 Requires-Python >=3.8; 2023.3.0 Requires-Python >=3.8; 2023.4.0 Requires-Python >=3.8
ERROR: Could not find a version that satisfies the requirement libpython==3.9 (from versions: 0.1, 0.2)
ERROR: No matching distribution found for libpython==3.9

My local environment has python 3.9.12 (conda environment). The docker image uses Google's gcr.io/deeplearning-platform-release/sklearn-cpu.0-23, which has python 3.7.12.

Please help!

Ni43
  • 1
  • 1
  • Your app has a dependency on Python 3.9. Your post includes no details on your app. What is copied by `COPY dist /dist`? – John Hanley Apr 17 '23 at 02:24
  • The dist folder contains py scripts to automate building forecasting models (using pmdarima). The app works fine (even the docker image) when I don't use pyarmor. I get the libpython3.9 ImportError only when I use pyarmor. I used pipdeptree and I don't see libpython in the dependency tree. – Ni43 Apr 18 '23 at 11:42

0 Answers0