VK-GL-CTS icon indicating copy to clipboard operation
VK-GL-CTS copied to clipboard

error when trying to build vulkancts on linux

Open davendramaharaj1 opened this issue 2 years ago • 4 comments

Distro: Garuda Linux Kernel: 5.18.3-zen1-1-zen arch: x86_64 bits: 64 compiler: gcc v: 12.1.0 Python Version: Python 3.10.5

When following instructions for Vulkan CTS README, I tried to run python3 external/fetch_sources.py to download the sources, the following error pops up on my command line:

Traceback (most recent call last): File "/home//Documents/projects/vulkan/VK-GL-CTS/external/fetch_sources.py", line 35, in from build.common import * ModuleNotFoundError: No module named 'build.common'

When I run pip install build, the following is printed to console:

Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: build in /usr/lib/python3.10/site-packages (0.8.0) Requirement already satisfied: packaging>=19.0 in /usr/lib/python3.10/site-packages (from build) (21.3) Requirement already satisfied: pep517>=0.9.1 in /usr/lib/python3.10/site-packages (from build) (0.12.0) Requirement already satisfied: tomli>=1.0.0 in /usr/lib/python3.10/site-packages (from build) (2.0.1) Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /usr/lib/python3.10/site-packages (from packaging>=19.0->build) (3.0.9)

I get the same "ModuleNotFoundError: No module named 'build.common'" message on the command line

If I do pip install build.common, the following is printed:

Defaulting to user installation because normal site-packages is not writeable ERROR: Could not find a version that satisfies the requirement build.common (from versions: none) ERROR: No matching distribution found for build.common

It seems like my interpreter is unable to find any module named common in the package called build for python version 3.10.5. This is imported in external)/fetch_sources.py line 35.

How do I resolve this ? Thanks!

davendramaharaj1 avatar Jul 12 '22 05:07 davendramaharaj1

build.common is located here https://github.com/KhronosGroup/VK-GL-CTS/tree/main/scripts/build/common.py

The import includes the path with this line from fetch_sources:

sys.path.append(os.path.join(os.path.dirname(file), "..", "scripts"))

Not sure why your build isn't finding this file to import, the package manager could be getting confused with the installed module or something. It would be good to check your tree to make sure common.py exists.

mnetsch avatar Jul 12 '22 15:07 mnetsch

Hi, I have checked and confirmed that common.py does reside in /VK-GL-CTS/scripts/build

I understand that sys.path.append(os.path.join(os.path.dirname(file), "..", "scripts")) will let the intepreter look for the build module in /scripts however that doesn't seem to be the case.

When I add print(sys.path) after sys.path.append(os.path.join(os.path.dirname(__file__), "..", "scripts")), I see /home/<USER>/Documents/projects/vulkan/VK-GL-CTS/externalprinted out on the console as the first entry in $PATH

davendramaharaj1 avatar Jul 15 '22 06:07 davendramaharaj1

I have found that sys.path.append(os.path.join(os.path.dirname(__file__), "..", "scripts")) adds the path to the end of the sys.path variable like this:

before

But when I replace it with sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "scripts")), it works and the path is added to the beginning of sys.path shown here:

after

The latter change works for me but the only thing I don't understand is why /home/<USER>/Documents/projects/vulkan/VK-GL-CTS/external added to the beginning of sys.path when only sys.path.append(os.path.join(os.path.dirname(__file__), "..", "scripts")) is executed.

davendramaharaj1 avatar Jul 15 '22 08:07 davendramaharaj1

The latter change works for me but the only thing I don't understand is why /home//Documents/projects/vulkan/VK-GL-CTS/external added to the beginning of sys.path when only sys.path.append(os.path.join(os.path.dirname(file), "..", "scripts")) is executed.

I wouldn't expect this to be the case, have you tried printing sys.path before this command?

mnetsch avatar Jul 18 '22 14:07 mnetsch

It looks like there's a name collision with a pip package named "build" (e.g. Arch). A quick solution is to uninstall it. If that isn't viable, create a venv.

ishitatsuyuki avatar Nov 18 '22 07:11 ishitatsuyuki

A fix for this is under review in Khronos. It renames the CTS "build" package to "ctsbuild" to avoid name conflicts.

rg3igalia avatar Dec 12 '22 08:12 rg3igalia

Fixed in https://github.com/KhronosGroup/VK-GL-CTS/commit/125aa9d5da7efec78f178dbf50c07a90213b93de

mnetsch avatar Jan 09 '23 18:01 mnetsch