yourkrash@DESKTOP-CQBNM5G:~/ark/arkcompiler_runtim...

Created on: March 3, 2025

Answered using O1 by Chat01

Question

yourkrash@DESKTOP-CQBNM5G:~/ark/arkcompiler_runtime_core/static_core$ sudo repo sync -c -j8 ... A new version of repo (2.50) is available. ... You should upgrade soon: cp /home/yourkrash/ark/arkcompiler_runtime_core/static_core/.repo/repo/repo /usr/bin/repo Fetching: 100% (22/22), done in 5.858s error.GitError: Cannot checkout third_party_icu: /home/yourkrash/ark/arkcompiler_runtime_core/static_core/third_party/icu/.git: unsupported checkout state error.GitError: Cannot checkout third_party_googletest: /home/yourkrash/ark/arkcompiler_runtime_core/static_core/third_party/googletest/.git: unsupported checkout state error: Cannot checkout third_party_icu error: Cannot checkout third_party_googletest error.GitError: Cannot checkout third_party_openssl: /home/yourkrash/ark/arkcompiler_runtime_core/static_core/third_party/openssl/.git: unsupported checkout state error: Cannot checkout third_party_openssl error.GitError: Cannot checkout third_party_zlib: /home/yourkrash/ark/arkcompiler_runtime_core/static_core/third_party/zlib/.git: unsupported checkout state error: Cannot checkout third_party_zlib git-lfs filter-process --skip: 1: git-lfs: not found fatal: the remote end hung up unexpectedly error.GitError: Cannot checkout third_party_node: Cannot initialize work tree for third_party_node error: Cannot checkout third_party_node Checking out: 100% (22/22), done in 0.099s error: Unable to fully sync the tree error: Checking out local projects failed. Failing repos: third_party/icu third_party/googletest third_party/openssl third_party/zlib third_party/node Try re-running with "-j1 --fail-fast" to exit at the first error. ================================================================================ Repo command failed due to the following SyncError errors: /home/yourkrash/ark/arkcompiler_runtime_core/static_core/third_party/icu/.git: unsupported checkout state /home/yourkrash/ark/arkcompiler_runtime_core/static_core/third_party/googletest/.git: unsupported checkout state /home/yourkrash/ark/arkcompiler_runtime_core/static_core/third_party/openssl/.git: unsupported checkout state /home/yourkrash/ark/arkcompiler_runtime_core/static_core/third_party/zlib/.git: unsupported checkout state

Thought

Addressing Git LFS issues

The error highlights a lack of Git Large File Storage (LFS) support during the repo sync process. Installing Git LFS is necessary to resolve this issue, as it manages large files effectively.

Reasoned about repo sync errors for 4 seconds

Answer

From the errors you’re seeing—particularly the line git-lfs filter-process --skip: 1: git-lfs: not found—the most likely cause is that some of these repositories require Git LFS (Large File Storage) but it isn’t installed on your system.

Here’s how you can fix it:

  1. Install Git LFS

    • On Ubuntu/Debian-based systems:
      bash
      sudo apt-get update sudo apt-get install git-lfs
    • On other distributions, use the corresponding package manager (for example, dnf install git-lfs on Fedora).
    • If your distribution does not have Git LFS in its repositories, you can install it from GitHub releases.
  2. Initialize Git LFS

    bash
    git lfs install

    This sets up Git LFS support globally on your system.

  3. (Optional) Remove and Re-checkout the Problematic Modules
    Sometimes, if a partial checkout has already happened without Git LFS, you might need to remove the directories that failed. For example:

    bash
    rm -rf third_party/icu rm -rf third_party/googletest rm -rf third_party/openssl rm -rf third_party/zlib rm -rf third_party/node

    Then rerun repo sync. This ensures you start from a clean state.

  4. Avoid Using sudo with repo
    Typically, repo commands should be run as a normal user, not via sudo. Using sudo can create permission and ownership issues within your local working directories.

  5. Re-run the Repo Sync

    bash
    repo sync -c -j8

    Or, if you want to see errors more easily:

    bash
    repo sync -c -j1 --fail-fast

    With Git LFS installed and initialized, the checkouts that depend on LFS objects should now succeed.

After following these steps, the repositories that previously showed “unsupported checkout state” should now properly sync, since Git LFS will handle any large binary files they contain.

Question

yourkrash@DESKTOP-CQBNM5G:~/ark/arkcompiler_runtime_core/static_core$ repo sync -c -j1 --fail-fast ... A new version of repo (2.50) is available. ... New version is available at: /home/yourkrash/ark/arkcompiler_runtime_core/static_core/.repo/repo/repo ... The launcher is run from: /usr/bin/repo !!! The launcher is not writable. Please talk to your sysadmin or distro !!! to get an update installed. Fetching: 100% (22/22), done in 35.169s error.GitError: Cannot checkout third_party_googletest: /home/yourkrash/ark/arkcompiler_runtime_core/static_core/third_party/googletest/.git: unsupported checkout state error: Cannot checkout third_party_googletest Checking out: 50% (11/22), done in 0.012s error: Unable to fully sync the tree error: Checking out local projects failed. Failing repos: third_party/googletest Try re-running with "-j1 --fail-fast" to exit at the first error. ================================================================================ Repo command failed due to the following SyncError errors: /home/yourkrash/ark/arkcompiler_runtime_core/static_core/third_party/googletest/.git: unsupported checkout state

Thought

Troubleshooting git submodule

The user is figuring out issues with the Google test submodule in their repository, focusing on unsupported checkout states, incomplete Git LFS installations, and potential submodule misconfigurations.

Tackling various angles

The user is exploring parameters for "repo init," addressing Git pack references, partial clones, environment variables, and Windows' core.longpaths true setting, and considering starting from scratch with "rm -rf .repo."

Refining cleanup steps

I’m removing references to googletest from LFS, ensuring "repo sync" clears conflicts, and checking Git LFS settings to stabilize the environment.

Adjusting Windows settings

I'm setting core.autocrlf and core.fileMode to ensure smooth WSL operations, checking Git LFS installation in WSL, and resolving path issues for optimal execution.

Reasoned about repo sync error for 13 seconds

Answer

It looks like the third_party/googletest repo still needs Git LFS or is otherwise stuck in a bad checkout state. Here are a few things to check and try:


1. Confirm Git LFS is Actually Installed in WSL

Since your prompt shows DESKTOP-CQBNM5G:~/ark/..., it looks like you’re on Windows Subsystem for Linux (WSL). Make sure that inside WSL you have Git LFS installed. Installing Git LFS on Windows (outside WSL) is not enough.

Check if Git LFS is available in WSL:

bash
which git-lfs git-lfs --version
  • If you get “no git-lfs in …” or “command not found,” then you need to install it in WSL.
  • On Ubuntu-based WSL:
    bash
    sudo apt-get update sudo apt-get install git-lfs
  • Then run:
    bash
    git lfs install
    You only need to do git lfs install once per user account. It sets up Git’s config to use LFS filters.

2. Remove the Problematic Directory and Resync

If you ran repo sync before installing Git LFS, that directory may have ended up in a weird half-initialized state. Usually the quickest fix is to remove the affected folder so it can be re-checked out cleanly:

bash
rm -rf third_party/googletest

Then run a single-project sync to focus on that one repo:

bash
repo sync -c -j1 --fail-fast third_party/googletest

If that completes successfully, you can then do:

bash
repo sync -c -j8

…to bring everything else up to date.


3. Avoid sudo repo sync

repo shouldn’t generally be run via sudo. Running as root can cause file-permission issues. Always run repo sync as your normal (non-root) user—especially in WSL.


4. Check for Other LFS Repos

If other third-party directories fail with the same error, repeat the same process:

bash
rm -rf third_party/<failing_repo> repo sync -c -j1 --fail-fast third_party/<failing_repo>

5. Verify LFS Filters in Your Global Git Config

You can also confirm your global Git config references LFS properly:

bash
git config --list | grep filter.lfs

You should see something like:

text
filter.lfs.clean=git-lfs clean -- ... filter.lfs.smudge=git-lfs smudge -- ... filter.lfs.process=git-lfs filter-process filter.lfs.required=true

If nothing appears, run git lfs install again (without sudo), then check again.


Summary

  1. Install Git LFS in WSL: sudo apt-get install git-lfs && git lfs install
  2. Remove the problematic folder (third_party/googletest) to clear the partial checkout.
  3. Re-sync just that folder, then do a full sync afterward.
  4. Confirm you are not running repo sync with sudo.

Once Git LFS is configured correctly, you should be able to sync all sub-repos (including googletest) without the “unsupported checkout state” errors.

Question

yourkrash@DESKTOP-CQBNM5G:/ark/arkcompiler_runtime_core/static_core$ ./prebuilts_download.sh Defaulting to user installation because normal site-packages is not writeable Looking in indexes: http://repo.huaweicloud.com/repository/pypi/simple Requirement already satisfied: rich in /home/yourkrash/.local/lib/python3.12/site-packages (13.9.4) Requirement already satisfied: markdown-it-py>=2.2.0 in /home/yourkrash/.local/lib/python3.12/site-packages (from rich) (3.0.0) Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /home/yourkrash/.local/lib/python3.12/site-packages (from rich) (2.18.0) Requirement already satisfied: mdurl=0.1 in /home/yourkrash/.local/lib/python3.12/site-packages (from markdown-it-py>=2.2.0->rich) (0.1.2) prebuilts_download start Traceback (most recent call last): File "/home/yourkrash/ark/arkcompiler_runtime_core/static_core/arkcompiler/toolchain/build/prebuilts_download/prebuilts_download.py", line 29, in <module> from rich.progress import ( ModuleNotFoundError: No module named 'rich'

Thought

Solving environment confusion

I'm noting that "rich" might be installed in the wrong Python environment, leading to an import error. Trying different installation commands could clarify this discrepancy.

Tweaking the setup

I’m considering that the script might use the wrong Python or lack "rich" in its environment. Re-evaluating Python settings and reinstalling "rich" could resolve this.

Reasoned about missing Python module error for 9 seconds

Answer

You’re getting the error ModuleNotFoundError: No module named 'rich' because the Python interpreter that’s actually running prebuilts_download.py doesn’t have the rich library installed, even though you installed it locally for another interpreter or Python version. Essentially, the script is using a different Python environment/path than the one you installed rich into.

Below are a few ways to fix it:


1. Make Sure You’re Installing into the Right Python Environment

  1. Check which Python is running the script. In prebuilts_download.sh, there may be a python or python3 call. Or it might have a shebang (e.g., #!/usr/bin/env python3).

  2. Make sure you install rich for that exact Python:

    bash
    python3 -m pip install --user --upgrade rich

    or

    bash
    pip3 install --user --upgrade rich
  3. Confirm it’s installed correctly by running:

    bash
    python3 -c "import rich; print(rich.__version__)"

If that works without error, then re-run ./prebuilts_download.sh. If the script still complains it can’t find rich, it’s likely calling a different Python (for example, /usr/bin/python vs. /usr/bin/python3, or an older Python version).


2. Edit the Script to Use the Correct Python

If you open arkcompiler/toolchain/build/prebuilts_download/prebuilts_download.py (or whichever script is failing) and see a shebang at the top, e.g.:

python
#!/usr/bin/python

…and your installed rich is only available in Python 3.12 (for example /usr/bin/python3.12), then you need to either:

  • Change the script’s shebang to #!/usr/bin/env python3
  • or ensure that /usr/bin/python is actually Python 3 and has rich installed.

3. System-Wide Install (If Allowed)

If you have permission (and want a quick system-wide fix), you can install rich for the system Python:

bash
sudo apt-get update sudo apt-get install python3-pip # if not installed sudo pip3 install --upgrade rich

Then all Python 3 interpreters at the system level can find rich. (Still, if the script is calling Python 2 for any reason, that won’t help.)


4. Double-Check WSL vs. Windows Python

If you’re on Windows Subsystem for Linux (WSL), note that installing rich in Windows Python doesn’t install it in WSL’s Python. They’re completely separate environments. Make sure to do all installations within the WSL environment.


Summary

  • Identify which Python interpreter is actually being used by ./prebuilts_download.sh.
  • Install the rich module into that interpreter’s environment.
  • Retry the script once you confirm that import rich works in that same Python environment.

Once the correct environment is aligned, prebuilts_download.sh should work without the "No module named ‘rich’" error.

Question

yourkrash@DESKTOP-CQBNM5G:~/ark/arkcompiler_runtime_core/static_core$ python3 -c "import rich; print(rich.version)" Traceback (most recent call last): File "<string>", line 1, in <module> AttributeError: module 'rich' has no attribute 'version'

Thought

Identifying the cause
The error indicates no __version__ attribute in the 'rich' module, suggesting potential conflicts with a local module named "rich" or an outdated version.

Alternative methods
To pinpoint the 'rich' library version and location, I suggest using pip3 show rich, pip3 freeze | grep rich, or importlib.metadata.version('rich') for those with Python 3.8+.

Tracking steps

I suggest tracing the issue by checking installed packages, Python environment paths, and considering alternative methods like importlib.metadata.version('rich') to identify the cause of the __version__ attribute absence.

Evaluating installation methods
I’m examining installation from source, naming conflicts, and the presence of a local file named "rich.py". Checking the installed version via pip3 freeze and pip3 show rich might provide further insights.

Investigating unusual points

Mapping out unexpected paths and local files overshadowing the 'rich' module. Checking python3 -c "import rich; print(rich.__file__)" will reveal the module's origin.

Reasoned for 15 seconds

Answer

The error “AttributeError: module 'rich' has no attribute '__version__'” indicates that Python did find a module named rich, but it’s missing the expected __version__ symbol. Usually, the official Rich library does define __version__. If you installed Rich from PyPI (for example pip3 install rich), you should see __version__ in rich.__init__.py.

This discrepancy often comes from:

  1. A naming conflict – for example, a local file or folder named rich.py that shadows the real library.
  2. Multiple Python environments – you installed rich in one environment, but are running a different Python that has some other “rich” module, or a partial/broken Rich install.
  3. A very old or nonstandard version of “rich” or a different package also named “rich.”

Here’s how to pinpoint the cause:


1. Check Which rich Python Is Actually Importing

Run:

bash
python3 -c "import rich; print(rich.__file__)"
  • If it prints something like /home/<user>/.local/lib/python3.12/site-packages/rich/__init__.py, that’s usually the correct Rich library.
  • If it prints something like /home/<user>/ark/arkcompiler_runtime_core/static_core/rich.py (or anywhere outside standard site-packages), you have a local file overshadowing the official library. In that case, rename or remove that local file so Python sees the real Rich library.

2. Confirm the Installed Version with pip3

Use pip3 (not just pip) to ensure you’re installing for Python 3.x. Also check that you see the correct version:

bash
pip3 show rich

You should see something like:

text
Name: rich Version: 13.9.4 Location: /home/<user>/.local/lib/python3.12/site-packages

If pip3 show rich can’t find anything, then rich was never installed in that environment. If you see a different path or a suspicious version, that may explain the missing __version__.


3. Try importlib.metadata Instead of rich.__version__

Even if rich.__version__ is missing for some reason, you can also do:

bash
python3 -c "import importlib.metadata as m; print(m.version('rich'))"
  • If Rich is properly installed from PyPI, this should display the installed version number.
  • If you get a PackageNotFoundError, it means your Python environment doesn’t see a PyPI-installed Rich.

4. Fix the Environment or Local Naming Conflict

If you find a local file overshadowing the Rich library, rename or remove it.
For example:

bash
mv rich.py rich_local.py

If you discover multiple Python versions and you only installed Rich in one of them, either:

  • Install Rich again with the Python that’s actually running your script:
    bash
    python3 -m pip install --user --upgrade rich
  • Or explicitly call that Python interpreter in your script (for instance, change #!/usr/bin/env python to #!/usr/bin/env python3).

5. Re-run Your Script

Once Python is truly importing the correct Rich library, you can safely check that import rich works without error, and any tool (such as prebuilts_download.sh) that depends on Rich should run correctly.


Summary

  1. Check which rich module Python is seeing (python3 -c "import rich; print(rich.__file__)").
  2. Install Rich in the correct environment (pip3 install --user rich).
  3. Remove or rename any local rich.py that might shadow the library.
  4. Verify with pip3 show rich or importlib.metadata.version("rich").
  5. Re-run your script so it picks up the genuine Rich library, which does have __version__.

Share this Q&A