executablebooks / cookiecutter-jupyter-book

Cookiecutter template for a simple jupyter book
https://executablebooks.github.io/cookiecutter-jupyter-book/
BSD 3-Clause "New" or "Revised" License
140 stars 53 forks source link

Error rendering to html #35

Closed RoxaneT closed 3 years ago

RoxaneT commented 3 years ago

Describe the problem

I am trying to build a jupyter book and everything is alright until I try to build the HTML render using jupyter-book build my-book/. Then I get an error message saying ImportError: DLL load failed while importing win32api: The specified module could not be found.

From what I can tell win32api changed its name to pywin32. I installed that and even tried installing win32api but it says it can't be found (probably because the name changed). I don't know how to make jupyter books not look for win32api and look for pywin32 instead. Or maybe there's another way around the issue I haven't figured out.

Link to your repository or website

https://github.com/RoxaneT/en_Physics_test

Steps to reproduce

I put the folder with all the files from the book in the repo I linked. I followed the instructions in your readme, so if you clone that and try to build it from there you might get the same error.

The version of Python you're using

3.8

Your operating system

Windows 10 Pro

Versions of your packages

Jupyter Book      : 0.11.2
External ToC      : 0.2.3
MyST-Parser       : 0.13.7
MyST-NB           : 0.12.3
Sphinx Book Theme : 0.1.2
Jupyter-Cache     : 0.4.3
NbClient          : 0.5.4

Additional context

No response

welcome[bot] commented 3 years ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

TomasBeuzen commented 3 years ago

Hi @RoxaneT - thanks for the issue. This is probably a more suitable issue for the Jupyter/Jupyter Book repo than this cookiecutter repo (which is just a templating engine), but nevertheless, let's try to debug! Historically, windows has had some problems with Jupyter/Jupyter Book. I note a recent PR to the core Jupyter library makes some changes with the pywin32 dependency which might be related, but anyways.

I'm not a windows users and don't have access to a machine to try things out on, but I have a few suggestions which you could try, in order of increasing complexity:

  1. If you're using an environment manager like conda, make sure you're in the environment you installed jupyter-book into before trying to build the book. If you're not using a virtual environment read on (but I recommend using them :) )

  2. Uninstall and reinstall win32api and then run pywin32_postinstall.py script as suggested here while running Powershell as admin. Then try building your book again.

pip uninstall pywin32
pip install pywin32
pywin32_postinstall.py -install (or maybe python [your environment path]/Scripts/pywin32_postinstall.py -install)
  1. This SO thread makes a few suggestions such as using conda to install pywin32 in your environment, or changing the version of pywin32.

  2. Last but not least, try the steps at the bottom of this page to see if you can get a book working at all: https://jupyterbook.org/advanced/windows.html#working-on-windows. If you can get that book built, at least that will help debug your personal book.

Let me know how you go!

RoxaneT commented 3 years ago

Thank you very much for your help! I was using a conda environment, so I tried your suggestion for uninstalling and reinstalling pywin32. That didn't help so I then tried building the book in 4. and after some fiddling around I managed to get it to work, so I used the same procedure for my book and it works now.

TomasBeuzen commented 3 years ago

That's great, nice work!