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

problem with tzdata or zoneinfo #7

Closed
stonebig opened this issue Dec 26, 2022 · 8 comments · Fixed by emscripten-forge/empack#53
Closed

problem with tzdata or zoneinfo #7

stonebig opened this issue Dec 26, 2022 · 8 comments · Fixed by emscripten-forge/empack#53
Labels
bug Something isn't working

Comments

@stonebig
Copy link

stonebig commented Dec 26, 2022

hi,

trying to get plotnine working, I fail on a 'No time zone found with key UTC'

I can't find how to resolve this , even if trying to include tzdata

environment

name: xeus-python-kernel
channels:
  - https://repo.mamba.pm/emscripten-forge
  - https://repo.mamba.pm/conda-forge
dependencies:
  - ipycanvas
  - numpy
  - matplotlib
  - seaborn
  - plotnine
  - pandas
  - statsmodels
  - scikit-learn
  - scipy
  - sqlite
  - bokeh
  - panel
  - altair
  - ipympl
  - ipyleaflet
  - ipydatagrid
  - ipycanvas
  - vega_datasets
  - plotly
  - bqplot
  - black
  - pyviz_comms
  - openpyxl
  - tzdata
  - httpx

typical code that doesn't want to work:

from zoneinfo import ZoneInfo
utc = ZoneInfo('UTC')

target code

from plotnine import ggplot, geom_point, aes, stat_smooth, facet_wrap
from plotnine.data import mtcars

(ggplot(mtcars, aes('wt', 'mpg', color='factor(gear)'))
 + geom_point()
 + stat_smooth(method='lm')
 + facet_wrap('~gear'))
@stonebig stonebig added the bug Something isn't working label Dec 26, 2022
@martinRenou
Copy link
Member

Thanks for opening an issue!

My gut feeling is that empack is filtering out some data files from the tzdata module. I'll have a look into it.

@martinRenou
Copy link
Member

martinRenou commented Jan 2, 2023

This should fix it #53

@stonebig
Copy link
Author

stonebig commented Jan 8, 2023

I duplicated today xeus-python-demo and generated from it a new demo2, but I still fail on it.
I don't know how to inquire.
it apparently fails also on latest jupyterlite/demo.

image

it's rather a simple test now:

from zoneinfo import ZoneInfo
utc = ZoneInfo('UTC')

@martinRenou
Copy link
Member

It also fails that way for me with a classic JupyterLab/ipykernel/tzdata installation from conda-forge.

The issues seems to be that the tzdata from conda-forge IS NOT the tzdata we find on PyPi. The one on conda-forge is not the Python package.

In order to install the Python one, you need to install python-tzdata from conda-forge. This seems to resolve the traceback you see here with the No module named tzdata.

But there is another issue on top of this with empack and that python-tzdata, I'll push a PR.

@martinRenou
Copy link
Member

This PR fixes it, as tested in https://github.com/martinRenou/tzdata-test (https://martinrenou.github.io/tzdata-test/lab/index.html).

I'll make another empack release with this.

@stonebig
Copy link
Author

stonebig commented Jan 13, 2023

ok, now I'm stuck on the "normal' problem of files, but otherwise, Waaaaaaaaaaaaaaa

FileNotFoundError: [Errno 44] No such file or directory: '/tmp/xeus-python-kernel/envs/xeus-python-kernel/lib/python3.10/site-packages/plotnine/data/mtcars.csv'

image

@martinRenou
Copy link
Member

FileNotFoundError: [Errno 44] No such file or directory: '/tmp/xeus-python-kernel/envs/xeus-python-kernel/lib/python3.10/site-packages/plotnine/data/mtcars.csv'

This is a very similar issue. The .csv file gets filtered out by empack. I suppose this .csv is for example purpose and does not prevent plotnine to work? IMO this kind of file should get filtered out (if we were to include example data from all packages the jupyterlite kernel would not be "lite" anymore).

If you really want this file to be included you can provide your own empack config that tells to not filter out this file. We should document this properly in jupyterlite-xeus-python.

@stonebig
Copy link
Author

My experiment was to have a full stack pytho distro... as a stupid webapp. I didn't think about the "lite" meaning, only about the dramatic simplification it apparently allows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants