简体   繁体   中英

Having Problem Installing Pyopencl on Windows 10 Machine Using Pip

i am trying to install pyopencl with Python but i am getting the following console output

please help me solve this issue I have already included the opencl.lib path to my env variables.

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\mihir\appdata\local\programs\python\python36\libs /LIBPATH:c:\users\mihir\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)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64" OpenCL.lib /EXPORT:PyInit__cl build\temp.win-amd64-3.6\Release\src/wrap_constants.obj build\temp.win-amd64-3.6\Release\src/wrap_cl.obj build\temp.win-amd64-3.6\Release\src/wrap_cl_part_1.obj build\temp.win-amd64-3.6\Release\src/wrap_cl_part_2.obj build\temp.win-amd64-3.6\Release\src/wrap_mempool.obj build\temp.win-amd64-3.6\Release\src/bitlog.obj /OUT:build\lib.win-amd64-3.6\pyopencl\_cl.cp36-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.6\Release\src\_cl.cp36-win_amd64.lib
    LINK : fatal error LNK1181: cannot open input file 'OpenCL.lib'
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1181

    ----------------------------------------
Command "c:\users\mihir\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\MIHIR\\AppData\\Local\\Temp\\pip-install-82kaln2a\\pyopencl\\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\MIHIR\AppData\Local\Temp\pip-record-jp0yo2ti\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\MIHIR\AppData\Local\Temp\pip-install-82kaln2a\pyopencl\

Almost 100% of the times when I get Visual Studio errors when using pip I fetch the wheel file of the module I wish to install, then use pip on that local file.

https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyopencl

The link I provided will take you to the pyopencl area, this website is a wheel repository for many modules, I used it to install PyCairo as well when it was giving me VS errors. Select the pyopencl module that matches your Python version (For Python 3.7 it will be -cp37-), then select what OpenCL version you wish to use (For CL 2.1 it is +cl21-), then lastly select "amd64" or "win32" if you're on a 64-bit or 32-bit OS. Once you have the file downloaded point pip in the direction of the file, example command: pip install C:\Users\Mihir\Downloads\pyopencl-2018.2.2+cl21-cp37-cp37m-win_amd64.whl that will then install module (Treat a wheel file like a compressed ZIP or TAR). Make sure you have pyopencl prerequisites, which are numpy and cffi (It says Mako too, but I think it works without it).

I faced same problem and i couldn't install pyopencl. I was using python 3.7 in 64 bit windows. So i used pyopencl‑2018.2.5+cl21‑cp37‑cp37m‑win_amd64.whl version. But unfortunately it didn't work.

So i tried with pyopencl‑2018.2.5+cl21‑cp37‑cp37m‑win32.whl version and then it installed successfully.

Put pyopencl-2018.2.2+cl21-cp37-cp37m-win_amd64.whl in System32, then tap in the power shell pip install pyopencl-2020.3.1+cl21-cp39-cp39-win_amd64.whl

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM