Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/cm/bin/python3: No module named pip #1179

Open
KingICCrab opened this issue Mar 19, 2024 · 4 comments
Open

/cm/bin/python3: No module named pip #1179

KingICCrab opened this issue Mar 19, 2024 · 4 comments

Comments

@KingICCrab
Copy link

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
Copy link
Author

image
It seems that cm is wrong.

@KingICCrab KingICCrab changed the title CM error: Portable CM script failed (name = get-sys-utils-cm, return code = 256) /cm/bin/python3: No module named pip Mar 19, 2024
@gfursin
Copy link
Contributor

gfursin commented Mar 19, 2024

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 .

@KingICCrab
Copy link
Author

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

@gfursin
Copy link
Contributor

gfursin commented Mar 19, 2024

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 ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants