Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: MFC redist DLLs not found like (looking for mfc140u.dll) #2244

Closed
andreabravetti opened this issue Apr 12, 2024 · 2 comments
Closed

Comments

@andreabravetti
Copy link
Contributor

andreabravetti commented Apr 12, 2024

Expected behavior and actual behavior

It should find mfc140u.dll in the correct path but it fail with:

RuntimeError: MFC redist DLLs not found like ['C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\redist\x64\MFC\mfc140u.dll', 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Redist\MSVC\14.39.33519\x64\\mfc140u.dll']!

Steps to reproduce the problem

Install Build Tools with Microsoft.VisualStudio.Component.VC.ATLMFC:

I used:

vs_buildtools.exe --quiet --wait --norestart --nocache \
    --add Microsoft.VisualStudio.Workload.VCTools \
    --add Microsoft.VisualStudio.Component.VC.CoreBuildTools \
    --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \
    --add Microsoft.VisualStudio.Component.VC.Redist.14.Latest \
    --add Microsoft.VisualStudio.Component.VC.CMake.Project \
    --add Microsoft.VisualStudio.Component.VC.ATLMFC \
    --add Microsoft.VisualStudio.Component.TestTools.BuildTools \
    --add Microsoft.VisualStudio.Component.VC.Tools.ARM64 \
    --add Microsoft.VisualStudio.Component.Windows10SDK \
    --add Microsoft.VisualStudio.Component.Windows11SDK.22621

The redist is installed but it is in 14.38.33135 and not 14.39.33519.

Everything is installed with the latest vs_buildtools_2022.exe as of today.

Tools are in:

C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519

Redists are in:

C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Redist\MSVC\14.38.33135

It seems it take the version from the Tools to build the path for the Redist but no packages provides this version of the redist, at least as I know.

If I remove Microsoft.VisualStudio.Component.VC.ATLMFC the build is successful, but I need it for other things.

I use to build pywin32 with:

call C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Auxiliary/Build/vcvars64.bat
python.exe setup.py -q build
python.exe setup.py -q --skip-verstamp install

System information

Python version and distribution: 3.11.9 built on the same system

pywin32 version: 306 (tags/b306.tar.gz)

Windows Version: mcr.microsoft.com/windows/servercore:ltsc2022 (docker)

@andreabravetti
Copy link
Contributor Author

andreabravetti commented Apr 14, 2024

I have a fix here:

ba45f1c

It works in my case but I will wait for some feedback before making a pull request.

Also I'm starting thinking that in the case you have a lot of redist installed it may be better to get the last version with at least the same major version from vcverdir (in this case 14.* instead of *....)

@staer
Copy link

staer commented Apr 19, 2024

this fix works for me. In my case the redist version was behind my VC version and was unable to be found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants