2

I'm trying to install the pygrib package using the "Thonny IDE" tool to manage packages but I got this Error:

Collecting pygrib
Downloading 
https://files.pythonhosted.org/packages/a1/b3/04bd9b0e9f19ca7195e33975da7004602b 6abed3c48b779a06332e197e60/pygrib-2.0.3.tar.gz (21.4MB)
Installing collected packages: pygrib
  Running setup.py install for pygrib: started
Running setup.py install for pygrib: finished with status 'error'
Complete output from command    C:\Users\SSQ1\.thonny\BundledPython36\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\SSQ1\\AppData\\Local\\Temp\\pip-install-b71fvftx\\pygrib\\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\SSQ1\AppData\Local\Temp\pip-record-x9xj51sk\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\SSQ1\.thonny\BundledPython36\include\site\python3.6\pygrib:
running install
running build
running build_py
creating build
creating build\lib.win32-3.6
copying ncepgrib2.py -> build\lib.win32-3.6
running build_ext
building 'pygrib' extension
creating build\temp.win32-3.6
creating build\temp.win32-3.6\Release
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\SSQ1\.thonny\BundledPython36\lib\site-packages\numpy\core\include -Ig2clib_src -IC:\Users\SSQ1\.thonny\BundledPython36\include -IC:\Users\SSQ1\AppData\Local\Programs\Thonny\include -IC:\Users\SSQ1\AppData\Local\Programs\Thonny\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-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)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcpygrib.c /Fobuild\temp.win32-3.6\Release\pygrib.obj
pygrib.c
pygrib.c(4): fatal error C1083: Non Å  possibile aprire il file inclusione: 'Python.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2

----------------------------------------
Command "C:\Users\SSQ1\.thonny\BundledPython36\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\SSQ1\\AppData\\Local\\Temp\\pip-install-b71fvftx\\pygrib\\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\SSQ1\AppData\Local\Temp\pip-    record-x9xj51sk\install-record.txt --single-version-externally-managed --compile     --install-headers C:\Users\SSQ1\.thonny\BundledPython36\include\site\python3.6\pygrib" failed with error code 1 in C:\Users\SSQ1\AppData\Local\Temp\pip-install-b71fvftx\pygrib\


Return code: 

I got that it cannot find "Python.h" in the right Path but I cannot understand which is the right one.

Sorry for no more information but I've been using Python for very little time.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Marco Tela
  • 21
  • 6

1 Answers1

-1

The Python interpreter which is built into Thonny does not include required files for building native packages from source. In other words, you can't install this package with Thonny's built-in Python.

You should install a separate Python from python.org and make Thonny use it as backend (Tools => Options => Interpreter). After this you should be able to install this package (provided you have Visual Studio Tools properly set up).

Aivar
  • 6,814
  • 5
  • 46
  • 78