wntrblm/potracecffi

error when pip install

Opened this issue · 1 comments

HC-47 commented

Hi, I'm having an issue while installing this library. I'm coming from the blog post you wrote here: "https://blog.thea.codes/raster-vectorization-with-python/". I've tried almost anything my limited knowledge of building C libs allows. Basically, if I run pip install potracecffi or run the install directly from a clone of this repository, I get an error referring to the "potrace.lib" file.

To be fair, using the clone of this repo required changing the cffi library references, but yet, even if the process is able to find all the original potrace c files, it keeps asking for a potrace.lib file, which is something I would not know how to produce.

I tried to create a static library from the original potrace source, but found that the vanilla files would return errors in the latest visual studio version, when compiling...

Can you help in any way?

Below is a trace of the pip error

Collecting potracecffi
  Using cached potracecffi-2022.8.22.post1.tar.gz (5.6 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: cffi>=1.15.0 in path\.venv\lib\site-packages (from potracecffi) (1.16.0)
Requirement already satisfied: pycparser in path\.venv\lib\site-packages (from cffi>=1.15.0->potracecffi) (2.21)
Installing collected packages: potracecffi
  DEPRECATION: potracecffi is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for potracecffi ... error
  error: subprocess-exited-with-error

  × Running setup.py install for potracecffi did not run successfully.
  │ exit code: 1
  ╰─> [37 lines of output]
      running install
      path\.venv\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-310
      creating build\lib.win-amd64-cpython-310\potracecffi
      copying potracecffi\potracecffi_build.py -> build\lib.win-amd64-cpython-310\potracecffi
      copying potracecffi\__init__.py -> build\lib.win-amd64-cpython-310\potracecffi
      running egg_info
      writing potracecffi.egg-info\PKG-INFO
      writing dependency_links to potracecffi.egg-info\dependency_links.txt
      writing requirements to potracecffi.egg-info\requires.txt
      writing top-level names to potracecffi.egg-info\top_level.txt
      reading manifest file 'potracecffi.egg-info\SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      adding license file 'LICENSE'
      writing manifest file 'potracecffi.egg-info\SOURCES.txt'
      copying potracecffi\potracecffi.c -> build\lib.win-amd64-cpython-310\potracecffi
      copying potracecffi\potracecffi.h -> build\lib.win-amd64-cpython-310\potracecffi
      running build_ext
      generating cffi module 'build\\temp.win-amd64-cpython-310\\Release\\potracecffi._potracecffi.c'
      creating build\temp.win-amd64-cpython-310
      creating build\temp.win-amd64-cpython-310\Release
      building 'potracecffi._potracecffi' extension
      creating build\temp.win-amd64-cpython-310\Release\build
      creating build\temp.win-amd64-cpython-310\Release\build\temp.win-amd64-cpython-310
      creating build\temp.win-amd64-cpython-310\Release\build\temp.win-amd64-cpython-310\Release
      "C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I/opt/homebrew/opt/potrace/include -Ipath\.venv\include -IC:path2\Python\Python310\include -IC:path2\Python\Python310\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.36.32532\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /Tcbuild\temp.win-amd64-cpython-310\Release\potracecffi._potracecffi.c /Fobuild\temp.win-amd64-cpython-310\Release\build\temp.win-amd64-cpython-310\Release\potracecffi._potracecffi.obj
      potracecffi._potracecffi.c
      build\temp.win-amd64-cpython-310\Release\potracecffi._potracecffi.c(630): warning C4267: '=': conversione da 'size_t' a 'int'. Possibile perdita di dati.
      build\temp.win-amd64-cpython-310\Release\potracecffi._potracecffi.c(631): warning C4267: '=': conversione da 'size_t' a 'int'. Possibile perdita di dati.
      build\temp.win-amd64-cpython-310\Release\potracecffi._potracecffi.c(617): warning C4267: 'inizializzazione': conversione da 'size_t' a 'int'. Possibile perdita di dati.
      "C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\link.exe" /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:/opt/homebrew/opt/potrace/lib /LIBPATH:path\.venv\libs /LIBPATH:C:path2\Python\Python310\libs /LIBPATH:C:path2\Python\Python310 /LIBPATH:path\.venv\PCbuild\amd64 "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.36.32532\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22621.0\\um\x64" potrace.lib /EXPORT:PyInit__potracecffi build\temp.win-amd64-cpython-310\Release\build\temp.win-amd64-cpython-310\Release\potracecffi._potracecffi.obj /OUT:build\lib.win-amd64-cpython-310\potracecffi\_potracecffi.pyd /IMPLIB:build\temp.win-amd64-cpython-310\Release\build\temp.win-amd64-cpython-310\Release\_potracecffi.lib   
      LINK : fatal error LNK1181: non Š possibile aprire il file di input 'potrace.lib'
      error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Tools\\MSVC\\14.36.32532\\bin\\HostX86\\x64\\link.exe' failed with exit code 1181
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> potracecffi

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Similar error here, trying to install/build on Windows, which is a shame as I'd love to use this (following from your blog post):

Collecting potracecffi
  Using cached potracecffi-2022.8.22.post1.tar.gz (5.6 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Collecting cffi>=1.15.0 (from potracecffi)
  Using cached cffi-1.16.0-cp312-cp312-win_amd64.whl.metadata (1.5 kB)
Collecting pycparser (from cffi>=1.15.0->potracecffi)
  Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Using cached cffi-1.16.0-cp312-cp312-win_amd64.whl (181 kB)
Building wheels for collected packages: potracecffi
  Building wheel for potracecffi (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for potracecffi (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [31 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-312
      creating build\lib.win-amd64-cpython-312\potracecffi
      copying potracecffi\potracecffi_build.py -> build\lib.win-amd64-cpython-312\potracecffi
      copying potracecffi\__init__.py -> build\lib.win-amd64-cpython-312\potracecffi
      running egg_info
      writing potracecffi.egg-info\PKG-INFO
      writing dependency_links to potracecffi.egg-info\dependency_links.txt
      writing requirements to potracecffi.egg-info\requires.txt
      writing top-level names to potracecffi.egg-info\top_level.txt
      reading manifest file 'potracecffi.egg-info\SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      adding license file 'LICENSE'
      writing manifest file 'potracecffi.egg-info\SOURCES.txt'
      copying potracecffi\potracecffi.c -> build\lib.win-amd64-cpython-312\potracecffi
      copying potracecffi\potracecffi.h -> build\lib.win-amd64-cpython-312\potracecffi
      running build_ext
      generating cffi module 'build\\temp.win-amd64-cpython-312\\Release\\potracecffi._potracecffi.c'
      creating build\temp.win-amd64-cpython-312
      creating build\temp.win-amd64-cpython-312\Release
      building 'potracecffi._potracecffi' extension
      creating build\temp.win-amd64-cpython-312\Release\build
      creating build\temp.win-amd64-cpython-312\Release\build\temp.win-amd64-cpython-312
      creating build\temp.win-amd64-cpython-312\Release\build\temp.win-amd64-cpython-312\Release
      "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I/opt/homebrew/opt/potrace/include -IC:\Python312\include -IC:\Python312\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\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\shared" "-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\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcbuild\temp.win-amd64-cpython-312\Release\potracecffi._potracecffi.c /Fobuild\temp.win-amd64-cpython-312\Release\build\temp.win-amd64-cpython-312\Release\potracecffi._potracecffi.obj
      potracecffi._potracecffi.c
      build\temp.win-amd64-cpython-312\Release\potracecffi._potracecffi.c(573): fatal error C1083: Cannot open include file: 'potracelib.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\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 potracecffi
Failed to build potracecffi
ERROR: Could not build wheels for potracecffi, which is required to install pyproject.toml-based projects

I can't see that there's a .whl available?