question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cannot open input file '.obj' in build on distutils from Python 3.9

See original GitHub issue

We are currently building binary wheels for Windows under Python 3.7 and 3.8. When attempting to add Python 3.9 to the mix - in both cibuildwheel and directly in a Windows python 3.9 venv - quotes are being omitted around the link call.

I originally reported it in cibuildwheel here - https://github.com/joerick/cibuildwheel/issues/441

Quoting that here: I’m attempting to build wheels on python 3.7, 3.8, and now 3.9.

With recent changes in setuptools a couple of weeks ago I was forced to add: CIBW_ENVIRONMENT_WINDOWS: SETUPTOOLS_USE_DISTUTILS=stdlib

To have the Windows MSVC build for 3.8 correctly put quotes around LIBPATH entries in the link command line. This entry is showing it improperly unquoted: /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.27.29110\ATLMFC\lib\x64

Without the quotes it’s then trying to link from C:\Program Files\ instead of the actual lib directories.

My new attempt to build with python 3.9 gave me this new error: C:\cibw\python\python.3.9.0-rc1\tools\lib\site-packages\setuptools\distutils_patch.py:25: UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools' objects directly or at least import Setuptools first. at - https://github.com/Chia-Network/chiapos/runs/1221477218?check_suite_focus=true#step:13:1697

The unquoted Windows link attempt is here: https://github.com/Chia-Network/chiapos/runs/1221477218?check_suite_focus=true#step:13:1883

Overall run can be found here - https://github.com/Chia-Network/chiapos/runs/1221477218?check_suite_focus=true

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
jaracocommented, Nov 6, 2020

In a8f9d49, I’ve patched the culled repro and the error no longer occurs. Correct me if I’m wrong, but I suspect the use of [""] was intended to mean “no args” but in fact it means “one blank arg”, and now that subprocess.Popen is correctly passing that empty arg to the subprocess, the linker is trying to link a file called ./.obj, which doesn’t exist. Given that the issue was unintended, incorrect usage, I doubt we’ll want to invest time and energy restoring the prior, less-correct behavior in distutils… thought it might make sense for the msvccompiler to error on or remove blank command args if that can be shown to never be valid.

The rendering of the command-line turned out to be a red herring. It’s true that the distutils change did also affect the rendering of the command-line, but that was incidental and generally didn’t affect the behavior. I’ll make a patch to the distutls code to use list2cmdline when rendering the command line for logging to make it more correct.

I’m going to close this as invalid, but please don’t hesitate to comment if making this change in chiapos doesn’t fix the issue.

0reactions
hoffmang9commented, Nov 6, 2020

Thanks for the assist! That’s working solidly and I’ll push it out to our other repos as well. We totally agree that bug for bug compatibility isn’t a good idea…

Read more comments on GitHub >

github_iconTop Results From Across the Web

LINK : fatal error LNK1181: cannot open input file "C:\Program ...
When building it I get this error: LINK : fatal error LNK1181: cannot open input file "C:\Program.obj". I think that this is caused...
Read more >
distutils — Building and installing Python modules — Python ...
The distutils package provides support for building and installing additional modules into a Python installation.
Read more >
SCons 3.0.3
This will build SCons, install the scons script in the python which is used to run the setup.py's scripts directory ( /usr/local/bin or...
Read more >
modulenotfounderror: no module named 'distutilsextra'
$ git clone ; Python 3.9 ; $ ./ · build ; Traceback ; File "/home/werner/Public/repo/github.com/pdfarranger/pdfarranger.git/./setup.py" ...
Read more >
Python – Page 3 - ColinPaice
Posts about Python written by Colin Paice. ... The setup.py file for pure Python ... It cannot be referenced from outside of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found