I’m looking forward to running the memoize package to reduce my compile time, but after several days of research, I’m clueless. This is my first Python rodeo, so I may be missing something that to others would be obvious. Initially thought it was a path mismatch, but now I’m not so sure.
Configuration (Mac running Python 3.13.1 on Sequoia 15.1.1, compiling w LuaLaTeX using TeXShop 5.47):
- My memoize.cfg is:
\mmzset{
extract=python, % Use the Python-based extern extraction method.
auto={circuitikz}{memoize}, % Working on electrical circuits
prefix=memos/, % Use one memo directory for all documents in a folder.
}
- Terminal command
python -c 'import sys; print("\n".join(sys.path))’yields:
/Library/Frameworks/Python.framework/Versions/3.13/lib/python313.zip
/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13
/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/lib-dynload
/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages
- Terminal command
pip show pdfrw2yields:
Name: pdfrw2
Version: 0.5.0
Summary: PDF file reader/writer library
Home-page: https://github.com/sarnold/pdfrw
Author: Patrick Maupin
Author-email: [email protected]
License: MIT
Location: /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages
Requires:
Required-by:
- My MWE
memoize.tex(from Sec 2.1 inMemoize v1.4.1 December 2, 2024package documentation):
\documentclass{article}
\usepackage{tikz,forest}
\usepackage[recompile]{memoize}
\begin{document}
Memoize will automatically externalize\\
\begin{tikzpicture}
\node(node)
[align=center,ellipse,draw]
{TikZ\\pictures};
\end{tikzpicture}
\begin{forest}
[and Forest trees [and]
[Forest trees[Forest][trees]]]
\end{forest}
\end{document}
Results in the following console error:
memoize-extract.py: Python module 'pdfrw' was not found.
Have you followed the instructions is section 1.1 of the manual?
(./memoize.mmz.log
./memoize.mmz.log:1: Package memoize (python-based extraction) Error: Python module 'pdfrw' was not found.
Note 1: I used pip 24.3.1 to install/uninstall/reinstall the Python module ’pdfrw2’ (as well as ’pdfrw’) several times. No luck.
Note 2: The documentation states: … install Python and library pdfrw2 and then use extract=python. It says nothing about installing pdfrw [w/o the 2].
Note 3: [From 2. above] The sys.path includes the path:
/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages which [From 3. above] is identical to the location of pdfrw2:
/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages.
This makes me think it’s not a path mismatch.
Lastly, I have no idea why the console error states that the pdfrw module is missing, when the documentation clearly states that memoize requires the pdfrw2 module.
What am I missing?
UPDATE as of Jan 10, 2025:
I still have no resolution to the Warning issue that is halting execution of my memoize6.tex LuaLaTeX file midway. The Warning message that I continue to see includes:
LaTeX Warning: You have requested package `/usr/local/texlive/2024/texmf-dist/t
ex/latex/memoize/memoize',
but the package provides `memoize'.
(/usr/local/texlive/2024/texmf-dist/tex/latex/advice/advice.sty
(/usr/local/texlive/2024/texmf-dist/tex/latex/collargs/collargs.sty))
memoize-extract.py: Logging to 'memoize6.mmz.log'.
memoize-extract.py: Python module 'pdfrw' was not found.
Have you followed the instructions is section 1.1 of the manual?
(./memoize6.mmz.log
./memoize6.mmz.log:1: Package memoize (python-based extraction) Error: Python m
odule 'pdfrw' was not found.
Why the Warning is stating that:
You have requested package `/usr/local/texlive/2024/texmf-dist/t
ex/latex/memoize/memoize',
but the package provides `memoize’.
is baffling to me. To me this says the LuaLaTeX package actually found the memoize.sty file, but for some reason it does not like what it found is contained inside the memoize.sty file??
I’ve been trying so many iterations to solve this issue that it may be important that I re-post my most recent version of my memoize6.tex file with the added pygmentex pycode that I’ve added, but hasn’t altered the result:
\documentclass[12pt,letterpaper]{article}
\usepackage{comment}
\usepackage{pygmentex}
\usepackage[runall=true,debug]{pythontex}
% \begin{comment}
\begin{pycode}
% import sys
% sys.path.append("/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages")
% import pdfrw
% python -m venv memoize_env
python -m pip install pdfrw2
source memoize_env/bin/activate
pip install pdfrw2
import pdfrw2
export PYTHON=`which python`
\end{pycode}
% \end{comment}
% \usepackage[trace,extract=python]{memoize}
\usepackage[trace,extract=python]{/usr/local/texlive/2024/texmf-dist/tex/latex/memoize/memoize}
\usepackage{tikz}
\usepackage{forest}
\title{memoize6}
\begin{document}
Memoize will automatically externalize\\
\begin{tikzpicture}
\node(node)
[align=center,ellipse,draw]
{TikZ\\pictures};
\end{tikzpicture}
\vspace{-2.0cm} % \vspace added to adjust the location of the 'forest'
\hspace{2.5cm} % \hspace added to adjust the location of the 'forest'
\begin{forest}
[and Forest trees [and]
[Forest trees[Forest][trees]]]
\end{forest}
\end{document}
I will continue to search for what is causing the Warning to halt execution of my LuaLaTeX code before attempting to add the memoize package to my larger LuaLaTeX project.
All suggestions/thoughts appreciated. (I can send copies of my memoize6.log file for those who may be interested in assisting.)
Thank you everyone for all for your assistance.
UPDATE as of Jan 13, 2025: (Note: As of 22 Jan 2025, this update has been moved to Answer # 3)


.texfile as-is? I posted an answer, but I've deleted it as I'm not sure it's the problem, but you have to loadmemoizebefore eithertikzorforest.pdfrw2calls itselfpdfrwas far as I can tell./usr/bin/pythonand/usr/bin/python3are symlinks to a specific version, maybe changing that would've helped as well. (c) You have not completely removed the unwanted python versions. In particular, each version also has files in/usr/lib/python<version>.