godot-python icon indicating copy to clipboard operation
godot-python copied to clipboard

Problems with pip install (include folder missing in Python 3 install)

Open Zireael07 opened this issue 7 years ago • 10 comments

Important, I have Python 2.7 installed system-wide, so python.exe -m pip install and variants of it as given in the readme simply execute the 2.7 version.

I tried drilling down to Python test/pythonscript/windows64-cpython/Scripts and running pip install from there, but it fails with an error that it can't run the process (presumably because there's a space in the path).

I tried going to windows64-cpython and doing python -m pip install, which seems to work until there are C bindings, at which point it complains about Python.h not existing. Presumably another paths issue.

Zireael07 avatar May 22 '18 17:05 Zireael07

Hi,

You must build first godot-python, then use the python interpreter provided with the build to do pip install stuff (otherwise you would be using your system wide pip which doesn't install in the right directory, especially if it's a python 2 ^^)

Regarding the error message, you should copy-paste here.

touilleMan avatar May 22 '18 19:05 touilleMan

I did not build, I downloaded from asset lib (I am using Godot 3.0.2)

The can't run process was indeed an issue with a space in the path.

Libraries with C bindings still fail:

F:\downloads\Godot\3.0\Python-test\pythonscript\windows-64-cpython>python -m pip install pyvoronoi Collecting pyvoronoi Using cached https://files.pythonhosted.org/packages/a4/75/a3c381ddadf851a18d1 6ee7f5e99a0d20431e26538b779ebe601f2ab8287/pyvoronoi-1.0.5.tar.gz Installing collected packages: pyvoronoi Running setup.py install for pyvoronoi ... error Complete output from command F:\downloads\Godot\3.0\Python-test\pythonscript \windows-64-cpython\python.exe -u -c "import setuptools, tokenize;file='C:\ Users\AdmKasia\AppData\Local\Temp\pip-install-kyqz4w2d\pyvoronoi\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\Adm Kasia\AppData\Local\Temp\pip-record-edobkc12\install-record.txt --single-version -externally-managed --compile: Distribution mode: Compiling Cython generated .cpp sources. running install running build running build_ext building 'pyvoronoi' extension creating build creating build\temp.win-amd64-3.6 creating build\temp.win-amd64-3.6\Release creating build\temp.win-amd64-3.6\Release\pyvoronoi E:\Kasia\Visual Studio\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEB UG /MD -Ipyvoronoi -IF:\downloads\Godot\3.0\Python-test\pythonscript\windows-64- cpython\include -IF:\downloads\Godot\3.0\Python-test\pythonscript\windows-64-cpy thon\include "-IE:\Kasia\Visual Studio\VC\INCLUDE" "-IE:\Kasia\Visual Studio\VC
ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\u crt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Pro gram Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Win dows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\w inrt" /EHsc /Tppyvoronoi/pyvoronoi.cpp /Fobuild\temp.win-amd64-3.6\Release\pyvor onoi/pyvoronoi.obj pyvoronoi.cpp pyvoronoi/pyvoronoi.cpp(4): fatal error C1083: Cannot open include file: 'Py thon.h': No such file or directory error: command 'E:\Kasia\Visual Studio\VC\BIN\x86_amd64\cl.exe' failed with exit status 2

----------------------------------------

Command "F:\downloads\Godot\3.0\Python-test\pythonscript\windows-64-cpython\pyth on.exe -u -c "import setuptools, tokenize;file='C:\Users\AdmKasia\AppData \Local\Temp\pip-install-kyqz4w2d\pyvoronoi\setup.py';f=getattr(tokenize, 'o pen', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile (code, file, 'exec'))" install --record C:\Users\AdmKasia\AppData\Local\Temp \pip-record-edobkc12\install-record.txt --single-version-externally-managed --co mpile" failed with error code 1 in C:\Users\AdmKasia\AppData\Local\Temp\pip-inst all-kyqz4w2d\pyvoronoi\

F:\downloads\Godot\3.0\Python-test\pythonscript\windows-64-cpython>

Zireael07 avatar May 23 '18 06:05 Zireael07

I asked around a bit and I believe I know what the problem is - all python binaries the bindings have are missing the include folder. I understand getting or not getting the includes is an option at Python install time.

Can we have the includes installed (possibly as an option, but I'd rather it'd be default)?

Zireael07 avatar May 23 '18 07:05 Zireael07

I'm don't know much about pip&python on windows. My guess was on windows you install the package from the wheel version (see https://pythonwheels.com/) which comes already build (so no need of a compiler or the python headers). So it seems you tried to install a package than didn't come as a wheel...

Can you double check this guess (try to install a package containing C that is provided as wheel should work) ? The next step would be to find a way to provide the Python headers into the windows build. The modification should be done around here

touilleMan avatar May 30 '18 08:05 touilleMan

I will try a completely different package that has a wheel version. Unfortunately both voronoi libraries available on pip don't have a wheel version :(

Zireael07 avatar May 30 '18 08:05 Zireael07

I was able to install

F:\downloads\Godot\3.0\Python-test\pythonscript\windows-64-cpython>python -m pip install f:\downloads\python\wheels-3\numpy-1.14.3+mkl-cp36-cp36m-win_amd64.whl Processing f:\downloads\python\wheels-3\numpy-1.14.3+mkl-cp36-cp36m-win_amd64.wh l Installing collected packages: numpy Successfully installed numpy-1.14.3+mkl

F:\downloads\Godot\3.0\Python-test\pythonscript\windows-64-cpython>

... and use numpy. So yes, packages that have wheels available do work.

Yes, the package I tried to install does not have a wheel available anywhere I can see, unfortunately.

Can Godot assets have install options? The python headers could be an option at bindings install time...

Zireael07 avatar May 31 '18 13:05 Zireael07

Can Godot assets have install options? The python headers could be an option at bindings install time...

I totally want to provide the python headers for windows (just like we do for linux and macOS), the thing is it's not trivial to do so (the headers must first be generated during the build of python, and they aren't provided in cpython windows official release...). So it's just a matter of finding how to do it ;-)

touilleMan avatar May 31 '18 14:05 touilleMan

Installing python from the official installer installs headers automatically (at least for 2.7.x), maybe instead of globbing file-by-file you could glob the installer and run it?

Zireael07 avatar May 31 '18 15:05 Zireael07

The CPython official Windows zip build doesn't contain the include folder. Maybe it's different with the msi executable, but I have no idea how to extract it data...

touilleMan avatar Jun 15 '18 21:06 touilleMan

What do i have to run to 'pip install' stuff on Ubuntu?

vrmaurice avatar Jul 21 '22 19:07 vrmaurice