Skip to content

[FIX] Fix jax and os.fork warnings - #557

Merged
mmcky merged 12 commits into
mainfrom
fix-i548-2
Aug 22, 2025
Merged

[FIX] Fix jax and os.fork warnings#557
mmcky merged 12 commits into
mainfrom
fix-i548-2

Conversation

@HumphreyYang

@HumphreyYang HumphreyYang commented Aug 17, 2025

Copy link
Copy Markdown
Member

This PR fixes the os.fork warning documented in #548.

This together with #556, fixes #548.

@github-actions

github-actions Bot commented Aug 17, 2025

Copy link
Copy Markdown

@HumphreyYang HumphreyYang added bug Something is wrong or broken in a lecture or build do-not-merge Approved-looking but must not be merged yet (hold / pin) labels Aug 17, 2025
@HumphreyYang
HumphreyYang marked this pull request as draft August 17, 2025 13:40
@HumphreyYang

Copy link
Copy Markdown
Member Author

Hi @mmcky,

I tried different approaches but no method gives clean output like ! does.

I find that we can fix the warning by importing jax after we run ! so the os.fork() does not collide with imported jax

This PR fixes the two warnings on my end.

The error now is caused by a strange error from back_prop.

@HumphreyYang HumphreyYang changed the title [FIX] Fix jax fork warning on status page [FIX] Fix jax and os.fork warnings Aug 18, 2025
@HumphreyYang HumphreyYang changed the title [FIX] Fix jax and os.fork warnings [FIX] Fix jax and os.fork warnings Aug 18, 2025
Comment thread lectures/back_prop.md

```{code-cell} ipython3
fig = go.Figure()
fig.add_trace(go.Scatter(x=grid, y=f_val, name=r'$-3x+2$'))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HumphreyYang the failure in back_prop in the pdf builder could be due to the removal of these $ signs?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will run locally to check and confirm.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mmcky,

I removed them because of the error but it doesn't seem to be working : (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HumphreyYang I think the error was due to big changes in plotly and Kaleido versions. It also seems to have been re-written around chrome.

@mmcky

mmcky commented Aug 18, 2025

Copy link
Copy Markdown
Contributor

@HumphreyYang I can build this branch locally -- I have triggered another run just in case. Leave this with me. Thanks of your work on this.

@mmcky

mmcky commented Aug 18, 2025

Copy link
Copy Markdown
Contributor

@HumphreyYang the issue being reported in back_prop was

�[0;31mValueError�[0m: 
Image export using the "kaleido" engine requires the kaleido package,
which can be installed using pip:
    $ pip install -U kaleido

so trying an install upgrade.

@HumphreyYang

HumphreyYang commented Aug 18, 2025

Copy link
Copy Markdown
Member Author

Hi @mmcky,

I think this might be related to QuantEcon/lecture-python-advanced.myst#221.

Something breaks when using Image with kaleido

Comment thread lectures/back_prop.md
@github-actions
github-actions Bot temporarily deployed to pull request August 21, 2025 04:55 Inactive
@HumphreyYang

Copy link
Copy Markdown
Member Author

Many thanks @mmcky! It looks like it is building!!

I think colab servers do not have chrome so it might be hard to solve on the colab side.

@github-actions
github-actions Bot temporarily deployed to pull request August 21, 2025 05:56 Inactive
@github-actions
github-actions Bot temporarily deployed to pull request August 22, 2025 01:08 Inactive
@github-actions
github-actions Bot temporarily deployed to pull request August 22, 2025 02:16 Inactive
@github-actions
github-actions Bot temporarily deployed to pull request August 22, 2025 02:17 Inactive
@mmcky
mmcky marked this pull request as ready for review August 22, 2025 02:28
@mmcky
mmcky requested a review from Copilot August 22, 2025 02:28

This comment was marked as outdated.

@github-actions
github-actions Bot temporarily deployed to pull request August 22, 2025 02:55 Inactive
@github-actions
github-actions Bot temporarily deployed to pull request August 22, 2025 02:55 Inactive
@mmcky mmcky added ready and removed bug Something is wrong or broken in a lecture or build do-not-merge Approved-looking but must not be merged yet (hold / pin) labels Aug 22, 2025
@mmcky
mmcky requested a review from Copilot August 22, 2025 04:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses JAX and os.fork warnings reported in issue #548 by reorganizing import statements and improving build configuration. The changes ensure proper JAX initialization order and suppress unnecessary warning messages during the build process.

  • Reorganizes JAX imports and GPU checks in lecture files to prevent initialization warnings
  • Updates package installation commands for better compatibility
  • Adds warning suppression configuration to prevent build noise

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
lectures/status.md Reorders GPU check to occur before JAX backend verification
lectures/back_prop.md Moves JAX installation and import after other package setups, updates plotly installation
lectures/_config.yml Adds warning suppression for unknown MIME types
.github/workflows/ci.yml Updates artifact naming and removes failure condition

Comment thread lectures/back_prop.md
Comment thread .github/workflows/ci.yml
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions
github-actions Bot temporarily deployed to pull request August 22, 2025 04:56 Inactive
@github-actions
github-actions Bot temporarily deployed to pull request August 22, 2025 04:57 Inactive
@mmcky

mmcky commented Aug 22, 2025

Copy link
Copy Markdown
Contributor

thanks @HumphreyYang great to get those warnings removed. LGTM

@mmcky
mmcky merged commit 307c7f1 into main Aug 22, 2025
7 checks passed
@mmcky
mmcky deleted the fix-i548-2 branch August 22, 2025 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python warnings found in code output

3 participants