Skip to content

Conversation

@DerThorsten
Copy link
Contributor

No description provided.

@DerThorsten DerThorsten added the 3.1.73 Emscripten v3.1.73 label Mar 27, 2025
@DerThorsten DerThorsten marked this pull request as ready for review March 28, 2025 13:17
@DerThorsten DerThorsten merged commit b392a6b into emscripten-forge:emscripten-3.1.73 Mar 28, 2025
1 check passed
@hodgestar
Copy link
Contributor

Thanks @DerThorsten !

@hodgestar
Copy link
Contributor

@DerThorsten Do you have some idea of when the emscripten-3.1.73 branch might be merged and packages appear in the forge?

@DerThorsten
Copy link
Contributor Author

DerThorsten commented Mar 29, 2025

@hodgestar the packages are already available, you just need to change the channel to https://repo.prefix.dev/emscripten-forge-dev.
We moved all the packages to https://prefix.dev/channels/emscripten-forge-dev/ (qutip is here)
Soon we will make the 3.1.73 the only branch. But every package from it is already available for use!

For your usecase (I assume) it would be enough to change this line https://github.com/qutip/try-qutip/blob/main/lite/try-qutip-env.yaml#L4

@DerThorsten DerThorsten deleted the qutip branch March 29, 2025 13:56
@hodgestar
Copy link
Contributor

hodgestar commented Mar 29, 2025

Thanks @DerThorsten! I changed the line, and now appear to have a working build. However, importing numpy fails with:

image

Importing the main numpy package works:

image

The numpy version is 2.2.4.

@DerThorsten
Copy link
Contributor Author

DerThorsten commented Mar 30, 2025

@hodgestar this can be fixen by passing the "empack" config to lite (we will fix this soon that you don't have to do this anymore)

The tests of numpy are otherwise filtered out. I can give you a cmd later today, but I am on the phone atm

@DerThorsten
Copy link
Contributor Author

Using the config file from here and the following cmd should work:

EMPACK_CONFIG_PATH=/Users/thorstenbeier/src/recipes/recipes/recipes/pytester/pytester/empack_config.yaml
jupyter lite build --XeusAddon.environment_file=environment.yaml --XeusAddon.empack_config=$EMPACK_CONFIG_PATH

@hodgestar
Copy link
Contributor

Thanks @DerThorsten. I might just wait for the fix if that's okay. Very happy to try it out as soon as its in.

@DerThorsten
Copy link
Contributor Author

Thanks @DerThorsten. I might just wait for the fix if that's okay. Very happy to try it out as soon as its in.

@hodgestar I made a new release of empack (5.0.7).
If you make sure that at least this version is used in the environment which builds jupyterlite, than it should work.
I just gave it a try and import numpy.testing is working as expected

@hodgestar
Copy link
Contributor

hodgestar commented Mar 31, 2025

@DerThorsten I added empack>=5.0.7 and now import numpy.testing succeeds. Big thank you!

My next hurdle is that now import scipy.interpolate fails:

image

Please shout if there is a better place to continue this issue reporting. Here is great for me, but also happy to continue somewhere more convenient for you.

P.S. SciPy verison is 1.14.1:

image

@DerThorsten
Copy link
Contributor Author

mhhh..I can import

import numpy.testing
import scipy.interpolate

without any problems.

Could you post the output of the dev-console? And maybe also the output of the jupyterlite build procedure?

@DerThorsten
Copy link
Contributor Author

@hodgestar we are using zulip and have a public channel there https://quantstack.zulipchat.com/#narrow/channel/482629-Public
You can also ping me there for faster responses

@hodgestar
Copy link
Contributor

Build output: https://github.com/qutip/try-qutip/actions/runs/14170065845/job/39691690281

And dev console output:

image

Will move to Zulip.

@hodgestar
Copy link
Contributor

I need an invitation to access the Zulip server.

@DerThorsten
Copy link
Contributor Author

mhhh, I check if we can make the public channel actually public. Until then we can continue here.

I am trying to debug your deployment. It should be some simple fix since I can locally create working deployments.

@hodgestar
Copy link
Contributor

The deployment is live at https://qutip.org/try-qutip/ in case that is useful.

@DerThorsten
Copy link
Contributor Author

@hodgestar when I try to run via your deployment I see a different error (in the console)

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '44')
    at P.lookup (/try-qutip/extensions/@jupyterlite/xeus-extension/static/78.03ef1110600d818e8f4e.js?v=03ef1110600d818e8f4e:1:51757)
    at Object.lookup (/try-qutip/xeus/bin/xpython.js:9:96512)
    at Object.lookupNode (/try-qutip/xeus/bin/xpython.js:9:91993)
    at Object.lookupPath (/try-qutip/xeus/bin/xpython.js:9:90387)
    at stat (/try-qutip/xeus/bin/xpython.js:9:100803)
    at Object.doStat (/try-qutip/xeus/bin/xpython.js:9:117157)
    at ___syscall_stat64 (/try-qutip/xeus/bin/xpython.js:9:154086)
    at /try-qutip/xeus/bin/xpython.wasm
    at /try-qutip/xeus/bin/xpython.wasm
    at /try-qutip/xeus/bin/xpython.wasm

We (@martinRenou and me) saw this already a couple of time but it should have been fixed...but we are investigating

@DerThorsten
Copy link
Contributor Author

@hodgestar locally I create the qutip deployment via:


WASM_ENV_NAME=qutip-wasm-env
WASM_ENV_PREFIX=$MAMBA_ROOT_PREFIX/envs/$WASM_ENV_NAME


micromamba create -n $WASM_ENV_NAME \
    --platform=emscripten-wasm32 \
    -c /Users/thorstenbeier/src/recipes/output \
    -c conda-forge \
    -c https://repo.prefix.dev/emscripten-forge-dev \
    --yes \
    "python>=3.13" xeus-python qutip pytest



rm -rf deploy
mkdir -p deploy
cd deploy

jupyter lite build --XeusAddon.prefix=$WASM_ENV_PREFIX

and this seems to work without any problems

@DerThorsten
Copy link
Contributor Author

@hodgestar I think I know the problem.
When matplotlib is in the env, scipys qhull clashes with matplotlibs qhull library.
I am working on a fix

@DerThorsten
Copy link
Contributor Author

So the problem is the following, both matplotlib and scipy compile a *.so with the name _qhull.cpython-313-wasm32-emscripten.soand there was a bug in our loading-shared-library logic st. only one of these will be loaded.
We already have a fix for it, but its not yet released ( emscripten-forge/mambajs#57)

I hope this will be released in the next days.
@hodgestar thanks for your patience =)

@DerThorsten
Copy link
Contributor Author

@hodgestar Using jupyterlite-xeus>=3.1.6 is fixing the problem. Thanks @martinRenou for the release!
Here is a deployment with qutip and matplotlib (and other) and it seems to just work fine

https://derthorsten.github.io/xeus-python-3.13-demo/lab/index.html
https://github.com/DerThorsten/xeus-python-3.13-demo

@hodgestar
Copy link
Contributor

Thank you @DerThorsten and @martinRenou! I rebuilt with the new jupyterlite-xeus and now it works perfectly in my build too.

A couple of small niggles:

  • Are entry points supported in the Jupyterlite builds? I can import qutip.qip but it doesn't show up in the list of family packages when calling qutip.about() which is populated by entrypoints? This is an unimportant niggle for my purposes. No important functionality is affected, but I'm curious.

  • I see the following errors in the dev console. Nothing seems broken, but I thought I'd check if any are important:

image

@DerThorsten
Copy link
Contributor Author

@hodgestar entry-points should now also work for pip-installed packages (with empack >= 5.0.9)

with that I get the following in my deployment

[...]

Installed QuTiP family packages
-------------------------------

qutip-qtrl: 0.1.5

[...]

@hodgestar
Copy link
Contributor

It works for me too. Thanks! :D

This was referenced Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.1.73 Emscripten v3.1.73

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants