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

Missing DLL #176

Open
SecT0uch opened this issue Feb 5, 2019 · 12 comments
Open

Missing DLL #176

SecT0uch opened this issue Feb 5, 2019 · 12 comments

Comments

@SecT0uch
Copy link

SecT0uch commented Feb 5, 2019

For Python 3.7+ with a vanilla updated Windows10, vcruntime140.dll is needed.

The check is made on ucrtbase.dll in System32.
Would it be possible to check on SysWOW64\vcruntime.dll for 32 bits and System32\vcruntime.dll for 64 bits and add the missing DLL from Visual C++ Redistributable for Visual Studio 2015 in the corresponding directory.

This would ensure a compatibility for Python 3.7+

@takluyver
Copy link
Owner

@zooba does the above make sense to you? I thought the C runtime had reached a point where we wouldn't need to change how we were handling it any more?

@SecT0uch SecT0uch changed the title MIssing DLL Missing DLL Feb 5, 2019
@SecT0uch
Copy link
Author

SecT0uch commented Feb 5, 2019

I would like to add that previous versions of python don't need this dll

@zooba
Copy link

zooba commented Feb 5, 2019

VCRuntime140.dll is needed, mostly because extension modules need to use the same one so we can't statically link it (it contains shared state). It's also not versioned the same as ucrtbase, and is not itself part of Windows.

However, it's very small. Including it unconditionally shouldn't hurt, but if the VCRedist has been installed there will already be some copy of it on the system. For Python I decided keeping that one applocal made the most sense.

@takluyver
Copy link
Owner

Thanks! I'm still curious about:

  1. What changed from Python 3.6 to 3.7 in that regard?
  2. Are you saying this file is needed even if ucrtbase is already present on the system? I.e. it's not subject to the same check we already have for installing other msvcrt files:

; Install MSVCRT if it's not already on the system
IfFileExists "$SYSDIR\ucrtbase.dll" skip_msvcrt

  1. Where can we get a copy of this file?
  2. Should we expect the necessary files to change again with future versions of Python?

@zooba
Copy link

zooba commented Feb 5, 2019

  1. Nothing, as far as I know. There was a brief bug where it wasn't being included, but I fixed that (I think it was during a 3.7 rc?). It's never been included with the embedded distro
  2. Basically, yeah. Just include it along with python3x.dll
  3. Comes with MSVC - mine is at C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Redist\MSVC\14.16.27012\x64\Microsoft.VC141.CRT
  4. Eventually this one may change, I assume to vcruntime150.dll. But that's in some unpredictable future, and the MSVC team is trying very hard to avoid needing that kind of breaking change. (Put another way, I expect there to be other bigger changes before this one hits :) )

@takluyver
Copy link
Owner

Would it be possible to ship the necessary DLLs along with the embedded Python distribution? Either included in it, or as a separate bundle alongside each Python release?

I'm grateful for your attempts to explain this to me, but from my perspective it's still a mysterious set of binary blobs I have to cobble together from somewhere, and then everybody who runs a Pynsist-built installer implicitly trusts me and whatever system I got those files off. And I'm not at all sure whether distributing them like this really complies with the license.

The DLLs are, in some situations, an absolute requirement for running Python, but they depend on the OS and the installed updates in ways I don't really understand, and I can't predict when they will change. They're the biggest headache in maintaining Pynsist.

I'd love to see a flavour of the embedded distro which contains everything needed to run Python on any recent Windows platform, regardless of what else is installed on the system. So long as this doesn't exist, I'm effectively trying to maintain the same thing as part of Pynsist. And I'm a Python programmer who works in Linux 99% of the time. I don't have the knowledge to do this well, and it's not a problem that I find interesting.

@mentaal
Copy link

mentaal commented May 24, 2019

so just to confirm, pynsist bundles vcruntime140.dll such that the user is not required to install it if it's not present?

@takluyver
Copy link
Owner

It does not. You can see the list of bundled files here:

https://github.com/takluyver/pynsist/tree/master/nsist/msvcrt/x64

And the snippet that decides whether to install them here:

https://github.com/takluyver/pynsist/blob/master/nsist/pyapp_msvcrt.nsi

@mentaal
Copy link

mentaal commented May 24, 2019

Thanks for the clarification. It seems that without the bundling of this file, A user of pynsist will also need to bundle and run the redist package for the runtime. I don't understand why this file should be omitted from the list you mention. (Not being snarky, I know even less than you do about this and I'm just trying to understand what the best method of packaging a library is).

@takluyver
Copy link
Owner

I'm not saying that it shouldn't be bundled. Just that it's not at the moment, and I don't plan to do it. ;-)

I've got tired of trying to deal with the C-runtime part. There are lots of interesting challenges in Pynsist: finding Python packages, templating the NSIS script files, working out how to record errors, even how to test parts of it. The C runtime is not interesting. It's some opaque stuff that has to be done to make Python work on some computers, but I don't know whether I'm doing it correctly or when it might need changing. I'm not even sure whether distributing the DLLs with Pynsist is really allowed by whatever license agreement they're governed by.

So from now on, I'm leaving that as a problem for someone else to solve. My ideal answer would be for Python.org to provide the necessary runtime alongside the 'embeddable' Python build, but no-one seems to be pushing for that.

I'm happy in principle to accept PRs, but since I can't audit binary blobs, I'll only accept PRs to add/replace DLLs from people I already know well.

@mentaal
Copy link

mentaal commented May 24, 2019

No problem, that makes sense, thanks!

@takluyver
Copy link
Owner

Thanks for being understanding about my tantrum 😛

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

4 participants