Skip to content

Setup doesn't search Visual Studio directories for libraries and includes #101

@Novare

Description

@Novare

If you try to compile pytorch_scatter under Windows you will run into multiple issues regarding missing includes and libraries that come with your Visual Studio installation. The best solution to this would be to make the setup also search the common paths for Visual Studio installations like it does the Windows SDK (in my case C:\Program Files (x86)\Windows Kits...).

To fix include issues it is possible to add further include directories in the setup.py file as "cxx_extra_compile_args" or "nvcc_extra_compile_args" using the "-I{INCLUDE_PATH}" parameter. For future users running into this issue, an entry in the README to consider this would be really helpful.

To fix library (i.e. linker) issues right now one needs to copy the needed .lib files to one of the paths the setup actually looks at. I don't know about any way to add further library paths that works. I tried using /link /LIBPATH:{LIB_DIRECTORY} in the compiler args like the Microsoft documentation suggests, but that didn't work - the linker simply didn't get the additional parameters. I also could not find any helpful environment variables that I could change to add linker paths.

In my case I was missing msvcrt.lib (iirc). Copying the content of the Visual Studio lib directory to my Python lib directory fixed the issue, but that is really hacky and should be avoided.

Since it might be too difficult to automatically find a fitting Visual Studio installation and get the proper paths, I'd be fine with an additional option in the setup.py to add library paths for the linker (basically cxx_extra_link_args), and an entry in the README that tells you to add your Visual Studio paths if you're on Windows.

I'd like to add this functionality (and the documentation) myself, but I don't know anything about how the setup code works and how to do this. If anyone knows how to modify/extend the linker parameters used by the setup (i.e. the parameters given to link.exe or the respective Mac/Linux linkers) like the compile args change the parameters given to cl.exe, that would already help out a lot.

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions