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

numpy not working in iframe context #54

Closed
bcolloran opened this issue Jun 20, 2018 · 3 comments
Closed

numpy not working in iframe context #54

bcolloran opened this issue Jun 20, 2018 · 3 comments

Comments

@bcolloran
Copy link

@mdboom -- this is probably a no-op for now; i will supply additional details when the iframe branch is a bit further along

but for reference (and also for @hamilton) in the iframe-2 branch, when i load
http://localhost:8888/dev/iodide.editor.dev.html?url=https://iodide.io/pyodide-demo/data-club-demo-2018-05-29.html
and execute cell-by-cell, all the base python demo stuff works as expected, and when i run pyodide.loadPackage('numpy') i ge the expected "loaded numpy" message; but when i try to run the numpy sine wave cell, i get:

Error: Traceback (most recent call last):
  File "/lib/python3.6/site-packages/numpy/core/__init__.py", line 16, in <module>
    from . import multiarray
ImportError: Could not evaluate dynamic lib: /lib/python3.6/site-packages/numpy/core/multiarray.so
RangeError: WebAssembly.Compile is disallowed on the main thread, if the buffer size is larger than 4KB. Use WebAssembly.compile, or compile on a worker thread.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/lib/python3.6/site-packages/numpy/__init__.py", line 142, in <module>
    from . import add_newdocs
  File "/lib/python3.6/site-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/lib/python3.6/site-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/lib/python3.6/site-packages/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/lib/python3.6/site-packages/numpy/core/__init__.py", line 26, in <module>
    raise ImportError(msg)
ImportError: 
Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control).  Otherwise reinstall numpy.

Original error was: Could not evaluate dynamic lib: /lib/python3.6/site-packages/numpy/core/multiarray.so
RangeError: WebAssembly.Compile is disallowed on the main thread, if the buffer size is larger than 4KB. Use WebAssembly.compile, or compile on a worker thread.


    at _hiwire_throw_error (https://iodide.io/pyodide-demo/pyodide.asm.js:4:34764)
    at wasm-function[330]:1321
    at wasm-function[333]:621
    at Object.Module.__runPython (https://iodide.io/pyodide-demo/pyodide.asm.js:4:1853747)
    at Object.Module.runPython (https://iodide.io/pyodide-demo/pyodide.asm.js:4:37861)
    at http://localhost:8888/dev/iodide.eval-frame.dev.js:13574:49
    at http://localhost:8888/dev/iodide.eval-frame.dev.js:79279:18
    at dispatch (http://localhost:8888/dev/iodide.eval-frame.dev.js:52298:18)
    at evaluationQueue.then (http://localhost:8888/dev/iodide.eval-frame.dev.js:13732:52)

no need to worry about this just yet, when i have a sharable link to that branch i'll update this thread (of course, you're always welcome to check out iframe-2 and poke around if you're curious, but it's still in rough shape for now)

@mdboom
Copy link
Collaborator

mdboom commented Jun 20, 2018

Is this on Chrome? If so, I think it's an instance of #28, and should be resolved by emscripten-core/emscripten#6663. If not Chrome, this is a new one for Firefox and must be iframe-specific, though it should hopefully be resolvable in the same way.

@mdboom mdboom mentioned this issue Jun 20, 2018
@bcolloran
Copy link
Author

ah! yes, tremendous -- i forgot we still had that chrome bug. Works in the iframe on FF. woot!

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

2 participants