Skip to content

Import Numpy with Latest Build #22

Closed
@Lingfeng158

Description

@Lingfeng158

I read comments from some of the previous issues, and tried to import numpy module.
Version of Unity 2018.4, Windows
Here are steps that I took:

  1. Install Anaconda, & install virtual environment with python 2.7
  2. Install numpy in python 2.7 environment
  3. Find the path of python 2.7 libs and add line paths.Add('path_to_lib\\lib'); in examples/pythonlibrary
  4. Step 3 gave error and I deleted the line added in step 3
  5. I tried copy related folders in libs (all mkl folders & folders with numpy in it) to Python/Libs in the project

Problem encountered:
Both 3 and 4 gives same error:

ImportException: 

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
Here is how to proceed:
- If you're working with a numpy git repository, try `git clean -xdf`
  (removes all files not under version control) and rebuild numpy.
- If you are simply trying to use the numpy version that you have installed:
  your installation is broken - please reinstall numpy.
- If you have already reinstalled and that did not fix the problem, then:
  1. Check that you are using the Python you expect (you're using None),
     and that you have no directories in your PATH or PYTHONPATH that can
     interfere with the Python and numpy versions you're trying to use.
  2. If (1) looks fine, you can open a new issue at
     https://github.com/numpy/numpy/issues.  Please include details on:
     - how you installed Python
     - how you installed numpy
     - your operating system
     - whether or not you have multiple versions of Python installed
     - if you built from source, your compiler versions and ideally a build log

     Note: this error has many possible causes, so please don't comment on
     an existing issue about this - open a new one instead.

Original error was: cannot import _multiarray_umath from numpy.core

Microsoft.Scripting.Runtime.LightExceptions.ThrowException (Microsoft.Scripting.Runtime.LightExceptions+LightException lightEx) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
Microsoft.Scripting.Runtime.LightExceptions.CheckAndThrow (System.Object value) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
Microsoft.Scripting.Interpreter.FuncCallInstruction`2[T0,TRet].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
Microsoft.Scripting.Interpreter.Interpreter.HandleException (Microsoft.Scripting.Interpreter.InterpretedFrame frame, System.Exception exception) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet] (T0 arg0) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
IronPython.Compiler.RuntimeScriptCode.InvokeTarget (Microsoft.Scripting.Runtime.Scope scope) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Compiler.RuntimeScriptCode.Run (Microsoft.Scripting.Runtime.Scope scope) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.PythonContext.InitializeModule (System.String fileName, IronPython.Runtime.ModuleContext moduleContext, Microsoft.Scripting.ScriptCode scriptCode, IronPython.Runtime.ModuleOptions options) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.PythonContext.CompileModule (System.String fileName, System.String moduleName, Microsoft.Scripting.SourceUnit sourceCode, IronPython.Runtime.ModuleOptions options, Microsoft.Scripting.ScriptCode& scriptCode) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.PythonContext.CompileModule (System.String fileName, System.String moduleName, Microsoft.Scripting.SourceUnit sourceCode, IronPython.Runtime.ModuleOptions options) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.LoadFromSourceUnit (IronPython.Runtime.CodeContext context, Microsoft.Scripting.SourceUnit sourceCode, System.String name, System.String path) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.LoadModuleFromSource (IronPython.Runtime.CodeContext context, System.String name, System.String path) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.LoadPackageFromSource (IronPython.Runtime.CodeContext context, System.String name, System.String path) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.LoadFromDisk (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, System.String str) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.ImportFromPathHook (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, IronPython.Runtime.List path, System.Func`5[T1,T2,T3,T4,TResult] defaultLoader) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.ImportFromPath (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, IronPython.Runtime.List path) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.ImportNestedModule (IronPython.Runtime.CodeContext context, IronPython.Runtime.PythonModule module, System.String[] parts, System.Int32 current, IronPython.Runtime.List path) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.ImportFrom (IronPython.Runtime.CodeContext context, System.Object from, System.String name) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Operations.PythonOps.ImportFrom (IronPython.Runtime.CodeContext context, System.Object module, System.String name) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
Microsoft.Scripting.Interpreter.FuncCallInstruction`4[T0,T1,T2,TRet].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet] (T0 arg0) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
IronPython.Compiler.RuntimeScriptCode.InvokeTarget (Microsoft.Scripting.Runtime.Scope scope) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Compiler.RuntimeScriptCode.Run (Microsoft.Scripting.Runtime.Scope scope) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.PythonContext.InitializeModule (System.String fileName, IronPython.Runtime.ModuleContext moduleContext, Microsoft.Scripting.ScriptCode scriptCode, IronPython.Runtime.ModuleOptions options) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.PythonContext.CompileModule (System.String fileName, System.String moduleName, Microsoft.Scripting.SourceUnit sourceCode, IronPython.Runtime.ModuleOptions options, Microsoft.Scripting.ScriptCode& scriptCode) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.PythonContext.CompileModule (System.String fileName, System.String moduleName, Microsoft.Scripting.SourceUnit sourceCode, IronPython.Runtime.ModuleOptions options) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.LoadFromSourceUnit (IronPython.Runtime.CodeContext context, Microsoft.Scripting.SourceUnit sourceCode, System.String name, System.String path) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.LoadModuleFromSource (IronPython.Runtime.CodeContext context, System.String name, System.String path) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.LoadPackageFromSource (IronPython.Runtime.CodeContext context, System.String name, System.String path) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.LoadFromDisk (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, System.String str) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.ImportFromPathHook (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, IronPython.Runtime.List path, System.Func`5[T1,T2,T3,T4,TResult] defaultLoader) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.ImportFromPath (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, IronPython.Runtime.List path) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.ImportTopAbsolute (IronPython.Runtime.CodeContext context, System.String name) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.ImportModule (IronPython.Runtime.CodeContext context, System.Object globals, System.String modName, System.Boolean bottom, System.Int32 level) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Modules.Builtin.__import__ (IronPython.Runtime.CodeContext context, System.String name, System.Object globals, System.Object locals, System.Object fromlist, System.Int32 level) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
Microsoft.Scripting.Interpreter.FuncCallInstruction`7[T0,T1,T2,T3,T4,T5,TRet].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
Microsoft.Scripting.Interpreter.LightLambda.Run7[T0,T1,T2,T3,T4,T5,T6,TRet] (T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
IronPython.Runtime.Importer.ImportLightThrow (IronPython.Runtime.CodeContext context, System.String fullName, IronPython.Runtime.PythonTuple from, System.Int32 level) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Operations.PythonOps.ImportTop (IronPython.Runtime.CodeContext context, System.String fullName, System.Int32 level) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
Microsoft.Scripting.Interpreter.FuncCallInstruction`4[T0,T1,T2,TRet].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet] (T0 arg0, T1 arg1) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
IronPython.Compiler.PythonScriptCode.RunWorker (IronPython.Runtime.CodeContext ctx) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Compiler.PythonScriptCode.Run (Microsoft.Scripting.Runtime.Scope scope) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Compiler.RuntimeScriptCode.InvokeTarget (Microsoft.Scripting.Runtime.Scope scope) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Compiler.RuntimeScriptCode.Run (Microsoft.Scripting.Runtime.Scope scope) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
Microsoft.Scripting.SourceUnit.Execute (Microsoft.Scripting.Runtime.Scope scope, Microsoft.Scripting.ErrorSink errorSink) (at <b4854a677cbc408eadacd3725c486fb1>:0)
Microsoft.Scripting.SourceUnit.Execute (Microsoft.Scripting.Runtime.Scope scope) (at <b4854a677cbc408eadacd3725c486fb1>:0)
Microsoft.Scripting.Hosting.ScriptSource.Execute (Microsoft.Scripting.Hosting.ScriptScope scope) (at <b4854a677cbc408eadacd3725c486fb1>:0)
(wrapper remoting-invoke-with-check) Microsoft.Scripting.Hosting.ScriptSource.Execute(Microsoft.Scripting.Hosting.ScriptScope)
Exodrifter.UnityPython.Examples.PythonLibrary.Start () (at Assets/Python/Examples/PythonLibrary.cs:28)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions