pytroll / aggdraw

Python package wrapping AGG2 drawing functionality
https://aggdraw.readthedocs.io/en/latest/
Other
98 stars 48 forks source link

Cannot install on Windows #69

Closed antoniocali closed 3 years ago

antoniocali commented 3 years ago

Hello. It seems there's some issue with aggdraw and windows. I have installed of course the Built Tools for windows

But I get an error for font_freetype

this is the error


Collecting aggdraw
  Using cached aggdraw-1.3.11.tar.gz (255 kB)
Building wheels for collected packages: aggdraw
  Building wheel for aggdraw (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\anton\\AppData\\Local\\Temp\\pip-install-er4oxpcq\\aggdraw\\setup.py'"'"'; __file__='"'"'C:\\Users\\anton\\AppData\\Local\\Temp\\pip-install-er4oxpcq\\aggdraw\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\anton\AppData\Local\Temp\pip-wheel-07gjl80k'
       cwd: C:\Users\anton\AppData\Local\Temp\pip-install-er4oxpcq\aggdraw\
  Complete output (19 lines):
  Trying freetype-config to find freetype library...
  Using ctypes to find freetype library...
  === freetype found: 'C:\Program Files\Java\jdk-14.0.1'
  running bdist_wheel
  running build
  running build_ext
  building 'aggdraw' extension
  creating build
  creating build\temp.win-amd64-3.8
  creating build\temp.win-amd64-3.8\Release
  creating build\temp.win-amd64-3.8\Release\agg2
  creating build\temp.win-amd64-3.8\Release\agg2\src
  creating build\temp.win-amd64-3.8\Release\agg2\font_freetype
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DVERSION=1.3.11 -DHAVE_FREETYPE2 -Iagg2/include -Iagg2/font_freetype "-IC:\Program Files\Java\jdk-14.0.1\include" "-IC:\Program Files\Java\jdk-14.0.1\include/freetype" "-IC:\Program Files\Java\jdk-14.0.1\include/freetype2" -Ic:\python38\include -Ic:\python38\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" /EHsc /Tpaggdraw.cxx /Fobuild\temp.win-amd64-3.8\Release\aggdraw.obj
  aggdraw.cxx
  c:\users\anton\appdata\local\temp\pip-install-er4oxpcq\aggdraw\agg2\include\agg_array.h(523): warning C4311: 'type cast': pointer truncation from 'agg::int8u *' to 'unsigned long'
  c:\users\anton\appdata\local\temp\pip-install-er4oxpcq\aggdraw\agg2\include\agg_array.h(523): warning C4302: 'type cast': truncation from 'agg::int8u *' to 'unsigned long'
  agg2/font_freetype\agg_font_freetype.h(23): fatal error C1083: Cannot open include file: 'ft2build.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
  ----------------------------------------
  ERROR: Failed building wheel for aggdraw```
djhoese commented 3 years ago

Two things I can think of:

  1. Do you know if you have freetype installed? Based on the === message it seems to think it is installed and available from your Java installation. However, that installation doesn't seem to include the necessary development headers (.h files). You could try setting the environment variable AGGDRAW_FREETYPE_ROOT (see here) to the location of another version of freetype that does include the headers. I know there is a freetype-py package that might help get that installed if you don't have another way (sorry, not sure on Windows): https://pypi.org/project/freetype-py/

  2. Aggdraw has not been released with a python 3.8 wheel yet so that's why it is trying to compile things from source on your machine. A new release would get rid of this error message most likely.

djhoese commented 3 years ago

aggdraw 1.3.12 was just released to fix this (a python 3.8 wheel). I also created a maint/1.3 branch here on github so if we need to make more releases this shouldn't be quite as difficult. Feel free to comment if there are related/continuing issues, but more likely a new issue should be made.