pysam-developers / pysam

Pysam is a Python package for reading, manipulating, and writing genomics data such as SAM/BAM/CRAM and VCF/BCF files. It's a lightweight wrapper of the HTSlib API, the same one that powers samtools, bcftools, and tabix.
https://pysam.readthedocs.io/en/latest/
MIT License
785 stars 273 forks source link

Windows: Can't find string.h #1051

Open PikalaxALT opened 3 years ago

PikalaxALT commented 3 years ago

Included the relevant part of the log below. I installed the Universal C Runtime SDK for Visual Studio Community 2019, and the file string.h is present in directory C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt, yet the error persists after a Windows reboot. You can see from the cl.exe call that this very directory is included in the CFLAGS.

Screenshot of UCRT headers directory in Explorer: image

Log:

  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\<USERNAME>\AppData\Local\Temp\pip-install-5cjw3c7u\pysam_95be4de9ef1f4718bb1bdd0e648e8b6f\htslib -IC:\Users\<USERNAME>\AppData\Local\Temp\pip-install-5cjw3c7u\pysam_95be4de9ef1f4718bb1bdd0e648e8b6f\samtools -IC:\Users\<USERNAME>\AppData\Local\Temp\pip-install-5cjw3c7u\pysam_95be4de9ef1f4718bb1bdd0e648e8b6f\samtools\lz4 -IC:\Users\<USERNAME>\AppData\Local\Temp\pip-install-5cjw3c7u\pysam_95be4de9ef1f4718bb1bdd0e648e8b6f\bcftools -IC:\Users\<USERNAME>\AppData\Local\Temp\pip-install-5cjw3c7u\pysam_95be4de9ef1f4718bb1bdd0e648e8b6f\pysam -IC:\Users\<USERNAME>\AppData\Local\Temp\pip-install-5cjw3c7u\pysam_95be4de9ef1f4718bb1bdd0e648e8b6f -IC:\Users\<USERNAME>\AppData\Local\Temp\pip-install-5cjw3c7u\pysam_95be4de9ef1f4718bb1bdd0e648e8b6f\win32 -IC:\Program Files\Python39\include -IC:\Program Files\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -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 -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -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 /Tchtslib\bcf_sr_sort.c /Fobuild\temp.win-amd64-3.9\Release\htslib\bcf_sr_sort.obj
  bcf_sr_sort.c
  htslib\bcf_sr_sort.c(29): fatal error C1083: Cannot open include file: 'strings.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
  ----------------------------------------
  ERROR: Failed building wheel for pysam
  Running setup.py clean for pysam
Failed to build pysam
PikalaxALT commented 3 years ago

A simple test program (Hello, world! additionally including ) does not raise this error.

Updated packages wheel-0.37.0, setuptools-58.2.0, Cython-0.29.24 with the same result.

This could just as easily be an issue with setuptools on Windows but I can't think of another package with C sources that isn't distributed as a wheel...

jmarshall commented 3 years ago

The header in the error message is <strings.h>, not <string.h>.

Compiling this code requires a set of POSIX headers, including <strings.h>, <sys/types.h>, and <unistd.h>. On Windows, the advice from the htslib developers would be to use Cygwin or MinGW.