Detectron2 installation in Windows Causes Me a big error - python

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.

Related

'grib_api.h': No such file or directory on Windows

I am trying to install pygrib on windows. i already installed VS build tools for c++
I am getting this error
`Building wheels for collected packages: pygrib
Building wheel for pygrib (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for pygrib (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [22 lines of output]
eccodes not found, build may fail...
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-38
creating build\lib.win-amd64-cpython-38\pygrib
copying src\pygrib\__init__.py -> build\lib.win-amd64-cpython-38\pygrib
running build_ext
cythoning src/pygrib/_pygrib.pyx to src/pygrib\_pygrib.c
building 'pygrib._pygrib' extension
creating build\temp.win-amd64-cpython-38
creating build\temp.win-amd64-cpython-38\Release
creating build\temp.win-amd64-cpython-38\Release\src
creating build\temp.win-amd64-cpython-38\Release\src\pygrib
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.33.31629\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Ic:\users\zahee\appdata\local\programs\python\python38\include -Ic:\users\zahee\appdata\local\programs\python\python38\Include -IC:\Users\zahee\AppData\Local\Temp\pip-build-env-a8xx5o11\overlay\Lib\site-packages\numpy\core\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.33.31629\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /Tcsrc/pygrib\_pygrib.c /Fobuild\temp.win-amd64-cpython-38\Release\src/pygrib\_pygrib.obj
_pygrib.c
C:\Users\zahee\AppData\Local\Temp\pip-build-env-a8xx5o11\overlay\Lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
src/pygrib\_pygrib.c(756): fatal error C1083: Cannot open include file: 'grib_api.h': No such file or directory
C:\Users\zahee\AppData\Local\Temp\pip-build-env-a8xx5o11\overlay\Lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\zahee\AppData\Local\Temp\pip-install-9rng5s0e\pygrib_20eaa5920fdd4d09ae6fbbe6d3015227\src\pygrib\_pygrib.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
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
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pygrib
Failed to build pygrib
ERROR: Could not build wheels for pygrib, which is required to install pyproject.toml-based projects`
` fatal error C1083: Cannot open include file: 'grib_api.h': No such file or directory
`
also tried clone pygrib repo https://jswhit.github.io/pygrib/installing.html but `grib_api.h` not exists in the path.
can anyone help with this issue. I am trying to make an executable using windows.
the code running perfect on macos and linux.
thank you

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.

Installing PyUblas on Windows

I'm trying to install PyUblas on my Windows machine. I have Visual Studio 2017 Community edition. I've tried installing using
pip install pyublas
but get the following error message:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ipyublas/include "-Ic:\users\my name\appdata\local\programs\python\python36-32\lib\site-packages\numpy\core\include" "-Ic:\users\my name\appdata\local\programs\python\python36-32\lib\site-packages\numpy\core\include" "-Ic:\users\my name\appdata\local\programs\python\python36-32\lib\site-packages\numpy\core\include" "-Ic:\users\my name\appdata\local\programs\python\python36-32\include" "-Ic:\users\my name\appdata\local\programs\python\python36-32\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\cppwinrt" /EHsc /Tpsrc/wrapper/main.cpp /Fobuild\temp.win32-3.6\Release\src/wrapper/main.obj -Wno-sign-compare
cl : Command line error D8021 : invalid numeric argument '/Wno-sign-compare'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.12.25827\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------
Command ""c:\users\my name\appdata\local\programs\python\python36-32\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\MYNAME~1\\AppData\\Local\\Temp\\pip-build-z0yc_qan\\PyUblas\\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\MYNAME~1\AppData\Local\Temp\pip-2hhk4m35-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\MYNAME~1\AppData\Local\Temp\pip-build-z0yc_qan\PyUblas\
On the documentation page there is also a two-line description of an alternative installation method using Boost.Build; however, it seems rather outdated or at least I wasn't able to get it to work or even to understand it. I've compiled Boost but not sure what I'm supposed to do then. It seems bjam has since been superceded by b2 but running that didn't help. I also couldn't find anything useful by searching either Google or on here.
EDIT:
I have tried removing the offending lines from setup.py and installing manually as per TheGreatParker's suggestion. I have also removed references to the flag in question in lines 109 and 119 because they were throwing up errors. Now I get the following error:
src/wrapper/main.cpp(16): fatal error C1083: Cannot open include file:
'boost/python.hpp': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.12.25827\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.12.25827\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
I've tried copying the boost folder containing python.hpp into the installation folder but this didn't seem to help.
EDIT2:
I have rebuilt boost and made sure that the installation configuration file created by configure.py (which is siteconf.py) correctly links to the boost directories. Now I get the following error:
LINK : fatal error LNK1181: cannot open input file 'boost_python36-vc141-mt-x32-1_67.lib'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.12.25827\\bin\\HostX86\\x86\\link.exe' failed with exit status 1181
I gather that the file it wants is in the boost library directory which for me is boost_1_67_0\stage\lib\. The file in question is actually called libboost_python36-vc141-mt-x32-1_67.lib so I thought the problem was that it was missing the 'lib' in the beginning. However, when I changed siteconf.py:
BOOST_PYTHON_LIBNAME = ['libboost_python36-vc141-mt-x32-1_67']
I got the following error:
LINK : fatal error LNK1104: cannot open file 'boost_pythonPY_MAJOR_VERSIONPY_MINOR_VERSION-vc141-mt-x32-1_67.lib'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.12.25827\\bin\\HostX86\\x86\\link.exe' failed with exit status 1104
Seems that either way it can't access this file. I have also tried making a copy of the file libboost_python36-vc141-mt-x32-1_67 and renaming it what the installation is looking for. In this case I get a whole bunch of errors of the sort:
main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) struct boost::python::converter::registration const * __cdecl boost::python::converter::registry::query(struct boost::python::type_info)" (__imp_?query#registry#converter#python#boost##YAPBUregistration#234#Utype_info#34##Z)
until the installation exits with error
build\lib.win32-3.6\pyublas\_internal.cp36-win32.pyd : fatal error LNK1120: 22 unresolved externals
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.12.25827\\bin\\HostX86\\x86\\link.exe' failed with exit status 1120
You could try to install this package manually:
Clone source code;
Open setup.py and remove python logic which adds this flag. (in my version they are lines 16, and 17:
StringListOption("CXXFLAGS", ["-Wno-sign-compare"],
help="Any extra C++ compiler options to include"),
Use python setup.py install to install the package with changed setup.py
Hope this will help you.
conda install pyublas
You need to install anaconda/miniconda from
https://conda.io/docs/user-guide/install/index.html

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

Categories

Resources