fatal error C1083: Cannot open include file: 'basetsd.h' - python

So i have been trying to install Scrapy for Python for the last couple of days.
Trying anything i could think off and read everything i have come across with similar problems, but haven't been able to find a solution.
So here is the code.
Thank you.
building 'twisted.test.raiser' extension
creating build\temp.win32-3.6
creating build\temp.win32-3.6\Release
creating build\temp.win32-3.6\Release\src
creating build\temp.win32-3.6\Release\src\twisted
creating build\temp.win32-3.6\Release\src\twisted\test
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DWIN32=1 "-Ic:\users\karl holst\appdata\local\programs\python\python36-32\include" "-Ic:\users\karl holst\appdata\local\programs\python\python36-32\include" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\winrt" /Tcsrc/twisted/test/raiser.c /Fobuild\temp.win32-3.6\Release\src/twisted/test/raiser.obj
raiser.c
c:\users\karl holst\appdata\local\programs\python\python36-32\include\pyconfig.h(222): fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
----------------------------------------
Command ""c:\users\karl holst\appdata\local\programs\python\python36-32\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\KARLHO~1\\AppData\\Local\\Temp\\pip-build-ylmjilcy\\Twisted\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\KARLHO~1\AppData\Local\Temp\pip-hjzcemls-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\KARLHO~1\AppData\Local\Temp\pip-build-ylmjilcy\Twisted\
edit - the code i have used is "pip install Scrapy"

I had a very similiar issue involving Scrapy which also failed when it came to the Twisted part of the installation. My answer should still apply to your issue, it involves updating your SDK and making sure your .exe files are in the right location.
Got Scrapy installed in the end perfectly. Hope this helps.

Try after installing Microsoft Visual C++ Compiler for Python 2.7
https://www.microsoft.com/en-us/download/confirmation.aspx?id=44266

Must have the most recent version of Microsoft Visual C++ Build Tools. In my case it was 2017.
It's like 6GB which is unfortunate because I feel like I get 20MB worth of use from it. But that's what is needed.
It can be downloaded with Visual Studio Installer.

I could solve this problem by downloading and installing the latest Windows 10 SDK from this link:
https://software-download.microsoft.com/download/pr/19041.685.201201-2105.vb_release_svc_prod1_WindowsSDK.iso
and the basetsd.h file appeared in the following folder:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared

Deployed below components from VC++ installer. Then try pip install pandas. It worked for me.
C++/CLI support for v142 build tools (14.24)
MSVC v140 - VS 2015 C++ build tools (v14.00)
MSVC v141 - VS 2017 C++ ARM build tools (v14.16)
MSVC v141 - VS 2017 C++ ARM64 build tools (v14.16)
MSVC v141 - VS 2017 C++ x64/x86 build tools (v14.16)
MSVC v141 - VS 2017 C++ x64/x86 Spectre-mitigated libs (v14.16)
C++ 2019 Redistributable Update
C++ Clang Compiler for Windows (9.0.0)
C++ Clang-cl for v142 build tools (x64/x86)
C++ CMake tools for Windows
C++ Modules for v142 build tools (x64/x86 – experimental)

Related

unknown error installing scrapy in pycharm on windows 10

I'm trying to install scrapy in my project virtual environnement in pycharm and i'm having the following error. ( this is the last few lines of the error log it is quite long )
I don't know what is wrong or what to look for.
I tried to install it using the package manager and the pip install scrapy command and the result is the same.
can you help me? thank you and have a nice day!
building 'twisted.test.raiser' extension
creating build\temp.win32-3.8
creating build\temp.win32-3.8\Release
creating build\temp.win32-3.8\Release\src
creating build\temp.win32-3.8\Release\src\twisted
creating build\temp.win32-3.8\Release\src\twisted\test
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DWIN32=1 -IC:\Users\XXXXX\PycharmProjects\scrapicerie\venv\include -IC:\Python\Python38-32\include -IC:\Python\Python38-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include" /Tcsrc/twisted/test/raiser.c /Fobuild\temp.win32-3.8\Release\src/twisted/test/raiser.obj
raiser.c
C:\Python\Python38-32\include\pyconfig.h(59): fatal error C1083: Impossible d'ouvrir le fichier includeÿ: 'io.h'ÿ: No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------
Apparently it had something to do with visual studio.
I reinstalled visual studio with the python and c++ module and now scrapy installed correctly in pycharm.

Building a Python C extension on Windows

I'm trying to build a small Python module in C. It's just a single .C file that includes a single header file and links a single static library.
On Linux everything works as expected, but one of our team members uses Windows, so I'd like to build this module for Windows as well.
I'm using Windows 10 with Visual Studio Build Tools 2017 installed, including the VC++ 2015.3 v14.00 (v140) toolset for desktop. I'm using Python 3.6.
from setuptools import setup, Extension
drone_logger_module = Extension('DroneLogger',
include_dirs=['Output\\include'],
libraries=['DroneLoggerWindows'],
library_dirs=['x64\\Release'],
sources=['Output\\src\\DroneLogger.py.c'])
setup([...],
ext_modules=[drone_logger_module])
When I ran python setup.py bdist_wininst, I got the following output:
running bdist_wininst
running build
running build_ext
building 'DroneLogger' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IOutput\include -IC:\Users\piete\AppData\Local\Programs\Python\Python36\include -IC:\Users\piete\AppData\Local\Programs\Python\Python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" /TcOutput\src\DroneLogger.py.c /Fobuild\temp.win-amd64-3.6\Release\Output\src\DroneLogger.py.obj
DroneLogger.py.c
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:x64\Release /LIBPATH:C:\Users\piete\AppData\Local\Programs\Python\Python36\libs /LIBPATH:C:\Users\piete\AppData\Local\Programs\Python\Python36\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64" DroneLoggerWindows.lib /EXPORT:PyInit_DroneLogger build\temp.win-amd64-3.6\Release\Output\src\DroneLogger.py.obj /OUT:build\lib.win-amd64-3.6\DroneLogger.cp36-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.6\Release\Output\src\DroneLogger.cp36-win_amd64.lib
DroneLogger.py.obj : warning LNK4197: export 'PyInit_DroneLogger' specified multiple times; using first specification
Creating library build\temp.win-amd64-3.6\Release\Output\src\DroneLogger.cp36-win_amd64.lib and object build\temp.win-amd64-3.6\Release\Output\src\DroneLogger.cp36-win_amd64.exp
Generating code
Finished generating code
LINK : fatal error LNK1158: cannot run 'rc.exe'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed
with exit status 1158
I then followed this SO answer, and copied C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64\rc.exe and rcdll.dll to C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\. This solved the linking problem.
I've spent days trying to get it to work on Windows, and the solution I came up with is kind of questionable (that is, I don't know why it doesn't work out of the box, and I have a feeling that I shouldn't be moving Microsoft EXEs and DLLs around just to get it working).
My question is twofold:
Is there really no better/easier way to build a Windows installer for a Python C extension?
Why does this solution work, and why is it necessary?
What might make it generally easier to compile Python extensions on Linux than on Windows is that with standard package management on Linux you will generally have the same C compiler installed that was used to compile Python itself. On Windows, you have the choice of several Visual Studio versions, mingw, cygwin.
For Windows, I find it most straightforward to use the special Visual C++ for Python 2.7 package from Microsoft, which, unlike the newer Visual Studio version used in the question asked, has rc.exe properly in its path together with the Visual C compiler.
Another solution is to install the mingw compilers and create a file distutils.cfg in Lib/distutils in the main python folder with the contents
[build]
compiler=mingw32
[build_ext]
compiler=mingw32
to use these compilers instead. Unless -static-libgcc (and -static-libstdc++ for C++ projects) is added to the linker flags, the DLLs for libgcc (and for libstdc++) must be shipped with the extension so it will work also without the mingw runtime installed/in path.

Issue installing QuantLib Python

I am trying to install QuantLib Python. So, I followed through and installed:
1) Anaconda3, boost_1_64_0, QuantLib-1.10, QuantLib-SWIG-1.10,swigwin-3.0.12.
2) I installed using Visual Studio 2017, QuantLib. I followed a youtube video and managed to install it correctly and run an example.
3) Then I switched back to the indications in http://quantlib.org/install/windows-python.shtml, I execute the commands:
cd C:\local\QuantLib-SWIG-1.10\Python
set QL_DIR=C:\local\QuantLib-1.10
set INCLUDE=C:\local\boost_1_64_0
python setup.py build
but it fails...summarizing what I get:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\local\Anaconda3\libs /LIBPATH:C:\local\Anaconda3\PCbuild\amd64 /LIBPATH:C:\local\QuantLib-1.10\lib "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.15063.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.15063.0\um\x64" /EXPORT:PyInit__QuantLib build\temp.win-amd64-3.6\Release\QuantLib/quantlib_wrap.obj /OUT:build\lib.win-amd64-3.6\QuantLib_QuantLib.cp36-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.6\Release\QuantLib_QuantLib.cp36-win_amd64.lib /subsystem:windows /machine:x64
LINK : fatal error LNK1104: cannot open file 'QuantLib-vc140-x64-mt.lib'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1104
I do have two files QuantLib-vc141-mt-gd.lib and QuantLib-vc141-mt.lib inside the folder C:\local\QuantLib-1.10\lib. I am sure the problem has to do with some path that I am not assigning correctly, but I don't know what else to try. Thanks!
Your paths are correct, but Python is using Visual Studio 2015 (because it's what it was compiled with) and the library you have was produced with Visual Studio 2017. If you use the 2015 version throughout, it should work.
I also met this question, the error info gives it cannot find vc140 lib file, which should be the result of vs2015. I tried on another PC with vs2015 and it did work.
If you find the version doesn't matter, here is another choice QL.whl. Finding your .whl file and install by
pip install [some.whl]

Can't install TA-lib python issue with Microsoft Visual Studio

Trying to do a simple pip install TA-lib but am getting errors, in install Microsoft visual studios 14 but still the problem persists.
error code http://pastebin.com/h4jHWd1m
I tried to install it manually but get this:
setup.py:77: UserWarning: Cannot find ta-lib library, installation may fail.
warnings.warn('Cannot find ta-lib library, installation may fail.')
running install
running build
running build_py
running build_ext
building 'talib.common' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Python36-32\lib\site-packages\numpy\core\include -Ic:\ta-lib\c\include -IC:\Python36-32\include -IC:\Python36-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tctalib/common.c /Fobuild\temp.win32-3.6\Release\talib/common.obj
common.c
talib/common.c(240): fatal error C1083: Cannot open include file: 'ta_libc.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
The problem seems to be the same, any ideas ?
SOLVED. I had to download this and unzip to c:\
See https://github.com/mrjbq7/ta-lib#dependencies
Download file TA_Lib-0.4.24-cp37-cp37m-win_amd64.whl from https://www.lfd.uci.edu/~gohlke/pythonlibs/#ta-lib
then use pip install TA_Lib-0.4.24-cp37-cp37m-win_amd64.whl

Windows: fatal error C1083: Cannot open include file: 'lua.h': No such file or directory

I have tried to some requirements for a python project in windows, using pip install -r requirements.txt, however this keeps failing. After some investigation I have found that it fails because of lupa.
Running "pip install lupa" shows the same error as for when I try to install the requirements as shown in the stacktrace below:
Collecting lupa
Using cached lupa-1.2.tar.gz
Building wheels for collected packages: lupa
Running setup.py bdist_wheel for lupa: started
Running setup.py bdist_wheel for lupa: finished with status 'error'
Complete output from command d:\development\tools\python\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Achiraaz\\AppData\\Local\\Temp\\pip-build-g477k1jp\\lupa\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d C:\Users\Achiraaz\AppData\Local\Temp\tmped2hn2icpip-wheel- --python-tag cp35:
No local build of LuaJIT2 found in lupa directory
Checking for installed luajit library using pkg-config
pkg-config found luajit version 2.0.4
building without Cython
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win32-3.5
creating build\lib.win32-3.5\lupa
copying lupa\version.py -> build\lib.win32-3.5\lupa
copying lupa\__init__.py -> build\lib.win32-3.5\lupa
running build_ext
building 'lupa._lupa' extension
creating build\temp.win32-3.5
creating build\temp.win32-3.5\Release
creating build\temp.win32-3.5\Release\lupa
D:\Development\IDE\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DLUA_COMPAT_ALL -I/usr/include/luajit-2.0 -Id:\development\tools\python\include -Id:\development\tools\python\include "-ID:\Development\IDE\Microsoft Visual Studio 14.0\VC\INCLUDE" "-ID:\Development\IDE\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\winrt" "-ID:\Development\IDE\Microsoft Visual Studio 14.0\VC\INCLUDE" "-ID:\Development\IDE\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\winrt" /Tclupa/_lupa.c /Fobuild\temp.win32-3.5\Release\lupa/_lupa.obj
_lupa.c
lupa/_lupa.c(265): fatal error C1083: Cannot open include file: 'lua.h': No such file or directory
error: command 'D:\\Development\\IDE\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
----------------------------------------
Running setup.py clean for lupa
Failed to build lupa
Installing collected packages: lupa
Running setup.py install for lupa: started
Running setup.py install for lupa: finished with status 'error'
Complete output from command d:\development\tools\python\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Achiraaz\\AppData\\Local\\Temp\\pip-build-g477k1jp\\lupa\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\Achiraaz\AppData\Local\Temp\pip-5d7gkihi-record\install-record.txt --single-version-externally-managed --compile:
No local build of LuaJIT2 found in lupa directory
Checking for installed luajit library using pkg-config
pkg-config found luajit version 2.0.4
building without Cython
running install
running build
running build_py
creating build
creating build\lib.win32-3.5
creating build\lib.win32-3.5\lupa
copying lupa\version.py -> build\lib.win32-3.5\lupa
copying lupa\__init__.py -> build\lib.win32-3.5\lupa
running build_ext
building 'lupa._lupa' extension
creating build\temp.win32-3.5
creating build\temp.win32-3.5\Release
creating build\temp.win32-3.5\Release\lupa
D:\Development\IDE\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DLUA_COMPAT_ALL -I/usr/include/luajit-2.0 -Id:\development\tools\python\include -Id:\development\tools\python\include "-ID:\Development\IDE\Microsoft Visual Studio 14.0\VC\INCLUDE" "-ID:\Development\IDE\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\winrt" "-ID:\Development\IDE\Microsoft Visual Studio 14.0\VC\INCLUDE" "-ID:\Development\IDE\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\winrt" /Tclupa/_lupa.c /Fobuild\temp.win32-3.5\Release\lupa/_lupa.obj
_lupa.c
lupa/_lupa.c(265): fatal error C1083: Cannot open include file: 'lua.h': No such file or directory
error: command 'D:\\Development\\IDE\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
----------------------------------------
I tried at first to compile and install luajit, using the approach described on: http://luajit.org/install.html but this didnt solve the problem.
Then I managed to install luajit (at least I think I did) using hererocks, but for some reason it wont pick up lua.h even though the file is in the luajit/include library, so the end result was the same.
I found this article: Building luafilesystem for Lua for Windows
and I tried to play around with the environment variables described but no luck..
It seems to me like the file is for some reason not included in the build and I cannot make it resolve this.
All or any help and suggestions are appreciated.
I am running windows 10 with visual studio express edition. I have cygwin and mingw installed but I'd like to stick with the SDK if possible.

Categories

Resources