Since Python was updated from 3.5.4 to 3.7.3 (#6383) importing external modules does not work in scripts, e.g.:
-- Found PythonInterp: F:/vcpkg/downloads/tools/python/python3/python.exe (found version "3.7.3")
-- Constructing LLVMBuild project information
CMake Error at CMakeLists.txt:683 (message):
Unexpected failure executing llvm-build: Traceback (most recent call last):
File "F:/vcpkg/buildtrees/llvm/src/llvm-7.0.0.src/utils/llvm-build/llvm-build", line 3, in <module>
import llvmbuild
ModuleNotFoundError: No module named 'llvmbuild'
This behavior is unique to the Python embeddable package and it seems to work that way since Python version 3.6.0.
The build works fine when
vcpkg\downloads\tools\python\python3\python37._pthPackages that use Python 3 and might be affected: botan, clblas, ctemplate, folly, gl3w, glad, gtk, hyperscan, hyperscan, llvm, open62541, opencl, physx, pybind11, qscintilla, qt5-base, shaderc, shogun, spirv-tools, xmsh
Related issues: #6979, #6984, #7066
Machine setup: Windows 10 1903 x64, VS2019
most likely there is not enough module to build
example of use
https://github.com/microsoft/vcpkg/blob/master/ports/duktape/portfile.cmake
https://github.com/microsoft/vcpkg/blob/master/ports/open62541/portfile.cmake
vcpkg_find_acquire_program(PYTHON3)
get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
vcpkg_add_to_path("${PYTHON3_DIR}")
if(NOT EXISTS ${PYTHON3_DIR}/easy_install${EXECUTABLE_SUFFIX})
if(NOT EXISTS ${PYTHON3_DIR}/Scripts/pip${EXECUTABLE_SUFFIX})
vcpkg_download_distfile(GET_PIP
URLS "https://bootstrap.pypa.io/get-pip.py"
FILENAME "tools/python/python3/get-pip.py"
SHA512 99520d223819708b8f6e4b839d1fa215e4e8adc7fcd0db6c25a0399cf2fa10034b35673cf450609303646d12497f301ef53b7e7cc65c78e7bce4af0c673555ad
)
execute_process(COMMAND ${PYTHON3_DIR}/python${EXECUTABLE_SUFFIX} ${PYTHON3_DIR}/get-pip.py)
endif()
execute_process(COMMAND ${PYTHON3_DIR}/Scripts/pip${EXECUTABLE_SUFFIX} install six)
else()
execute_process(COMMAND ${PYTHON3_DIR}/easy_install${EXECUTABLE_SUFFIX} six)
endif()
pip install six)
or manual
F:/vcpkg/downloads/tools/python/python3/python.exe -mpip install -U --force six
although the file python37._pth
can also be the cause, it can be simply removed
Primarily, the problem is with modules located in the same folder as the script being run. (Though pip packages are likely affected as well.)
Removing the vcpkgdownloadstoolspythonpython3python37._pth file appeared to be sufficient for me to build llvm with vcpkg.
Most helpful comment
Removing the vcpkgdownloadstoolspythonpython3python37._pth file appeared to be sufficient for me to build llvm with vcpkg.