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

vcpkg install error:in triplet x64-windows: Unable to find a valid Visual Studio instance Could not locate a complete Visual Studio instance #22074

Open
Ssspade opened this issue Dec 18, 2021 · 74 comments
Assignees
Labels
category:question This issue is a question

Comments

@Ssspade
Copy link

Ssspade commented Dec 18, 2021

Describe the bug
A clear and concise description of what the bug is.
When using vcpkg install, an error occurred: in triplet x64-windows: Unable to find a valid Visual Studio instance
Could not locate a complete Visual Studio instance

Environment

  • OS: Windows10,x86_64
  • Compiler: Visual Studio Code

To Reproduce
Steps to reproduce the behavior:

  1. .\vcpkg install thrift
  2. See error
    Error: in triplet x86-windows: Unable to find a valid Visual Studio instance
    Could not locate a complete Visual Studio instance
@rrodrigueznt
Copy link

Hi! I'm facing the same issue in a similar environment, trying to install any package. Some comments:

  1. Visual Studio Code is not a compiler. It is an editor that accepts a lot of extensions, enabling among many other features compiling and debugging.
  2. I don't know if Visual Studio Code could be considered "a complete Visual Studio instance" as the error message reads.
  3. Messages available from Visual Studio Code error link to https://vcpkg.io/en/index.html and propose the use of vcpkg to install libraries for lacking headers.
  4. Thus, I guess we are missing some step in the installation process.

Please, should modify the triplet x86-windows.cmake? How? Should we create a new one? I don't even know for that triplet if we are working in a 64bits environment.

Please, should we install and configure CMake?

Sorry, I'm a bit lost. Thanks for your help!

@LilyWangLL LilyWangLL added the category:question This issue is a question label Dec 20, 2021
@duzp
Copy link

duzp commented Jan 7, 2022

Visua lStudio Installer->installed version->modify-> Language package->add English package, can resolve this problem

@JackBoosY
Copy link
Contributor

Is this issue resolved?

@IJkb
Copy link

IJkb commented Jan 13, 2022

I am having a similar problem. "Could not locate a complete Visual Studio instance" although it is installed. I tried to use vcpkg to install catch2. English langauge package is already installed... Any other suggestions how to resolve this? I hope it is fine I write here, I think it is the same issue...

@JackBoosY
Copy link
Contributor

@IJkb See microsoft/vcpkg-tool#314.

@KevinShu-AEUST
Copy link

I have the same problem, I use VS CODE to compile, but now there is a problem with installing the egin3 pakage.

@JackBoosY
Copy link
Contributor

@KevinShu-AEUST Please see the required Visual Studio components in microsoft/vcpkg-tool#314.

@KevinShu-AEUST
Copy link

@KevinShu-AEUST請在microsoft/vcpkg-tool#314中查看需要的Visual Studio組件。

sorry,I don't understand the solution for this post.

@sfhacker
Copy link

You can use this simple tool to find out the VS instances on your box, including your SDKs:

image

@KevinShu-AEUST
Copy link

你可以使用這個簡單的工具來了解你的機器上的 VS 實例,你的 SDK

圖片

I should to download pkg --mgr.exe 嗎?

@sfhacker
Copy link

@KevinShu-AEUST Sorry, I don't quite understand your question!

@KevinShu-AEUST
Copy link

@KevinShu-AEUST Sorry, I don't quite understand your question!
Sorry, I don't know the relevant cmd commands very well, and I'm still researching.

@sfhacker
Copy link

@JackBoosY
Copy link
Contributor

Please use Visual Studio Installer to install the following Visual Studio components:

  1. C++:
  • Windows Universal C Runtime: Microsoft.VisualStudio.Component.Windows10SDK
  • C++ core desktop features: Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core
  • Visual Studio Build tools:
    • Microsoft.VisualStudio.Component.VC.140 (for Visual Studio 2015)
    • Microsoft.VisualStudio.Component.VC.Tools.x86.x64 (for Visual Studio 2017 or later)
  • MSBuild: Microsoft.Component.MSBuild
  • Windows SDK (one of them):
    • 8.1: Microsoft.VisualStudio.Component.Windows81SDK
    • 10.0.18362: Microsoft.VisualStudio.Component.Windows10SDK.18362
    • 10.0.19041: Microsoft.VisualStudio.Component.Windows10SDK.19041
    • 10.0.20348: Microsoft.VisualStudio.Component.Windows10SDK.20348
    • 11.0.22000: Microsoft.VisualStudio.Component.Windows11SDK.22000
  1. ARM/ARM64:
  • Visual Studio Build tools for ARM: Microsoft.VisualStudio.Component.VC.Tools.arm
  • Visual Studio Build tools for ARM: Microsoft.VisualStudio.Component.VC.Tools.arm64
  1. UWP:
  • Visual Studio Build tools for UWP: Microsoft.VisualStudio.ComponentGroup.UWP.VC

@LilyWangLL LilyWangLL assigned JackBoosY and unassigned LilyWangLL Jan 27, 2022
@S0PEX
Copy link
Contributor

S0PEX commented Jan 30, 2022

Is there any solution to purely run vcpkg with the EWDK?
Am not able to install VS on this machine and rely on CLion which works fine with EWDK and EWDK is sufficient to build all my projects so I would like to keep a static install out of this system.

Setting the ENV before running vcpkg doesn't work, but as far as I can tell the EWDK should have everything required to build the packages.

Error: in triplet x64-windows-static: Unable to find a valid Visual Studio instance
Could not locate a complete Visual Studio instance
The following paths were examined for Visual Studio instances:
    E:\Program Files\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary/Build\vcvarsall.bat

@pawelkondratiev2014
Copy link

Установка английского языка помогла

@JackBoosY
Copy link
Contributor

@S0PEX No, currently vcpkg needs Visual Studio core desktop features.

@the-overdriven
Copy link

Error: in triplet x64-windows: Unable to find a valid Visual Studio instance
Could not locate a complete Visual Studio instance
The following paths were examined for Visual Studio instances:
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary/Build\vcvarsall.bat

Visual Studio is installed in C:\Program Files\Microsoft Visual Studio\2022 - I don't understand what is the problem?

@sfhacker
Copy link

image

@JackBoosY
Copy link
Contributor

Error: in triplet x64-windows: Unable to find a valid Visual Studio instance
Could not locate a complete Visual Studio instance
The following paths were examined for Visual Studio instances:
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary/Build\vcvarsall.bat

Visual Studio is installed in C:\Program Files\Microsoft Visual Studio\2022 - I don't understand what is the problem?

Can you please view my comment and have a try?

Thanks.

@nikinov
Copy link

nikinov commented Mar 3, 2022

I found a solution for me installing the C++ visual studio toolchain onto my C drive worked though it doesn't work when I install Visual studio on my E drive.

@JackBoosY
Copy link
Contributor

@nikinov Installing Visual Studio to a non-system disk doesn't affect vcpkg, maybe because of a problem with its environment variable settings.

@HaifaBenHsouna
Copy link

Same prob here :(
1

@JackBoosY
Copy link
Contributor

@HaifaBenHsouna See the required Visual Studio components in #22074 (comment).

@emanueleriboldi
Copy link

Please use Visual Studio Installer to install the following Visual Studio components:

1. C++:


* Windows Universal C Runtime: `Microsoft.VisualStudio.Component.Windows10SDK`

* C++ core desktop features: `Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core`

* Visual Studio Build tools:
  
  * `Microsoft.VisualStudio.Component.VC.140` (for Visual Studio 2015)
  * `Microsoft.VisualStudio.Component.VC.Tools.x86.x64` (for Visual Studio 2017 or later)

* MSBuild: `Microsoft.Component.MSBuild`

* Windows SDK (one of them):
  
  * 8.1: `Microsoft.VisualStudio.Component.Windows81SDK`
  * 10.0.18362: `Microsoft.VisualStudio.Component.Windows10SDK.18362`
  * 10.0.19041: `Microsoft.VisualStudio.Component.Windows10SDK.19041`
  * 10.0.20348: `Microsoft.VisualStudio.Component.Windows10SDK.20348`
  * 11.0.22000: `Microsoft.VisualStudio.Component.Windows11SDK.22000`


2. ARM/ARM64:


* Visual Studio Build tools for ARM: `Microsoft.VisualStudio.Component.VC.Tools.arm`

* Visual Studio Build tools for ARM: `Microsoft.VisualStudio.Component.VC.Tools.arm64`


3. UWP:


* Visual Studio Build tools for UWP: `Microsoft.VisualStudio.ComponentGroup.UWP.VC`

Not worked with me

@JackBoosY
Copy link
Contributor

@AndroTwrpid Can you please provide the Visual Studio components list you installed and the failure output / logs?

Thanks!

@emanueleriboldi
Copy link

emanueleriboldi commented Feb 20, 2023 via email

@sfhacker
Copy link

It is embarrassing!

@mzayarnyuk
Copy link

in my case pc reboot and remove custom paths resolve issue

@mike192025
Copy link

mike192025 commented Jun 16, 2023

got fixed after downloading from within Visual Studio Installer
1st. Visual Studio Installer -> Desktop Development with C++ -> C++ CMake tools for Windows
2nd. Visual Studio Installer -> Universal Windows: Platform build tools

Download at least both otherwise other build errors emerge!

@monty241
Copy link

monty241 commented Jul 11, 2023

Vcpkg 2023-06-22-f19f3d9939100085fe2f7e41502d60b08e2083b6

Same error on build server.

Installed are:

  • Visual Studio Test Agent 2022 (17.6.4)
  • Visual Studio Build Tools 2022 LTSC 17.6 (17.6.4)
  • Visual Studio Build Tools 2022 (17.6.4)
  • Microsoft Visual Studio 14.0 with some DLL (dependency from unknown source)

On the two build tools installation, a listed pre-requisites have been installed and independently verified to be present.

Adding --debug showed that the following call is made:

"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -all -prerelease -legacy -products * -format xml

Output below in details.

The file vcvarsall.bat can be found in the file system on:

  • c:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build
  • c:\Program Files (x86)\Microsoft Visual Studio\2022\Preview\VC\Auxiliary\Build

However, vcpkg install protobuf looks at other paths with VC in it:

error: in triplet x64-windows: Unable to find a valid Visual Studio instance
    at "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools"
The following Visual Studio instances were considered:
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\
The following paths were examined for Visual Studio instances:
    C:\Program Files (x86)\Microsoft Visual Studio\2022\TestAgent\VC\Auxiliary/Build\vcvarsall.bat
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC/vcvarsall.bat

Changed VCPKG_VISUAL_STUDIO_PATH to:

  • C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools
  • C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC
  • C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary
  • C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build
  • C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat

None helped.

Looked at calls made from process monitor of sysinternals. Executables included:

  • vcpkg.exe
  • cmake.exe
  • vswhere.exe
  • vcpkg-2023-06-22.exe

The following paths are checked it seems:

  • C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\cl.exe
  • C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\cl.exe
  • C:\Program Files (x86)\Microsoft Visual Studio\2022\TestAgent\VC\Auxiliary\Build\vcvarsall.bat
  • C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat

Strangely enough the other instances listed from vswhere.exe are excluded, solely the empty instance is studied which happens to include some VC components:

...
  <instance>
    <instanceId>VisualStudio.14.0</instanceId>
    <installationPath>C:\Program Files (x86)\Microsoft Visual Studio 14.0\</installationPath>
    <installationVersion>14.0</installationVersion>
  </instance>
...

This raises the suspicion that the VS lookup code solely investigates in depth the first hit. But that was established without checking the code of vspkg.

Suggestion: It would be helpful when the error (at least with --debug) would include what alternatives were considered and skipped, and for the candidates studied what omission they were disqualified for use.

An empty virtual machine was started and solely the build tools were installed from Visual Studio. Vcpkg could install protobuf without problems.

As next step, the following components were uninstalled on the original device:

  • Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.36.32532
  • Microsoft Visual C++ 2015-2022 Redistributable (x86) - 14.36.32532
  • Microsoft Windows Desktop Runtime 3.1.10
  • Microsoft .NET Runtime 5.0.1 (x86)
  • Microsoft .NET Runtime 5.0.1 (x64)
  • Microsoft .NET Core 5.0.1 - Windows Server Hosting
  • Microsoft Build of OpenSDK with Hotspot 11.0.16.1+1

Using "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -all -prerelease -legacy -products * -format xml it was confirmed that the instance with installationVersion 14 was still returned by vswhere.exe.

An investigation into the registry revealed that this instances seemed needed for instance for "AndroidPlatformTools,Xamarin", and countless others.

We removed the individual component: "MSVC v140 - VS 2015 C++ build tools (v14.00)" from both build installations. The instance with installationVersion was gone.

vcpkg install protobuf resulted in no longer trying that location:

error: in triplet x64-windows: Unable to find a valid Visual Studio instance
    at "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE"
Could not locate a complete Visual Studio instance
The following paths were examined for Visual Studio instances:
    C:\Program Files (x86)\Microsoft Visual Studio\2022\TestAgent\VC\Auxiliary/Build\vcvarsall.bat

But vcpkg still did not study the locations of the build tools.

As a next test, the Visual Studio Test Agent 2022 (2) (17.6.4) was uninstalled. The next run of vcpkg install protobuf had a nice surprise:

error: in triplet x64-windows: Unable to find a valid Visual Studio instance
    at "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE"
The following Visual Studio instances were considered:
    C:\Program Files (x86)\Microsoft Visual Studio\2022\Preview
    C:\Program Files (x86)\Microsoft Visual Studio\2022\Preview
The following paths were examined for Visual Studio instances:
    C:\Program Files (x86)\Microsoft Visual Studio\2022\Preview\VC\Auxiliary/Build\vcvarsall.bat

The test agent was no longer studied as expected, but it now also studied the folder of one of the build tools installations. This makes the suggestion stronger that solely one installation of Visual Studio is studied from some point on.

As a next step the installation in *Preview of Visual Studio Build Tools 2022 LTSC 17.6 (17.6.4) was uninstalled.

After that, the output for the first time mentioned the folder with *BuildTools:

error: in triplet x64-windows: Unable to find a valid Visual Studio instance
    at "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE"
The following Visual Studio instances were considered:
    C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools
    C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools
The following paths were examined for Visual Studio instances:
    C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary/Build\vcvarsall.bat

As the next step, we have removed the system environment variable VCPKG_VISUAL_STUDIO_PATH from the environment, and started a new console. In that console, again vcpkg install protobuf was executed.

This time everyting worked fine!

It seems that the root cause for this specific instance of the error was that vcpkg solely studies the first installation seriously from some point on (for instance after establishing that the folder exists). In case the first studied installation of Visual Studio does not meet the requirements, all other installations of Visual Studio seem to be ignored (as also seen in Processmon.exe), although these might be a great fit.

I think this can be considered a usability bug, but since the issue is already closed I will create a new one and link to this analysis. Report #32506

Details Data Uploaded to Mothership ```json [ { "ver": 1, "name": "Microsoft.ApplicationInsights.Event", "time": "2023-07-11T10:08:23Z", "sampleRate": 100.000000, "seq": "0:0", "iKey": "b4e88960-4393-4dd9-ab8e-97e8fe6d7603", "flags": 0, "tags": { "ai.device.os": "Other", "ai.device.osVersion": "Windows-10.0.17763", "ai.session.id": "c9bb58f4-a530-4ae8-8c15-e8a9e45e230a", "ai.user.id": "a3856a31-f216-476e-9017-61098dec01fa", "ai.user.accountAcquisitionDate": "2023-06-23T12:06:23Z" }, "data": { "baseType": "EventData", "baseData": { "ver": 2, "name": "commandline_test7", "properties": { "user_mac": "73089f066086eae8cb41503f5a2b16ca5516b9a7c2fc4a2371c510b55a28ad8a", "command_name": "x-upload-metrics", "deployment_kind": "Git", "vcpkg_version": "2023-06-22-f19f3d9939100085fe2f7e41502d60b08e2083b6", "detected_container": false, "feature-flag-binarycaching": true, "feature-flag-compilertracking": true, "feature-flag-dependency-graph": false, "feature-flag-registries": true, "feature-flag-versions": true, "process_tree": "94c46998623631400868cd8cabc1da6a310cb1a550997cfd2d7fada90ff287bb" }, "measurements": { "elapsed_us": 261609.500000 } } } } ] ```
Details VSWhere ```xml 28639c72 2022-04-01T15:02:22Z VisualStudio/17.6.4+33815.320 C:\Program Files (x86)\Microsoft Visual Studio\2022\TestAgent 17.6.33815.320 Microsoft.VisualStudio.Product.TestAgent C:\Program Files (x86)\Microsoft Visual Studio\2022\TestAgent\Common7\IDE\TestAgentConfigUI.exe 4294967295 1 1 0 0 Visual Studio Test Agent 2022 Supports running automated tests and load tests remotely VisualStudio.17.Release https://aka.ms/vs/17/release/channel C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service VisualStudio.17.Release https://aka.ms/vs/17/release/channel https://docs.microsoft.com/en-us/visualstudio/releases/2022/release-notes-v17.6#17.6.4 https://go.microsoft.com/fwlink/?LinkId=661288 2023-06-23T12:10:54.0751878Z d17.6 17.6.33815.320 VisualStudio/17.6.4+33815.320 build-lab VisualStudio installer 17.6.4 Dev17 2022 RTW False Visual Studio 4 1.0 17.6.4+33815.320 3.6.2115.31769 05009690261 VisualStudio.17.Release/17.6.4+33815.320 2 C:\Program Files (x86)\Microsoft Visual Studio\Installer\setup.exe 5d9abce5 2022-10-12T14:02:14Z VisualStudio/17.6.4+33815.320 C:\Program Files (x86)\Microsoft Visual Studio\2022\Preview 17.6.33815.320 Microsoft.VisualStudio.Product.BuildTools C:\Program Files (x86)\Microsoft Visual Studio\2022\Preview\Common7\Tools\LaunchDevCmd.bat 4294967295 1 1 0 0 Visual Studio Build Tools 2022 The Visual Studio Build Tools allows you to build native and managed MSBuild-based applications without requiring the Visual Studio IDE. There are options to install the Visual C++ compilers and libraries, MFC, ATL, and C++/CLI support. VisualStudio.17.Release.LTSC.17.6 https://aka.ms/vs/17/release.LTSC.17.6/channel C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service VisualStudio.17.Release.LTSC.17.6 https://aka.ms/vs/17/release.LTSC.17.6/channel https://docs.microsoft.com/en-us/visualstudio/releases/2022/release-notes-v17.6#17.6.4 https://go.microsoft.com/fwlink/?LinkId=661288 2023-06-23T12:11:18.7938324Z d17.6 17.6.33815.320 VisualStudio/17.6.4+33815.320 build-lab VisualStudio installer 17.6.4 Dev17 2022 RTW False Visual Studio 4 1.0 17.6.4+33815.320 3.6.2115.31769 36835 VisualStudio.17.Release.LTSC.17.6/17.6.4+33815.320 C:\Program Files (x86)\Microsoft Visual Studio\Installer\setup.exe a0993df1 2022-03-13T14:11:23Z VisualStudio/17.6.4+33815.320 C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools 17.6.33815.320 Microsoft.VisualStudio.Product.BuildTools C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\LaunchDevCmd.bat 4294967295 1 1 0 0 Visual Studio Build Tools 2022 The Visual Studio Build Tools allows you to build native and managed MSBuild-based applications without requiring the Visual Studio IDE. There are options to install the Visual C++ compilers and libraries, MFC, ATL, and C++/CLI support. VisualStudio.17.Release https://aka.ms/vs/17/release/channel C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service VisualStudio.17.Release https://aka.ms/vs/17/release/channel https://docs.microsoft.com/en-us/visualstudio/releases/2022/release-notes-v17.6#17.6.4 https://go.microsoft.com/fwlink/?LinkId=661288 2023-06-23T12:13:14.2678107Z d17.6 17.6.33815.320 VisualStudio/17.6.4+33815.320 build-lab VisualStudio installer 17.6.4 Dev17 2022 RTW False Visual Studio 4 1.0 17.6.4+33815.320 3.6.2115.31769 VisualStudio.17.Release/17.6.4+33815.320 C:\Program Files (x86)\Microsoft Visual Studio\Installer\setup.exe VisualStudio.14.0 C:\Program Files (x86)\Microsoft Visual Studio 14.0\ 14.0 ```

@JackBoosY
Copy link
Contributor

@Cheney-W Personally I think this issue should be left open until we get it right.

@Cheney-W Cheney-W reopened this Jul 12, 2023
@mc-nv
Copy link

mc-nv commented Aug 3, 2023

I'm facing pretty much similar issue and it's blocking me to build OnnxRuntime inside docker container and getting following error.
I'm using Dockerfile with following configuration:

  • IMAGE_VERSION=mcr.microsoft.com/windows:10.0.19042.1889
  • VCPGK_VERSION=2023.07.21
  • BUILDTOOLS_VERSION=17.0.23
ARG BASE_IMAGE=mcr.microsoft.com/windows:10.0.19042.1889

FROM ${BASE_IMAGE}

SHELL ["cmd", "/S", "/C"]

RUN mkdir c:\tmp
WORKDIR /tmp

RUN powershell.exe Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
RUN powershell.exe [Net.ServicePointManager]::Expect100Continue=$true;[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls,[Net.SecurityProtocolType]::Tls11,[Net.SecurityProtocolType]::Tls12,[Net.SecurityProtocolType]::Ssl3;Invoke-Expression( New-Object System.Net.WebClient ).DownloadString('https://chocolatey.org/install.ps1')
RUN choco install git docker unzip -y

# Be aware that pip can interact badly with VS cmd shell so need to pip install before
# vsdevcmd.bat (see https://bugs.python.org/issue38989)
ARG PYTHON_VERSION=3.8.10
ARG PYTHON_SOURCE=https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}-amd64.exe
ADD ${PYTHON_SOURCE} python-${PYTHON_VERSION}-amd64.exe
RUN python-%PYTHON_VERSION%-amd64.exe /quiet InstallAllUsers=1 PrependPath=1 Include_doc=0 TargetDir="C:\python%PYTHON_VERSION%"
RUN mklink "C:\python%PYTHON_VERSION%\python3.exe" "C:\python%PYTHON_VERSION%\python.exe"
RUN pip install --upgrade wheel setuptools docker
RUN pip install grpcio-tools

LABEL PYTHON_VERSION=${PYTHON_VERSION}

# Currently this is 17.0.23. This page contains download links for buildtools.
# https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-history#release-dates-and-build-numbers
ARG BUILDTOOLS_VERSION=17.0.23
ARG BUILDTOOLS_SOURCE=https://download.visualstudio.microsoft.com/download/pr/60029857-49a0-4e99-94d0-5a0a9b1f98e6/cc95bfc8b8ca80dc5b256989f55cb5a6fdf76d97975af2d121dda770a0a17697/vs_BuildTools.exe
ARG VS_INSTALL_PATH_WP="C:\BuildTools"
RUN powershell.exe Start-Process -FilePath vs_buildtools.exe -ArgumentList "--wait","--quiet","--norestart","--nocache","--installPath","%VS_INSTALL_PATH_WP%","--channelUri","C:\tmp\doesnotexist.chman","--addProductLang","En-us","--add","Microsoft.VisualStudio.Workload.VCTools`;includeRecommended","--add","Microsoft.Component.MSBuild" -Wait -PassThru

LABEL BUILDTOOLS_VERSION=${BUILDTOOLS_VERSION}

WORKDIR /

#
# Installing Vcpkg
#
ARG VCPGK_VERSION=2023.07.21
RUN git clone --single-branch --depth=1 -b %VCPGK_VERSION% https://github.com/microsoft/vcpkg.git
WORKDIR /vcpkg
RUN bootstrap-vcpkg.bat
RUN vcpkg.exe update
RUN vcpkg.exe install openssl:x64-windows openssl-windows:x64-windows rapidjson:x64-windows re2:x64-windows boost-interprocess:x64-windows boost-stacktrace:x64-windows zlib:x64-windows pthread:x64-windows b64:x64-windows
RUN vcpkg.exe integrate install

error statement:

Step 39/75 : RUN vcpkg.exe install openssl:x64-windows openssl-windows:x64-windows rapidjson:x64-windows re2:
x64-windows boost-interprocess:x64-windows boost-stacktrace:x64-windows zlib:x64-windows pthread:x64-windows 
b64:x64-windows
 ---> Running in 04abfc304b48
Computing installation plan...
The following packages will be built and installed:
    b64:x64-windows -> 2.0.0.1#2
  * boost-array:x64-windows -> 1.82.0#2
  * boost-assert:x64-windows -> 1.82.0#2
  * boost-build:x64-windows -> 1.82.0#2
  * boost-config:x64-windows -> 1.82.0#2
  * boost-container:x64-windows -> 1.82.0#2
  * boost-container-hash:x64-windows -> 1.82.0#2
  * boost-core:x64-windows -> 1.82.0#2
  * boost-describe:x64-windows -> 1.82.0#2
    boost-interprocess:x64-windows -> 1.82.0#2
  * boost-intrusive:x64-windows -> 1.82.0#2
  * boost-modular-build-helper:x64-windows -> 1.82.0#4
  * boost-move:x64-windows -> 1.82.0#2
  * boost-mp11:x64-windows -> 1.82.0#2
  * boost-predef:x64-windows -> 1.82.0#2
  * boost-preprocessor:x64-windows -> 1.82.0#2
    boost-stacktrace:x64-windows -> 1.82.0#2
  * boost-static-assert:x64-windows -> 1.82.0#2
  * boost-throw-exception:x64-windows -> 1.82.0#2
  * boost-tuple:x64-windows -> 1.82.0#2
  * boost-type-traits:x64-windows -> 1.82.0#2
  * boost-uninstall:x64-windows -> 1.82.0#2
  * boost-unordered:x64-windows -> 1.82.0#2
  * boost-vcpkg-helpers:x64-windows -> 1.82.0#2
  * boost-winapi:x64-windows -> 1.82.0#2
    openssl:x64-windows -> 3.1.1#1
    openssl-windows:x64-windows -> deprecated
    pthread:x64-windows -> 3.0.0#2
  * pthreads:x64-windows -> 3.0.0#14
    rapidjson:x64-windows -> 2023-04-27
    re2:x64-windows -> 2023-02-01
  * vcpkg-cmake:x64-windows -> 2023-05-04
  * vcpkg-cmake-config:x64-windows -> 2022-02-06#1
  * vcpkg-cmake-get-vars:x64-windows -> 2023-03-02
    zlib:x64-windows -> 1.2.13
Additional packages (*) will be modified to complete this operation.
error: in triplet x64-windows: Unable to find a valid Visual Studio instance
Could not locate a complete Visual Studio instance

The command 'cmd /S /C vcpkg.exe install openssl:x64-windows openssl-windows:x64-windows rapidjson:x64-window
s re2:x64-windows boost-interprocess:x64-windows boost-stacktrace:x64-windows zlib:x64-windows pthread:x64-wi
ndows b64:x64-windows' returned a non-zero code: 1

@mc-nv
Copy link

mc-nv commented Aug 7, 2023

In my scenario issue with vcpkg was resolved buy using proper components to install with Visual Studio Build Tools:

.\vs_buildtools.exe --quiet --wait --norestart --nocache install `
        --installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" `
        --channelUri C:\TEMP\VisualStudio.chman `
        --installChannelUri C:\TEMP\VisualStudio.chman `
        --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
        --add Microsoft.Component.MSBuild

@programador51
Copy link

After reading a while, seems that vcpkg needs Visual Studio in order to work.
image

Once I installed that, I was able to install the librarie that i needed for the C++ code i were doing

image

@github-actions github-actions bot added the Stale label Sep 17, 2023
@microsoft microsoft deleted a comment from github-actions bot Sep 18, 2023
@Cheney-W Cheney-W removed the Stale label Sep 18, 2023
@mesidex
Copy link

mesidex commented Sep 19, 2023

You can download the required dependencies via winget

(note that this is for vs2022 with the Windows 11 SDK, refer to: vs2022 or vs2019)

For example:

winget install Microsoft.VisualStudio.2022.BuildTools --force --override "--wait --passive --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows11SDK.22621 --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core --add Microsoft.Component.MSBuild --add Microsoft.VisualStudio.Component.Windows10SDK --add Microsoft.VisualStudio.Component.VC.Tools.arm --add Microsoft.VisualStudio.Component.VC.Tools.arm64 --add Microsoft.VisualStudio.ComponentGroup.UWP.VC"

@Lazrius
Copy link

Lazrius commented Sep 22, 2023

I was having the problem but it wasn't caused by missing tooling but rather my anti-virus (Malwarebytes in this case) had decided that some of the internal visual studio tools were suspicious and silently purged them. It deleted the following:
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\VsDevCmd.bat
C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe

I assume it was the latter one that caused this tool to break. It stands to reason that any program that prevents its usage will cause this error to appear. It might be apt to check for the execution of this executable is successful and if its not return a more clear error.

@jy0001087
Copy link

I noticed that I had installed two VS after a whole day long debug.
Just uninstall one of them.

@deepwilson
Copy link

Can someone suggest a solution that uses existing MinGW compilers? How do Iink my compiler to vcpkg?

@dg0yt
Copy link
Contributor

dg0yt commented Oct 3, 2023

Can someone suggest a solution that uses existing MinGW compilers? How do Iink my compiler to vcpkg?

@deepwilson Not in this issue.

@deepwilson
Copy link

@dg0yt I am currently getting the same error as posted in the title "
vcpkg install error:in triplet x64-windows: Unable to find a valid Visual Studio instance Could not locate a complete Visual Studio instance" hence, asking in this issue. Hopefully, it will help others who get the same error and don't want to use Visual Studio.

@dg0yt
Copy link
Contributor

dg0yt commented Oct 4, 2023

@deepwilson There are answers for mingw. But not in this issue.

@yufeiran
Copy link

yufeiran commented Oct 5, 2023

I have the same problem. The reason is that visual studio is not installed in the default path, which will also cause vcpkg to not be able to find visual studio. I reinstalled visual studio to the default path of the C drive and the problem was solved.

@VikMorroHun
Copy link

Thanks @Lazrius. Malwarebytes silently killed CMake on my machine too. Other parts of Visual Studio worked - I just couldn't build a simple "Hello world!" plugin (which was the reason why I installed Visual Studio in the first place).

Copy link

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 28 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.

@github-actions github-actions bot added the Stale label Nov 12, 2023
@JackBoosY
Copy link
Contributor

keep alive.

@Cheney-W Cheney-W removed the Stale label Nov 27, 2023
@dipaksinha1
Copy link

Hi,
Do I need to uninstall completely and then install vscode to launch vscode installer?

@jeremyosterhoudt
Copy link

For me I had cloned the repo and installed vcpkg that way. I was unable to get it to work trying various methods here. I eventually used the VS 2022 Installer to install vcpkg and that finally installed all of the required dependancies. Then I simply modified my path to point to the cloned vcpkg path and everything works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:question This issue is a question
Projects
None yet
Development

No branches or pull requests