-
Notifications
You must be signed in to change notification settings - Fork 749
Setup.py fails with /langversion error #521
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
Comments
For now go to appveyor builds, select your specific Python version and architecture, then download the wheel for your version from artifacts tab: https://ci.appveyor.com/project/pythonnet/pythonnet/branch/master |
Another way is to switch your system locale/language to US-EN and try again. There was a similar issue due to unmanaged exports dependency. |
@denfromufa I installed the wheel and tarball from https://ci.appveyor.com/project/pythonnet/pythonnet/branch/master/job/5ba22b2mit2p2y3r/artifacts after running the following commands and identifying my Python version and architecture: PS C:\Python35\Lib\site-packages> python -V
After uninstalling the existing pythonnet files, I did the following: PS C:\projects\pythonnet> pip install .\pythonnet-2.4.0.dev0-cp35-cp35m-win32.whl PS C:\projects> tar -xvf .\pythonnet-2.4.0.dev0.tar.gz PS C:\Python35\Lib\site-packages> cd .\pythonnet-2.4.0.dev0 However, I still get this error:
I also confirmed in my settings that my system language is already US-EN. Any thoughts? |
@shahwill why are you installing both wheel and tarball? Just install the wheel. In fact I did not even mention tarball, because it is almost the same as the source code! |
@shahwill regarding your langversion issue when compiling from source (if you still plan to build from source), the Microsoft.CodeDom.Providers.DotNetCompilerPlatform DLL may need to be updated from nuget: |
@denfromufa you're completely right, I didn't see the Python.Runtime.DLL after installing from wheel and thought I had to install the tarball as well. After adding a reference to the Runtime DLL generated by the wheel from the appveyor build, my Visual Studio project ran without any exceptions. Thanks for the help! |
@shahwill thanks for using pythonnet, closing since issue is resolved! |
@shahwill don't forget to star the repo on github 🥇 |
Environment
Details
Nuget installation attempt
I created a C# Console Executable Project in Visual Studio 2017 and added the 2.3.0 version of pythonnet to the project via Nuget.
I fixed the badimageformatting error by switching CPU configuration to x86
I changed the reference for Python.Runtime.DLL to point to /PythonLocation/Lib/site-packages/Python.Runtime.DLL (which I lifted from /VS17App/packages/pythonnet_py35_dotnet2.3.0/lib/net40/Python.Runtime.DLL after the package was installed)
When I run the console executable in VS with a simple line of code
using (Py.GIL()) {}
, I obtain the following error in VS:Managed Debugging Assistant 'PInvokeStackImbalance' : 'A call to PInvoke function 'Python.Runtime!Python.Runtime.Runtime::PyImport_ImportModule' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.'
This is the same error referenced in #485 but referencing that runtime DLL does nothing.
Source code installation attempt
I also tried installing from source by cloning the 2.3.0 source into code /PythonLocation/Lib/site-packages/ and running the following command in powershell:
python.exe .\setup.py bdist_wheel
This results in the following error stack trace:
Pip installation attempt
I've also tried installing via pip (pip install git+https://github.com/pythonnet/pythonnet -U --force) but that gives the same error as the one mentioned above for the source code.
Summary
I've been stuck on this for days and can't seem to be able to install pythonnet in any way. It seems like it's a C# compiler issue based on my research but I can't seem to figure it out. Any help would be appreciated! Thanks!
The text was updated successfully, but these errors were encountered: