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

4_possible_issues_for_building_html_using_jupyter-book #1

Open
shlff opened this issue Aug 6, 2020 · 5 comments
Open

4_possible_issues_for_building_html_using_jupyter-book #1

shlff opened this issue Aug 6, 2020 · 5 comments

Comments

@shlff
Copy link
Member

shlff commented Aug 6, 2020

Hi @mmcky , when I use the command jupyter-book build ctmc_lectures/ to build html files from the original files, I come across 4 issues:

  1. 970 : WARNING: duplicate citation,
  2. OSError: [Errno 24] Too many open files,
  3. ValueError,
  4. AttributeError: '_UnixSelectorEventLoop' object has no attribute '_ssock'

Please find the screenshot for the execution and those issues with red labels below:
Screen Shot 2020-08-06 at 3 32 44 pm

However, when I use the command jupyter-book page path/xx.md to build HTML files for those md-myst files separately, it works well.

Do you think how I should improve those issues? I look forward to your comments.

@mmcky
Copy link
Collaborator

mmcky commented Aug 6, 2020

thanks @shlff. Just a few preliminary points.

  1. jupyter-book is technically supported for sphinx < 3.0 but looks like it is working on the most part for you. You may want to create a new environment using conda and install jupyter-book. It should bring in sphinx version 2+ but <3.

Issue [1]: This is likely an issue in the source bib file. Is there a duplicate tag?

Issue [2]: This is a limitation of os x when running many jupyter notebooks in parallel. You can try and run ulimit -S -n 2048 in the terminal to see if that is the issue. This command allows for more open sockets.

Issue [3] and Issue [4] may be as a result of Issue [2] so let's iterate on those first to see if they resolve these.

@mmcky
Copy link
Collaborator

mmcky commented Aug 8, 2020

hey @shlff I can't replicate these issues on my mac.

I would recommend you do the following:

conda create -n jupyterbook python=3.7 anaconda

then activate the conda environment

conda activate jupyterbook

then install jupyter-book

pip install jupyter-book

you should see this install downgrades sphinx=2.4.4

Installing collected packages: libsass, sphinx, pydata-sphinx-theme, sphinx-book-theme, nest-asyncio, async-generator, nbclient, sphinx-thebe, sphinx-togglebutton, jupyter-sphinx, markdown-it-py, myst-parser, smmap, gitdb, GitPython, nbdime, jupyter-cache, myst-nb, latexcodec, pybtex, pybtex-docutils, oset, sphinxcontrib-bibtex, sphinx-copybutton, jupyter-book
  Attempting uninstall: sphinx
    Found existing installation: Sphinx 3.1.2
    Uninstalling Sphinx-3.1.2:
      Successfully uninstalled Sphinx-3.1.2
Successfully installed GitPython-3.1.7 async-generator-1.10 gitdb-4.0.5 jupyter-book-0.7.4 jupyter-cache-0.2.2 jupyter-sphinx-0.2.4 latexcodec-2.0.1 libsass-0.20.0 markdown-it-py-0.4.8 myst-nb-0.8.4 myst-parser-0.10.0 nbclient-0.4.1 nbdime-2.0.0 nest-asyncio-1.4.0 oset-0.1.3 pybtex-0.22.2 pybtex-docutils-0.2.2 pydata-sphinx-theme-0.3.1 smmap-3.0.4 sphinx-2.4.4 sphinx-book-theme-0.0.34 sphinx-copybutton-0.3.0 sphinx-thebe-0.0.7 sphinx-togglebutton-0.2.1 sphinxcontrib-bibtex-1.0.0

Install dependencies:

pip install quantecon

Then run the build

jb build ctmc_lectures

then we will be working to the same software environment.

I get the following issues showing up

▶ jb build ctmc_lectures
Running Sphinx v2.4.4
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 9 source files that are out of date
updating environment: [new config] 9 added, 9 changed, 0 removed
Executing: ergodicity11%] ergodicity                                                                                                                   
Executing: infinitesimals infinitesimals                                                                                                               
Executing: kolmogorov_bwd kolmogorov_bwd                                                                                                               
checking for continuous_time_mcs/ctmc_lectures/references.bib in bibtex cache... not found
parsing bibtex file continuous_time_mcs/ctmc_lectures/references.bib... parsed 6 entries
Executing: kolmogorov_fwd kolmogorov_fwd                                                                                                               
Executing: markov_prop6%] markov_prop                                                                                                                  
checking for continuous_time_mcs/ctmc_lectures/references.bib in bibtex cache... up to date
Executing: memoryless77%] memoryless                                                                                                                   
Executing: poisson [ 88%] poisson                                                                                                                      
checking for continuous_time_mcs/ctmc_lectures/references.bib in bibtex cache... up to date
Executing: prob_view100%] prob_view                                                                                                                    

continuous_time_mcs/ctmc_lectures/markov_prop.md:969: WARNING: duplicate citation stroock2013introduction, other instance in /Users/matthewmckay/repos-collab/continuous_time_mcs/ctmc_lectures/kolmogorov_bwd.md
continuous_time_mcs/ctmc_lectures/poisson.md:524: WARNING: duplicate citation le2016brownian, other instance in continuous_time_mcs/ctmc_lectures/markov_prop.md
continuous_time_mcs/ctmc_lectures/poisson.md:524: WARNING: duplicate citation stroock2013introduction, other instance in continuous_time_mcs/ctmc_lectures/markov_prop.md
continuous_time_mcs/ctmc_lectures/poisson.md:524: WARNING: duplicate citation walsh2012knowing, other instance in continuous_time_mcs/ctmc_lectures/markov_prop.md
WARNING: duplicate label for keys stroock2013introduction and stroock2013introduction
WARNING: duplicate label for keys le2016brownian and le2016brownian
WARNING: duplicate label for keys stroock2013introduction and stroock2013introduction
WARNING: duplicate label for keys walsh2012knowing and walsh2012knowing
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] prob_view                                                                                                                     
continuous_time_mcs/ctmc_lectures/markov_prop.md:389: WARNING: undefined label: exp_unique (if the link has no caption the label must precede a section header)
generating indices...  genindexdone
writing additional pages...  searchdone
copying images... [100%] _build/jupyter_execute/poisson_11_0.png                                                                                       
copying static files... ... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded, 9 warnings.

@mmcky
Copy link
Collaborator

mmcky commented Aug 8, 2020

@jstac and @shlff

The warnings I am getting are due to multiple instances of bibliography. Generating local bibliographies in each file with sphinxcontrob-bibtex (used under the hood of jupyter-book) is a bit clunky but can be done with filters.

I don't have write access to submit a PR but these are the changes required.

diff --git a/ctmc_lectures/kolmogorov_bwd.md b/ctmc_lectures/kolmogorov_bwd.md
index 6822ac4..eee1f82 100644
--- a/ctmc_lectures/kolmogorov_bwd.md
+++ b/ctmc_lectures/kolmogorov_bwd.md
@@ -488,4 +488,5 @@ which is identical to {eq}`kolbackeq`.
 ## References
 
 ```{bibliography} references.bib
+:filter: docname in docnames
 ```
diff --git a/ctmc_lectures/markov_prop.md b/ctmc_lectures/markov_prop.md
index 34c16ee..a989d38 100644
--- a/ctmc_lectures/markov_prop.md
+++ b/ctmc_lectures/markov_prop.md
@@ -969,4 +969,5 @@ The last expression equals $\mathbf P_\psi^n$, which concludes the proof.
 ## References
 
 ```{bibliography} references.bib
+:filter: docname in docnames
 ```
diff --git a/ctmc_lectures/poisson.md b/ctmc_lectures/poisson.md
index efdafb5..d532e54 100644
--- a/ctmc_lectures/poisson.md
+++ b/ctmc_lectures/poisson.md
@@ -526,4 +526,5 @@ plt.show()
 ## References
 
 ```{bibliography} references.bib
+:filter: docname in docnames
```

@mmcky
Copy link
Collaborator

mmcky commented Aug 8, 2020

@shlff
Copy link
Member Author

shlff commented Aug 14, 2020

Thanks a lot, @mmcky .

As you instructed, I added :filter: docname in docnames in those files and the building works correctly immediately.

Please find the screenshot attached.

Screen Shot 2020-08-14 at 4 34 49 pm

@shlff shlff mentioned this issue Aug 20, 2020
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

2 participants