I've downloaded dlib and when I'm trying to install It using python setup install It give me this error, I'm using Visual Studio 2015 professional
running install
running bdist_egg
running egg_info
writing dependency_links to dlib.egg-info\dependency_links.txt
writing top-level names to dlib.egg-info\top_level.txt
writing dlib.egg-info\PKG-INFO
package init file 'dlib\__init__.py' not found (or not a regular file)
reading manifest file 'dlib.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'dlib.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
Invoking CMake setup: 'cmake C:\Users\Mouhsine\Desktop\DeepLearning and SVM\dlib-master\tools\python
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Mouhsine\Desktop\DeepLearning and SVM\dlib-master\build\l
ib.win-amd64-3.5 -DPYTHON_EXECUTABLE=D:\Python35\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE
=C:\Users\Mouhsine\Desktop\DeepLearning and SVM\dlib-master\build\lib.win-amd64-3.5 -A x64'
-- pybind11 v2.2.2
-- Using CMake version: 3.11.0-rc4
-- NOTE: Visual Studio didn't have good enough C++11 support until Visual Studio 2015 update 3 (v19.
0.24210.0)
-- So we aren't enabling things that require full C++11 support (e.g. the deep learning tools).
-- Also, be aware that Visual Studio's version naming is confusing, in particular, there are multipl
e versions of 'update 3'
-- So if you are getting this message you need to update to the newer version of Visual Studio to us
e full C++11.
-- Enabling SSE4 instructions
-- C++11 activated.
CMake Error at CMakeLists.txt:31 (message):
You have to use a version of Visual Studio that supports C++11. As of
December 2017, the only versions that have good enough C++11 support to
compile the dlib Pyhton API is a fully updated Visual Studio 2015 or a
fully updated Visual Studio 2017. Older versions of either of these
compilers have bad C++11 support and will fail to compile the Python
extension. ***SO UPDATE YOUR VISUAL STUDIO TO MAKE THIS ERROR GO AWAY***
what should I do for my case
In my case,I have updated visual studio 2015 to update3, and I found version is 14.0.25431 ,not v19.0.24210.0.So I changed
\dlib\cmake_utils\set_compiler_specific_options.cmake file
, and edited
elseif(MSVC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.24210.0 )
to
elseif(MSVC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14.0.24210.0 )
then everything is OK.
Related
I want to install gpaw (a DFT calculation python package for physicists), so I used the command -
pip install gpaw
pip installed gpaw's all dependencies except gpaw itself & gave error -
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
So, I downloaded the latest version & successfully installed visual studio build tools from the link above
But, after I tried to install gpaw using pip again, I got a new error -
cl : Command line warning D9025 : overriding '/DNDEBUG' with '/UNDEBUG'
cl : Command line error D8021 : invalid numeric argument '/Wno-unknown-pragmas'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.33.31629\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
Can someone tell me how to fix this failing execution of visual studio build tools?
What I tried to fix - I repaired the installed Visual Studio build tools using installer, but nothing changed.
I've been trying to build a basic test file with Cython, but I keep getting error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/.
I have a setup.py file:
from setuptools import setup
from Cython.Build import cythonize
setup(
name='testich',
ext_modules=cythonize("lmao.py"),
)
and I've been attempting to build it both with setup.py build_ext --inplace and cythonize -i lmao.py, but they both yield the same error.
I have tried nefedor's solution, but it hasn't worked for me. I've tried both the latest 2022 build tools and the 2019 build tools for my python version (having only one installed at a time), installing on my C: and D: drives, with no luck. I made sure C++ build tools were checked when installing.
I'm using Python 3.8.10 and Cython 3.0.0a11, and the latest version of setuptools
I was able to get it working by typing the command:
SET DISTUTILS_USE_SDK=1 & "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64
before building. Both setup.py build_ext --inplace and cythonize -i now work.
You will have to change the vcvarsall path/processor type in the command if your build tools install location/processor type are not the same.
Thanks to https://stackoverflow.com/a/73869315/20203839 and https://learn.microsoft.com/en-us/answers/questions/419525/microsoft-visual-c-140-or-greater-is-required.html for showing me the solution, even though the Microsoft questions page mentions Anaconda it works fine with CPython.
I keep getting the same message, it says I need to Install Visual Studio but I already have it, (maybe pip doesn't recognize it? or its a bad installation?) I am running on windows have python 3.10, and Visual Studio 2022 community with the python extension.
here is the entire log:
× Building wheel for pupil-apriltags (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [50 lines of output]
Not searching for unused variables given on the command line.
CMake Error at CMakeLists.txt:2 (PROJECT):
Generator
Visual Studio 15 2017
could not find any instance of Visual Studio.
-- Configuring incomplete, errors occurred!
See also "C:/Users/Jordan/AppData/Local/Temp/pip-install-bnra7vj7/pupil-apriltags_67071b5788a34192b7169db94dd696e6/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
--------------------------------------------------------------------------------
-- Trying "Visual Studio 15 2017 x64 v141" generator
--------------------------------
---------------------------
----------------------
-----------------
------------
-------
--
--
-------
------------
-----------------
----------------------
---------------------------
--------------------------------
-- Trying "Visual Studio 15 2017 x64 v141" generator - failure
--------------------------------------------------------------------------------
********************************************************************************
scikit-build could not get a working generator for your system. Aborting build.
Building windows wheels for Python 3.10 requires Microsoft Visual Studio 2022.
Get it with "Visual Studio 2017":
https://visualstudio.microsoft.com/vs/
Or with "Visual Studio 2019":
https://visualstudio.microsoft.com/vs/
Or with "Visual Studio 2022":
https://visualstudio.microsoft.com/vs/
********************************************************************************
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pupil-apriltags
Failed to build pupil-apriltags
ERROR: Could not build wheels for pupil-apriltags, which is required to install
pyproject.toml-based projects
After a bit of digging around, I found that the package is only compatible for python 3.6 and 3.7 not to mention it doesn't work on windows NT or 11... which is really sad in my opinion, apriltags and fiducials in general are growing and for a good reason, why not make the package compatible with 3.10+ (did something change that made it incompatible?) anyway this is me saying to whoever made pupil-apriltags, please fix this!
ps: I did manage to pip install the package in WSL Python 3.7.
I am attempting to build my cython code using this setup.py file:
from distutils.core import setup
from Cython.Build import cythonize
import numpy as np
setup(
name="My Cython Project",
ext_modules=cythonize("*.pyx", include_path=[np.get_include()], language="c++")
)
and
python setup.py build_ext --inplace
But am getting the error:
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
But I installed the build tools and I know they work because I can manually build my project using these commands in the Developer Command Prompt for VS 2019:
cython -a -3 --cplus Myfile.pyx
cl /LD /O2 /EHsc [ include files ] Myfile.cpp [ python 3.8 lib ]
Why does cython think the build tools are not installed? Do I need to add something to PATH?
(I run the same project on my macOS machine with gcc installed and it works perfectly.)
Screenshot of my Visual Studio Installer Screen
The problem is that setup.py shows you incorrect version of MSVC. It's not the 14.0 that you need. I just did solved the very same issue myself, also for Python 3.8, so here are the steps.
When you compile something for Python, you should use the same compiler version. So let's see what compiler was used for you Python:
python -c "import sys; print(sys.version)"
Mine prints:
3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)]
So I need MSVC version 1916.
You can check which version it is here: https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B . For me 1916 is Visual Studio 2017 version 15.9 - likely that's what you really need.
You to M$ downloads https://my.visualstudio.com/Downloads?q=Visual%20Studio%202015&pgroup= , search, for example, for "Visual Studio Community 2017 (version 15.9)" and install it (or just the compiler) and enjoy.
P.S. It is likely that you will need exactly that compiler for all your python 3.8 extensions (unless you use direct dll calls) and you will need to recompile the code you did in Studio 2019.
I am trying to develop a python console application that implement IoT using Microsoft azure. For this purpose, I am following very basic tutorial made for python developers by Microsoft azure in my Windows 10 machine. Pre-installed Visual C++ redistributable package is one of the most important requirement to allow the use of native DLLs from Python among 4 prerequisites described into the Introduction section of the tutorial.
My system configurations:
Software Version
-------------------------------------------------------
Python: 3.5.2
Visual C++ redistributable package: 2010, 2013, 2017
Node: 6.10.2
Figure of Visual C++ redistributable package:
Problems:
Visual C++ redistributable package is not installed since Visual C++ redistributable package in the tutorial is an older version (2015) then mine (2017).
It shows following error:
Traceback (most recent call last):
File "CreateDeviceIdentity.py", line 2, in <module>
import iothub_service_client
File "F:\Settings\Windows\ProgramFiles\Python\lib\site-packages\iothub_service_client\__init__.py", line 1, in <module>
from .iothub_service_client import *
ImportError: DLL load failed: The specified module could not be found.
Question:
How how can I solve this problem?
N.B: I have completed those basic tutorial provided for Java and NodeJS developers.
I tried to reproduce your issue successfully, and I made the code import iothub_service_client works after installed Visual C++ Redistributable for Visual Studio 2015. So please install the 2015 version on your machine to resolve it, as the tutorial said,
If you are using Windows OS, then Visual C++ redistributable package to allow the use of native DLLs from Python.
The link in the tutorial is for the 2015 verison.