Open HannahKn123 opened 2 months ago
How exactly did you install numpy? I think there is a specific way in which packages are installed int pyodide https://pyodide.org/en/stable/usage/loading-packages.html
Hello,
thank you for your quick response!
I need to install numpy, since I can not run the generate.sh file without installing numpy. I used poetry install. [cid:d109f0b6-106b-4e58-b466-9b28f58fd33f]
This is where the mistake occurs if numpy is not installed. But after installing numpy with poetry install I can not import numpy in the console at futurecoder homepage.
Thank you!!! Best regards Hannah Knehr
Von: oskarissimus @.> Gesendet: Montag, 2. September 2024 13:41 An: alexmojaki/futurecoder @.> Cc: HannahKn123 @.>; Author @.> Betreff: Re: [alexmojaki/futurecoder] Installing Packages for predicted_output_choices (Issue #482)
How exactly did you install numpy? I think there is a specific way in which packages are installed int pyodide https://pyodide.org/en/stable/usage/loading-packages.html
— Reply to this email directly, view it on GitHubhttps://github.com/alexmojaki/futurecoder/issues/482#issuecomment-2324540161, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BAA3CHEN7Z2YBHUSGIEYY3DZURFGVAVCNFSM6AAAAABNQD2FY2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRUGU2DAMJWGE. You are receiving this because you authored the thread.Message ID: @.***>
I think that installing numpy with poetry won't be enough. Pyodide - the thing that makes python work in browser - has its own packages. See the example below on how dependences are added to pyodide https://github.com/alexmojaki/futurecoder/blob/9198eb2926d5e76dfd5e435afd94e7d487559feb/frontend/src/Worker.js#L40 I might be wrong tho
It's true that you need to load numpy specially within pyodide. Try adding await pyodide.loadPackage("numpy")
here:
But you do also need to install it with poetry and import it to generate static files. And this is the first time that there's a dependency that isn't pure Python and has to be loaded differently in the two environments. Ensure numpy
isn't added to roots
here:
This will prevent it from being added to python_core.tar.load_by_url
so that it should be imported from the pyodide installation.
Hello,
I am experimenting with the code and would like to create a quiz with predicted_output_choices. Part of the quiz should be to initialize a numpy array and the choices should be 4 different arrays a a output.
For this I have to install numpy in the backend. Unfortunately there are problems if I install numpy in the back end, because then I can't install numpy directly in the futurecoder. The following error message appears:
Error traceback: ModuleNotFoundError: No module named 'numpy.core._multiarray_umath' A ModuleNotFoundError exception indicates that you are trying to import a module that cannot be found by Python. This could be because you misspelled the name of the module or because it is not installed on your computer.
No module named numpy.core._multiarray_umath can be imported. Perhaps you need to install it.
Click to expand During handling of the above exception, another exception occurred: 1 import numpy as np ImportError: IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! Importing the numpy C-extensions failed. This error can happen for many reasons, often due to issues with your setup or how NumPy was installed. We have compiled some common reasons and troubleshooting tips at: https://numpy.org/devdocs/user/troubleshooting-importerror.html Please note and check the following: The Python version is: Python3.11 from "/home/pyodide/this.program" The NumPy version is: "1.24.2" and make sure that they are the versions you expect. Please carefully study the documentation linked above for further help. Original error was: No module named 'numpy.core._multiarray_umath'
Does anyone have an idea how I can work around this problem? Thank you!