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]
Related
I'm Jitesh, a Python programmer trying to install detectron2 on Windows. While installing detectron2, I ran an error.
This is the segement of the code:
Emitting ninja build file C:\Users\USER\AppData\Local\Temp\pip-req-build-9z8ky448\build\temp.win-amd64-3.8\Release\build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
1.10.0.git.kitware.jobserver-1
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:\users\user\appdata\local\programs\python\python38\lib\site-packages\torch\lib /LIBPATH:c:\users\user\appdata\local\programs\python\python38\libs /LIBPATH:c:\users\user\appdata\local\programs\python\python38\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64" c10.lib torch.lib torch_cpu.lib torch_python.lib /EXPORT:PyInit__C C:\Users\USER\AppData\Local\Temp\pip-req-build-9z8ky448\build\temp.win-amd64-3.8\Release\Users\USER\AppData\Local\Temp\pip-req-build-9z8ky448\detectron2\layers\csrc\vision.obj C:\Users\USER\AppData\Local\Temp\pip-req-build-9z8ky448\build\temp.win-amd64-3.8\Release\Users\USER\AppData\Local\Temp\pip-req-build-9z8ky448\detectron2\layers\csrc\box_iou_rotated\box_iou_rotated_cpu.obj C:\Users\USER\AppData\Local\Temp\pip-req-build-9z8ky448\build\temp.win-amd64-3.8\Release\Users\USER\AppData\Local\Temp\pip-req-build-9z8ky448\detectron2\layers\csrc\cocoeval\cocoeval.obj C:\Users\USER\AppData\Local\Temp\pip-req-build-9z8ky448\build\temp.win-amd64-3.8\Release\Users\USER\AppData\Local\Temp\pip-req-build-9z8ky448\detectron2\layers\csrc\nms_rotated\nms_rotated_cpu.obj C:\Users\USER\AppData\Local\Temp\pip-req-build-9z8ky448\build\temp.win-amd64-3.8\Release\Users\USER\AppData\Local\Temp\pip-req-build-9z8ky448\detectron2\layers\csrc\ROIAlign\ROIAlign_cpu.obj C:\Users\USER\AppData\Local\Temp\pip-req-build-9z8ky448\build\temp.win-amd64-3.8\Release\Users\USER\AppData\Local\Temp\pip-req-build-9z8ky448\detectron2\layers\csrc\ROIAlignRotated\ROIAlignRotated_cpu.obj /OUT:build\lib.win-amd64-3.8\detectron2\_C.cp38-win_amd64.pyd /IMPLIB:C:\Users\USER\AppData\Local\Temp\pip-req-build-9z8ky448\build\temp.win-amd64-3.8\Release\Users\USER\AppData\Local\Temp\pip-req-build-9z8ky448\detectron2\layers\csrc\_C.cp38-win_amd64.lib
LINK : fatal error LNK1181: cannot open input file 'C:\Users\USER\AppData\Local\Temp\pip-req-build-9z8ky448\build\temp.win-amd64-3.8\Release\Users\USER\AppData\Local\Temp\pip-req-build-9z8ky448\detectron2\layers\csrc\vision.obj'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1181
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\colorama\ansitowin32.py", line 59, in closed
return stream.closed
ValueError: underlying buffer has been detached
----------------------------------------
ERROR: Failed building wheel for detectron2
Please help me
I had a similar issue. Finally, I solved it buy:
Deleting build directory in Detectron2 (rm -rf build/ **/*.so)
cd to the Detectron2 and pip install -e.
It builds the wheel again.
There are a quite a few answers to this question covering a ton of different scenarios but I've yet to find a solution to the self-same issue. When I try to install pip install cryptography I get:
generating cffi module
'build\temp.win-amd64-3.8\Release\_padding.c' creating
build\temp.win-amd64-3.8 creating build\temp.win-amd64-3.8\Release
generating cffi module
'build\temp.win-amd64-3.8\Release\_constant_time.c' generating
cffi module 'build\temp.win-amd64-3.8\Release\_openssl.c'
building '_openssl' extension creating
build\temp.win-amd64-3.8\Release\build creating
build\temp.win-amd64-3.8\Release\build\temp.win-amd64-3.8 creating
build\temp.win-amd64-3.8\Release\build\temp.win-amd64-3.8\Release
C:\Program Files (x86)\Microsoft Visual
Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe
/c /nologo /Ox /W3 /GL /DNDEBUG /MD
-IC:\Users\be004cr\PycharmProjects\SSLTest\venv\include -IC:\ Python\Python38\include -IC:\Python\Python38\include "-IC:\Program
Files (x86)\Microsoft Visual
Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\ATLMFC\include"
"-IC:\Program Files (x86)\Microsoft Visual Studio\
2017\Professional\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program
Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-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"
"-IC:\Program Files (x86)\Wind ows
Kits\10\include\10.0.17763.0\cppwinrt"
/Tcbuild\temp.win-amd64-3.8\Release_openssl.c
/Fobuild\temp.win-amd64-3.8\Release\build\temp.win-amd64-3.8\Release_openssl.obj
_openssl.c build\temp.win-amd64-3.8\Release_openssl.c(498): fatal error C1083: Cannot open include file: 'openssl/opensslv.h': No such
file or directory error: command 'C:\Program Files (x86)\Microsoft
Visual
Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe'
failed with exit status 2
---------------------------------------- Failed building wheel for
cryptography Running setup.py clean for cryptography Failed to build
cryptography Could not build wheels for cryptography which use PEP 517
and cannot be installed directly
I am running a virtual environment within PyCharm 2019.2.5 on a Windows 10.
I have installed OpenSSL from https://slproweb.com/products/Win32OpenSSL.html and selected the
latest 32bit version (I had the 64bit installed at first attempt but read elsewhere people had trouble with this so swtiched to 32bit)
I have updated the LIB and INCLUDE locations to the relevant ../openssl/include and ../openssl/lib locations and tried re-running the pip install but I keep gettng the same message. I've done this within the terminal within PyCharm and the standard CMD prompt.
I'm running PIP version 19.0.3
I'm sure I'm missing something super simple. Just don't know what.
I'm looking to use the cryptography (originally planned to use pyopenssl but have noticed it's been superceded by cryptography) to enable HTTPS for my flask application.
Is there anything I've missed? I feel there is.
Many thanks
You can try this
1. Open PyCharm.
2. go to File -> settings -> Project:test(test means your project name) -> select project interpretor -> click add button
3. after clicking add button and search <package name> then install it.
finally, run the program.
Update
Newer versions of Pycharm have a "+" mark (add button) here.
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.
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)
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