How to make pythontex see PYTHONPATH

28 Views Asked by At

I've been working with pythontex for some time and I'm quite happy with the results. After reinstalling the system, however, serious difficulties began.

THE PROBLEM: while compiling code (in .tex documents) and trying to import local modules I get ModuleNotFoundError: No module named 'm_system' (the offending line: import m_system; I listed sys.path in a .tex document and it has no idea about the contents of PYTHONPATH system variable).

I cannot remember how I got it working the previous time, but it worked just fine. I was searching for an answer, grilling ChatGPT -- to no avail.

How could I solve it? Make PYTHONPATH the same for pythontex?

The new system:

  • Linux Mint 21.3, Cinnamon 64-bit
  • texTeX, Version 3.141592653 (TeX Live 2022/dev/Debian)
  • editor: sublime-text 4169

The system allows for compilation of pdf documents, along with python code inside. This snippet returned appropriate message in the pdf:

\begin{pycode}
import sys

print(f"{sys.version = }")
\end{pycode}

The result was sys.version = ’3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]’ (in the pdf).

What other pieces of information could provide additional, necessary details?

Thanks in advance.

0

There are 0 best solutions below