When i try to build the opencv package in python using command line
PS C:\Program Files\Open_CV\opencv-python> python setup.py build
It throws an error:
Version: 4.3.0+3073e9e
setup.py:85: DeprecationWarning: SO is deprecated, use EXT_SUFFIX
['python/cv2[^/]*%(ext)s' % {'ext': re.escape(sysconfig.get_config_var('SO'))}],
Trying "Visual Studio 14 Win64" generator
Not searching for unused variables given on the command line.
Selecting Windows SDK version to target Windows 10.0.18363.
CMake Error at CMakeLists.txt:2 (PROJECT):
Failed to run MSBuild command:
MSBuild.exe
to get the value of VCTargetsPath:
The system cannot find the file specified
Configuring incomplete, errors occurred!
See also "C:/Program Files/Open_CV/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
Trying "Visual Studio 14 Win64" generator - failure
scikit-build could not get a working generator for your system. Aborting build.
Building windows wheels for Python 3.8 requires Microsoft Visual Studio 2017.
Get it with "Visual Studio 2017":
https://visualstudio.microsoft.com/vs/
They don't automatically detect VS2019 yet. You have to specify the generator.
python setup.py build -G "Visual Studio 16 2019"
Related
I'm using Visual Studio to open a CMake C++ project. When I set it to x64-Debug mode at the top and compile, it works fine. However, when I change it to x64-Release, it suddenly tells me:
CMake Error at CMakeLists.txt:5 (project):
Generator
Visual Studio 16 2019
could not find any instance of Visual Studio.
I'm literally using Visual Studio, why does CMake not find it anymore when building in release mode? I know that this code base compiled perfectly fine before and I didn't make any changes to it since then. Also, I tried to repair/reinstall Visual Studio but the issue persists. Can I verify some environment variables or whatever CMake checks?
When running CMake from CMD directly to generate a Visual Studio solution (cmake -G "Visual Studio 16 2019"), I get the same error as above. Running from x64 Native Tools Command Prompt for VS 2022" or Developer Command Prompt for VS 2022 does not help either.
Desktop development with C++ and C++ CMake tools for Windows are both installed.
>cmake --version
cmake version 3.24.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
It turns out that deleting all Visual Studio generated files/folders and setting up a new x64-Release configuration solved the problem.
I am trying to build a C++ project using Visual Studio 2017 on top of the ICC 19.0 compiler.
This is the command I try to execute:
cmake -G "Visual Studio 15 2017 Win64" -T "Intel C++ Compiler 19.0" ..
This is the error I always get:
CMake Error at CMakeLists.txt:17 (project):
Failed to run MSBuild command:
C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/MSBuild.exe
to get the value of VCTargetsPath:
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 2019-12-24 15:19:24.
Project "C:\Users\user001\Desktop\myproject\build\CMakeFiles\3.16.2\VCTargetsPath.vcxproj" on node 1 (default targets).
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Redirect.14.props(47,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.cpp.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. [C:\Users\user001\Desktop\myproject\build\CMakeFiles\3.16.2\VCTargetsPath.vcxproj]
Done Building Project "C:\Users\user001\Desktop\myproject\build\CMakeFiles\3.16.2\VCTargetsPath.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\Users\user001\Desktop\myproject\build\CMakeFiles\3.16.2\VCTargetsPath.vcxproj" (default target) (1) ->
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Redirect.14.props(47,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.cpp.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. [C:\Users\user001\Desktop\myproject\build\CMakeFiles\3.16.2\VCTargetsPath.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.08
Exit code: 1
-- Configuring incomplete, errors occurred!
I do have VS2017 build tools installed — and reinstalled several times, for that matter.
What am I doing wrong?
Why is it trying to use VS2015 build tools that I don`t even have?
[UPD:] The result is the same even when I execute this command from x64 Native Tools Command Prompt for VS2017.
Please check whether file "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.cpp.props" is exist.
If the project is ported from VS2015, Please check VisualStudioVersion parameter in your project file (.csproj/.vbproj), such as "C:\Users\user001\Desktop\myproject\build\CMakeFiles\3.16.2\VCTargetsPath.vcxproj".
Visual Studio project compatibility and VisualStudioVersion
Okay, after much chagrin I found out what was happening.
The ICC 19.0 installer misrecognized the version of Visual Studio and installed MSVS 2015 extensions instead of 2017, which led CMake to believe it should use MSVS 2015 build tools which were simply not there.
Problem solved.
All it took to solve this was to choose «Modify» from the ICC installer menu and switch to the right extension set.
I have Visual Studio 2017 Professional installed as well as Visual Studio 2019 Professional.
Because of some project restrictions I cannot control, I have to use the VS 2017 Compiler to compile the code. Before the installation of Visual Studio 2019 the following CMake command was just working fine:
cmake -G "Visual Studio 15 2017 Win64"
But after installation of VS 2019, above line gives the following error:
CMake Error at CMakeLists.txt:9 (project):
Failed to run MSBuild command:
MSBuild.exe
to get the value of VCTargetsPath:
Das System kann die angegebene Datei nicht finden
The last line means something like "The systen cannot find the given file".
Can anyone help me solve the problem? Sadly, as of now, I have to use the compiler from VS2017 for this particular project.
Edit: As suggested by Neil in the comments, using the Developer Command Prompt works just fine. Is there any way to use the Windows command prompt? It's just easier to use.
Edit2: I now use the solution suggested by Neil and run the commands needed in Visual Studio Command Prompt, as I could not figure out how to do it correctly in Windows command prompt.
CMake always tries to find the most recent version of Visual Studio. Therefore older releases of CMake before 3.14 may fail if VS2019 is installed and not properly detected.
Please note that you need to delete CMakeCache.txt and CMakeFiles folder from your build directory if rerunning.
If you intend to use VS2019 with CMake you need to use the architecture option (-A) of CMake as there is no "Visual Studio 16 2019 Win64" generator, e.g. cmake -G "Visual Studio 16 2019" -A x64 for a 64-bit build or cmake -G "Visual Studio 16 2019" -A Win32 for a 32-bit build. The architecture option was introduced in CMake 3.0.2, so you can use that instead of the specific generator name for older Visual Studio installations too.
I want to generate Visual Studio files by this instructions, and when I use the commands:
mkdir build
cd build
cmake -G "Visual Studio 14 2015 Win64" ..
it says :
CMake Error at CMakeLists.txt:44 <project>:
Failed to run MSBuild command:
c:/Program files <x86>/MSBuild/14.0/bin/MSBuild.exe
to get the value of VCTargetspath:
Microsoft <R> Build Engine version 14.0.25420.1
Copyright <c? Microsoft Corporation. All rights reserved
MSBUILD : error MSB1009: Project file does not exist.
Switch: VCITargetspath.vcxproj
Exit code: 1
Configuring incomplete, errors occurred!
See also c:/Windows/System32/cpp-ethereum/build/CMakefiles/CMakeOutput.log
and also when I use the alt command:
cmake --build . --config RelWithDebInfo
it says:
MSBUILD : error MSB1009: Project file does not exist.
Switch: ALL_BUILD.vcxproj
I have to note that I have git, CMake and Visual Studio 2015 Professional fully installed.
Can you specify from a batch file or edit a file under the cmake installation??
I want to use msbuild.exe without visual studio IDE but I get this error:
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:6 (project):
No CMAKE_C_COMPILER could be found.
CMake Error at CMakeLists.txt:6 (project):
No CMAKE_CXX_COMPILER could be found.
I figure it's looking for msbuild.exe under an installation of the IDE but can't find it because there is no IDE.
1) Am I correct in thinking that?
I want to specify the compiler, but it can't be through a cmakeList.txt and I can't change what's already set up in cmake.
2) can you install msbuild 2013 instead of vs2013 and still use cmake where GENERATOR="Visual Studio 12 vs2013 Win64"
3) if so, can you specify where msbuild is from a batch file or edit a file under the cmake installation?
using msbuild 2013 and generator is set from a batch file like this where vc_ver is 12 and vs_version is 2013:
set GENERATOR="Visual Studio %VC_VER% %VS_VERSION% Win64"