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

WIP: Add a manifest file for the sake of dlopening Python extensions on Windows #16442

Merged
merged 1 commit into from
May 26, 2016

Conversation

tkelman
Copy link
Contributor

@tkelman tkelman commented May 19, 2016

fixes JuliaPy/PyCall.jl#87, cc @stevengj @AndyGreenwell @ihnorton

This needs some testing. I may need to use a different manifest on 32 bit, and I should probably also test against Python 3.x to see what happens there.

tkelman added a commit that referenced this pull request May 19, 2016
@ihnorton
Copy link
Member

Nice work. Are we actually missing the manifest, or is this a work-around for Python not doing the right thing?

@stevengj
Copy link
Member

@ihnorton, both. It seems like the manifest is something we should generically be including, although some of the Python modules could also potentially load libraries in a more robust way.

@tkelman
Copy link
Contributor Author

tkelman commented May 19, 2016

We don't need the manifest because we don't use the versioned msvcrt or side by side assemblies. Python does some activation context stuff to deal with this, but they incorrectly leave the manifest out when they build .pyd files and load them with ctypes. So programs built against a different c runtime than python need to jump through otherwise unnecessary hoops.

@tkelman
Copy link
Contributor Author

tkelman commented May 26, 2016

It looks like this also fixes things on 32 bit Python 2.7, and this issue isn't present for Python 3(.5?).

@tkelman
Copy link
Contributor Author

tkelman commented Jun 25, 2016

Apparently this has been causing problems for people on 0.4.6 who don't have the msvc runtimes already installed. I think the thing to do is build a second julia-manifest.exe (open to better names) that has this included for PyCall users to run, but not include it in the default julia.exe.

@stevengj
Copy link
Member

@tkelman, could you clarify the problems on 0.4.6? How could the necessary runtime not be installed? Don't we need an crt library to run julia?

@tkelman
Copy link
Contributor Author

tkelman commented Jun 27, 2016

We need the unversioned msvcrt.dll which comes pre-installed on Windows. msvcr90.dll, which Python 2.7 needs, does not. Many people will already have a copy somewhere from some other program (especially if you've installed a copy of python), but not everyone.

@stevengj
Copy link
Member

But doesn't the manifest specify the unversioned one? Or if we want to specify the versioned one, shouldn't we ship it with Julia? I'm still confused about what exactly the manifest does.

@tkelman
Copy link
Contributor Author

tkelman commented Jun 27, 2016

The manifest specifies the versioned one. ctypes in Python doesn't properly set up the "activation context" when loading pyd files for extension modules, it assumes the versioned msvc runtime is already loaded in the process (usually by Python itself). Julia doesn't set up the activation context for the versioned runtime, unless we add this manifest - but apparently the manifest also adds a dependency on the versioned runtime. We can't ship the versioned MSVC runtime because it isn't GPL compatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
system:windows Affects only Windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pyimport results in Runtime Error
3 participants