This project has moved. For the latest updates, please go here.
6

Closed

2.7.2.1 "load language" problem

description

If I try to run console or from C# code from tutorial I got this error:
 
Failed to load language 'PythonContext': Method not found: '!!1[]Microsoft.Scripting.Utils.ArrayUtils.ConvertAll(!!0[], System.Func`2<!!0,!!1>)'.
 
I have Windows 7 32bit.
Closed Dec 6, 2014 at 9:16 PM by jdhardy

comments

slide_o_mix wrote Mar 18, 2012 at 9:46 PM

Which tutorial?

Snake38 wrote Mar 18, 2012 at 9:51 PM

From documentation - "Hosting IronPython".
With this code:

var engine = Python.CreateEngine();
engine.CreateScriptSourceFromString("print 'hello world'").Execute();

But I can't run IronPY at all.

From "cmd":
C:\Users\Snake38\Downloads\IronPython-2.7.2.1\IronPython-2.7.2.1>ipy.exe
Failed to load language 'PythonContext': Method not found: '!!1[] Microsoft.Scri
pting.Utils.ArrayUtils.ConvertAll(!!0[], System.Func`2<!!0,!!1>)'.

slide_o_mix wrote Mar 18, 2012 at 11:45 PM

How did in you install? I've never seen this issue on several computers. Which .NET version do you have installed?

Snake38 wrote Mar 19, 2012 at 12:12 AM

.NET Framework 4.0 and I use this by download "bin" package.

Older versions (before 2.7) are seems to works properly.

slide_o_mix wrote Mar 19, 2012 at 2:21 AM

Anything special with your setup? Different locale? Can you take a screenshot?

jdhardy wrote Mar 19, 2012 at 4:53 PM

I've seen that before when specifying the languages to load in an app.config file. Can you post the contents of ipy.exe.config?

Snake38 wrote Mar 20, 2012 at 1:19 PM

My ipy.exe.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<!-- Enable mixed-mode CLRv2 assemblies. --> <startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" />
</startup>

<runtime>
<!-- Enable loading assemblies from network shares or downloaded from the internet. -->
<loadFromRemoteSources enabled="true"/>
</runtime>
</configuration>

http://i.imgur.com/lzFyQ.png

I have Polish version of system.

becio wrote Mar 23, 2012 at 2:22 AM

OMG, I just got the same error!

I installed the .msi and I have changed nothing. Both ipy.exe and ipy64.exe do not work.

I have the same bug reported by Snake38 - missing method on Microsoft.Scripting.Utils.ArrayUtils::Concatenate<T>

I thought it was a mismatch in dlls, so I used ILSpy to inspect the assembly and that class, this is what I got:

ICSharpCode.Decompiler.DecompilerException: Error decompiling T[0...,0...] Microsoft.Scripting.Utils.ArrayUtils::Concatenate(T[0...,0...],T[0...,0...])
---> System.InvalidCastException: Unable to cast object of type 'Mono.Cecil.MethodReference' to type 'Mono.Cecil.GenericInstanceMethod'.
at ICSharpCode.Decompiler.ILAst.TypeAnalysis.SubstituteTypeArgs(TypeReference type, MemberReference member)
at ICSharpCode.Decompiler.ILAst.TypeAnalysis.DoInferTypeForExpression(ILExpression expr, TypeReference expectedType, Boolean forceInferChildren)
at ICSharpCode.Decompiler.ILAst.TypeAnalysis.RunInference(ILExpression expr)
at ICSharpCode.Decompiler.ILAst.TypeAnalysis.RunInference()
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, ILAstOptimizationStep abortBeforeStep)
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable1 parameters, ConcurrentDictionary2 localVariables)
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDefinition methodDef, DecompilerContext context, IEnumerable1 parameters, ConcurrentDictionary2 localVariables)
--- End of inner exception stack trace ---
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDefinition methodDef, DecompilerContext context, IEnumerable1 parameters, ConcurrentDictionary2 localVariables)
at ICSharpCode.Decompiler.Ast.AstBuilder.CreateMethod(MethodDefinition methodDef)
at ICSharpCode.Decompiler.Ast.AstBuilder.AddTypeMembers(TypeDeclaration astType, TypeDefinition typeDef)
at ICSharpCode.Decompiler.Ast.AstBuilder.CreateType(TypeDefinition typeDef)
at ICSharpCode.ILSpy.CSharpLanguage.DecompileType(TypeDefinition type, ITextOutput output, DecompilationOptions options)
at ICSharpCode.ILSpy.TextView.DecompilerTextView.DecompileNodes(DecompilationContext context, ITextOutput textOutput)
at ICSharpCode.ILSpy.TextView.DecompilerTextView.<>c__DisplayClass13.<DecompileAsync>b__12()

An exception decompiling the class, at least to c# target.

I have net4, locale it-IT, 64bit Seven.

I'm curious to download the source code and rebuild it.

wrote Mar 23, 2012 at 2:23 AM

becio wrote Mar 23, 2012 at 3:34 AM

I have a suspect.

In my system I have a previous version of IronPython registered into GAC, now I have uninstalled the latest version but I still see registered version 1.1.0.0 of IronPython.dll

Since dll are strong signed, probably the runtime tries to search for the assembly first into the GAC, and here probably it matches the wrong dll causing that exception.

I put it there, without any check.

jdhardy wrote Mar 23, 2012 at 5:26 PM

becio, what other version(s) of IronPython do you have installed? If you remove that entry from the gac, does it work? Strong naming should prevent old assemblies from being loaded.

Snake38, do you have any other version of IronPython installed? Are there any IronPython assemblies in the GAC ("gacutil -l" should tell you).

becio wrote Mar 23, 2012 at 6:18 PM

IronPython.dll version: 1.1.0.0 language=neutral token=31bf3856ad364e35

I don't remember now why it is there and I can't find any installation package that I think it could have register it. It's not easy to manually unregister a component from GAC on Seven, but I'll try.

wrote Mar 25, 2012 at 12:27 AM

jdhardy wrote Mar 26, 2012 at 4:09 AM

Do you have IronRuby installed by any chance? Which versions?

MarkusSchaber wrote Mar 26, 2012 at 6:48 AM

IronRuby or any other package which comes with IronPython.

If you don't find a clean way to uninstall the DLLs, try to get an unrestricted administrator shell, and delete/move/rename the dll file inside your GACs directory tree. (It is an unclean way which may break some other things, but it works to ensure that a certain DLL is not in the GAC any more.)

eblumenfeld wrote Mar 28, 2012 at 3:06 AM

I'm having the same issue...
In the GAC I have both IronRuby and IronPython
Could be possible that the issue has to do with Microsoft.Dynamic and Microsoft.Scripting dll's, that may be in common between both languages in my case (Win 7) in the GAC the ones that are there date from IronRuby install...

wrote Mar 28, 2012 at 7:52 AM

becio wrote Mar 30, 2012 at 2:50 PM

I uninstalled IronRuby then installed again this package and all things went ok.

DLL hell is still here, please check the strong names of incompatible dlls.

wrote Mar 30, 2012 at 8:59 PM

Snake38 wrote Apr 3, 2012 at 9:48 PM

"I uninstalled IronRuby then installed again this package and all things went ok. "

Wow! For me it's working too! Thanks!

Thanks for help ;)

slide_o_mix wrote Apr 3, 2012 at 10:04 PM

What version of IronRuby did you have installed?

becio wrote Apr 5, 2012 at 1:18 AM

I think it was 1.1.0.0 the same as the IronPython version that I still have registered, but I'm not sure.

Snake38 wrote Apr 5, 2012 at 1:22 PM

IronRuby 1.1.3

eblumenfeld wrote Apr 6, 2012 at 1:40 AM

Today I uninstalled IronRuby 1.1.3, installed IronPython 2.7.1, and installed IronRuby 1.1.3 again
Found out that both interpreters were working:
ipy and ir

However, when I tried to install gems in IronRuby (igem) I got the same error we are discussing in this thread:
Microsoft.Scripting.Utils.ArrayUtils.ConvertAll .....
(in this case from the IronRuby Side...)

Regards,
Eduardo

eblumenfeld wrote Apr 6, 2012 at 1:41 AM

Forgot to mention that the box was XP Pro 32 bits

wrote Apr 13, 2012 at 1:33 AM

wrote Apr 29, 2012 at 8:31 AM

jdhardy wrote Jun 30, 2012 at 6:38 AM

This is fixed in 2.7.3.

wrote Feb 22, 2013 at 2:09 AM

wrote May 16, 2013 at 1:03 PM

wrote May 16, 2013 at 1:03 PM

wrote Jun 14, 2013 at 8:34 AM

wrote Dec 6, 2014 at 9:16 PM