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

Should it be possible to import ssl? #32

Open
sggaffney opened this issue Dec 4, 2023 · 7 comments
Open

Should it be possible to import ssl? #32

sggaffney opened this issue Dec 4, 2023 · 7 comments

Comments

@sggaffney
Copy link

A package that I'd like to use imports 'ssl'. Could you please advise if there is any way to make this available to a zeus-python kernel in jupyterlite? When I run import ssl in the demo notebook (https://jupyterlite.github.io/xeus-python-demo/retro/notebooks/?path=demo.ipynb), the traceback includes:

File /lib/python3.10/ssl.py:98
95 from collections import namedtuple
96 from enum import Enum as _Enum, IntEnum as _IntEnum, IntFlag as _IntFlag
---> 98 import _ssl # if we can't import it, let the error propagate
100 from _ssl import OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_INFO, OPENSSL_VERSION
101 from _ssl import _SSLContext, MemoryBIO, SSLSession
ModuleNotFoundError: No module named '_ssl'

I've tried adding openssl to dependencies in the environment.yml file, but get the same result (and it breaks the rule of having a 'noarch' version').

@martinRenou
Copy link
Member

cc. @DerThorsten who may know

@DerThorsten
Copy link

File /lib/python3.10/ssl.py:98

Not sure, but this is on a very old stack, and the python3.11 build has some more features.

@martinRenou
Copy link
Member

@sggaffney are you able to try jupyterlite-xeus-python v1.0.0a3?

@sggaffney
Copy link
Author

Thank you for the suggestion. I've just tried that and get the same error when I run jupyter lite serve in an empty directory and run import ssl in a new notebook. (File /lib/python3.11/ssl.py:100, ModuleNotFoundError: No module named '_ssl')

My environment file, for reference, was:

name: build-env
channels:
  - conda-forge
dependencies:
  - python  # resolved to v3.12.0
  - pip
  - jupyter_server  # resolved to v2.11.2
  - jupyterlite-core  # resolved to v0.2.1
  - pip
  - pip:
    - --pre
    - jupyterlite-xeus-python==1.0.0a3

I'm using an arm64 Mac, fyi. The jupyter lite build/serve step installed:

asttokens                 2.4.1  conda-forge/noarch
backcall                  0.2.0  conda-forge/noarch
decorator                 5.1.1  conda-forge/noarch
emscripten-abi           3.1.45  repo.mamba.pm/emscripten-forge/noarch
executing                 2.0.1  conda-forge/noarch
ipython                  8.14.0  repo.mamba.pm/emscripten-forge/emscripten-wasm32
jedi                     0.19.1  conda-forge/noarch
matplotlib-inline         0.1.6  conda-forge/noarch
numpy                    1.25.2  repo.mamba.pm/emscripten-forge/emscripten-wasm32
parso                     0.8.3  conda-forge/noarch
pexpect                   4.8.0  conda-forge/noarch
pickleshare               0.7.5  conda-forge/noarch
pip                      23.3.1  conda-forge/noarch
prompt-toolkit           3.0.41  conda-forge/noarch
ptyprocess                0.7.0  conda-forge/noarch
pure_eval                 0.2.2  conda-forge/noarch
pygments                 2.17.2  conda-forge/noarch
python                   3.11.3  repo.mamba.pm/emscripten-forge/emscripten-wasm32
requests-wasm-polyfill    0.3.0  repo.mamba.pm/emscripten-forge/emscripten-wasm32
setuptools               68.2.2  conda-forge/noarch
six                      1.16.0  conda-forge/noarch
stack_data                0.6.2  conda-forge/noarch
traitlets                5.14.0  conda-forge/noarch
wcwidth                  0.2.12  conda-forge/noarch
wheel                    0.42.0  conda-forge/noarch
xeus-lite                 1.0.3  repo.mamba.pm/emscripten-forge/emscripten-wasm32
xeus-python             0.15.10  repo.mamba.pm/emscripten-forge/emscripten-wasm32
xeus-python-shell         0.6.1  conda-forge/noarch
xeus-python-shell-raw     0.6.1  conda-forge/noarch

@jtpio
Copy link
Member

jtpio commented Feb 21, 2024

This still seems to be the case with the latest versions.

Testing with https://jupyterlite.github.io/xeus-python-demo/lab/index.html :

image

Full env info from https://github.com/jupyterlite/xeus-python-demo/actions/runs/7994332330/job/21832125930 for reference:

  Package                  Version  Build              Channel                             Size
─────────────────────────────────────────────────────────────────────────────────────────────────
  Install:
─────────────────────────────────────────────────────────────────────────────────────────────────

  + pillow                  10.2.0  hf51ec75_0         repo.mamba.pm/emscripten-forge       1MB
  + emscripten-abi          3.1.45  h7b187fe_15        repo.mamba.pm/emscripten-forge       7kB
  + python                  3.11.3  h_hash_24_cpython  repo.mamba.pm/emscripten-forge      13MB
  + wheel                   0.42.0  pyhd8ed1ab_0       conda-forge                         58kB
  + setuptools              69.1.0  pyhd8ed1ab_1       conda-forge                        470kB
  + pip                       24.0  pyhd8ed1ab_0       conda-forge                          1MB
  + six                     1.16.0  pyh6c4a22f_0       conda-forge                         14kB
  + ptyprocess               0.7.0  pyhd3deb0d_0       conda-forge                         17kB
  + wcwidth                 0.2.13  pyhd8ed1ab_0       conda-forge                         33kB
  + pure_eval                0.2.2  pyhd8ed1ab_0       conda-forge                         15kB
  + executing                2.0.1  pyhd8ed1ab_0       conda-forge                         28kB
  + traitlets               5.14.1  pyhd8ed1ab_0       conda-forge                        110kB
  + pygments                2.17.2  pyhd8ed1ab_0       conda-forge                        860kB
  + decorator                5.1.1  pyhd8ed1ab_0       conda-forge                         12kB
  + backcall                 0.2.0  pyh9f0ad1d_0       conda-forge                         14kB
  + xeus-python-shell-raw    0.6.1  pyhd8ed1ab_0       conda-forge                         12kB
  + parso                    0.8.3  pyhd8ed1ab_0       conda-forge                         71kB
  + pickleshare              0.7.5  py_1003            conda-forge                          9kB
  + widgetsnbextension      4.0.10  pyhd8ed1ab_0       conda-forge                        886kB
  + jupyterlab_widgets      3.0.10  pyhd8ed1ab_0       conda-forge                        187kB
  + asttokens                2.4.1  pyhd8ed1ab_0       conda-forge                         29kB
  + pexpect                  4.9.0  pyhd8ed1ab_0       conda-forge                         54kB
  + prompt-toolkit          3.0.42  pyha770c72_0       conda-forge                        270kB
  + comm                     0.2.1  pyhd8ed1ab_0       conda-forge                         12kB
  + matplotlib-inline        0.1.6  pyhd8ed1ab_0       conda-forge                         12kB
  + jedi                    0.19.1  pyhd8ed1ab_0       conda-forge                        841kB
  + stack_data               0.6.2  pyhd8ed1ab_0       conda-forge                         26kB
  + numpy                   1.25.2  py311he9a3d86_2    repo.mamba.pm/emscripten-forge       8MB
  + ipython                 8.21.0  py311had7285e_0    repo.mamba.pm/emscripten-forge       2MB
  + xeus-python-shell        0.6.1  pyhd8ed1ab_0       conda-forge                          7kB
  + ipywidgets               8.1.2  pyhd8ed1ab_0       conda-forge                        114kB
  + ipycanvas               0.13.1  pyhd8ed1ab_0       conda-forge                        154kB
  + xeus-python            0.15.13  h1be4ea2_3         repo.mamba.pm/emscripten-forge       4MB

@Pancham97
Copy link

I need ssl to work. A lot of the packages I install use ssl under the hood 😓

@DerThorsten
Copy link

we need to port this recipe to emscripten-forge https://github.com/pyodide/pyodide/blob/main/packages/ssl/meta.yaml

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

5 participants