SystemsApproach / book

Computer Networks: A Systems Approach -- Textbook

Home Page:https://book.systemsapproach.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

does this project target python 2 only?

vise890 opened this issue Β· comments

Hi there,

first of all, I am thoroughly enjoying the book. Absolutely great work guys!

I'll get straight to the point: Is this project supposed to work with python 3? because it doesn't on my machine (detailed explanation below). However it works with a python2-based virtualenv

Now, if the project it's a python 2 only project, would you be open to:

  • adding a note in the README, in the Build the Book section?
  • maybe even better, force the Makefile to create a python2-based virtualenv, even on machines that have python at version 3.

I can create a draft PR if you are interested.

Explanation of breakage under python 3

I cloned the repo and ran:

# this is outside the virtualenv
# it is, however, what `virtualenv` will pick up 
# by default when creating `doc_venv`
python --version
# Python 3.10.4

make html
# ... redacted for brevity ... I can provide entire output if needed
# source ./doc_venv/bin/activate ;\
# set -u ;\
# sphinx-build -M html "." "_build"
# Running Sphinx v1.8.6

# Extension error:
# Could not import extension sphinx.builders.latex (exception: cannot import name 'contextfunction' from 'jinja2' (/home/vise890/code/systemsapproach/book_issue/doc_venv/lib/python3.10/site-packages/jinja2/__init__.py))
# make: *** [Makefile:53: html] Error 2

making it work

So I tried to force python2 for the venv creation:

# Create the virtualenv with all the tools installed
doc_venv:
	virtualenv --python=$(shell which python2) doc_venv ;\
	source ./doc_venv/bin/activate ;\
	pip install livereload ;\
	pip install -r requirements.txt

Then tried building, and it seems to all work πŸŽ‰

Oh I see, well thank you for the quick reply anyway. I got my epub and lots of reading to do now πŸ˜›

Let me know if you need a hand with the porting by the way. This is such a great project and I'd love to give something back. I can't guarantee anything, but I can give it a try...

Makes sense, best of luck with it all!

We just rolled out an update to the tools today and (for me and Larry at least) python3 is working fine. Please let us know if you think we can close this issue or if you're still having problems.

Oh nice! Worked like a charm for me as well, closing.