ck icon indicating copy to clipboard operation
ck copied to clipboard

/cm/bin/python3: No module named pip

Open KingICCrab opened this issue 11 months ago • 4 comments

When I run the command cm run script "app mlperf reference inference _bert-99 _offline _onnxruntime _cuda _fp32" Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.10/importlib/metadata/init.py", line 996, in version return distribution(distribution_name).version File "/usr/lib/python3.10/importlib/metadata/init.py", line 969, in distribution return Distribution.from_name(distribution_name) File "/usr/lib/python3.10/importlib/metadata/init.py", line 548, in from_name raise PackageNotFoundError(name) importlib.metadata.PackageNotFoundError: No package metadata was found for pip python3 -m pip install -r /home/zhaohc/CM/repos/mlcommons@ck/cm-mlops/script/get-sys-utils-cm/requirements.txt /home/zhaohc/cm/bin/python3: No module named pip

CM error: Portable CM script failed (name = get-sys-utils-cm, return code = 256)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Note that it may be a portability issue of a third-party tool or a native script wrapped and unified by this automation recipe (CM script). In such case, please report this issue with a full log at "https://github.com/mlcommons/ck". The CM concept is to collaboratively fix such issues inside portable CM scripts to make existing tools and native scripts more portable, interoperable and deterministic. Thank you!

KingICCrab avatar Mar 19 '24 03:03 KingICCrab

image It seems that cm is wrong.

KingICCrab avatar Mar 19 '24 06:03 KingICCrab

You are using python from the virtual environment, right? Sometimes it gets broken and doesn't include pip. Can you please run python3 -m pip --version outside CM? Usually it happens when your native python installation doesn't include pip and then, when you create virtual environment, it still doesn't include pip. If it's the case, it should be possible to add support in CM to detect such cases and install pip from virtual environment (I think it's done by downloading a specific script to bootstrap pip . But I would suggest to check your original python installation and install pip via apt install python3-pip as described at https://github.com/mlcommons/ck/blob/master/docs/installation.md#ubuntu-debian .

gfursin avatar Mar 19 '24 08:03 gfursin

Thank you for your consideration. This problem has been solved by the following steps: run the command to download the script called get-pip.py: curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py run the script to download pip module: python get-pip.py

KingICCrab avatar Mar 19 '24 08:03 KingICCrab

Thank you for your feedback @KingICCrab . I will keep this ticket open because, though this case that pip is not installed is rare, it still happens and maybe we can add these 2 commands to CM scripts to install pip if it's not detected ...

gfursin avatar Mar 19 '24 08:03 gfursin