Closed BenBlumer closed 11 years ago
If the command
kpsewhich --format texmfscripts pythontex_utils.py
isn't returning a path, then there is probably something wrong with your TeX installation; it should return the path to the script. You might try running mktexlsr
just to make sure the kpathsea database is up to date (though the installer script runs that automatically, so it should be OK).
Both pythontex.py
and pythontex_utils.py
are always in the same directory. The problem is that pythontex_utils.py
needs to be imported by temporary scripts created in the output directory (which is under the document directory by default); it's never used by pythontex.py
. So the location of pythontex_utils.py
needs to be added to these scripts' path (via sys.path.append()
).
In the future, it may be possible to either completely incorporate pythontex_utils.py
into the temp script template or get the path via __file__
, and thus eliminate the dependency on kpsewhich.
Do you know which directory within TexLive one is supposed to install pythontex to? I chose /usr/local/texlive/2012/texmf-dist/
because it had the directory structure discussed in the pythontex manual. But I've also found that /usr/local/texlive/2012/texmf
has a similar structure. I tried installing there, but was told (by the pythontex install script):
Could not find path /usr/local/texlive/2012/texmf/doc/latex
Could not find path /usr/local/texlive/2012/texmf/source/latex
Exiting.
I figured maybe this was because it was the first package I'd tried to install myself. So I created those directories. Now it installed fine. But it's still not working. I get the same kpsewhich error. I'm wondering if there are residual files, perhaps in the bin/ directory that are interfering. Is there an uninstall script? Or,are there any files in particular I should manually exterminate?
The texmf-dist
is the default, because that's where TeX Live installs most things, so then TeX Live can take over with automatic updates. The /usr/local/.../texmf
is for config stuff that you probably don't want to mess with (see this).
There isn't an uninstall script. You would want to at least get rid of any copies of the Python scripts and pythontex.sty
. The directory layout should be exactly as described on page 10 of the manual, with texmf
and texmf-dist
as the TeX tree root.
Have you tried running mktexlsr
again? Depending on how your system is configured, it's possible (though unlikely) you might need to run it with admin priviliges. If pythontex.py
worked from the command line after you ran the installation script (although with errors), that's probably an indication that the installation worked, and the only problem is kpsewhich needing an updated database (which comes back to mktexlsr
).
Ah. The solution was to sudo env PATH=$PATH mktexlsr
. I think I tried running the install script without the recommended env PATH=$PATH
, then because it installed, I assumed it worked. But as a result, mktexlsr
was configuring the system install of (old) TeXLive, rather than the new 2012 one I installed.
Totally my fault for not following the manual to a T, but I suppose other people might make the same mistake. It might be worth removing the "For example" and "may" from: "For example, under Ubuntu Linux, you may need the following: sudo env PATH=$PATH python pythontex_install_texlive.py". The default installation of TeXLive is missing lots of the requisites for PythonTeX, so I'm guessing lots of people will do as I did, and install the new version manually. In which case, they'll have the same problem I had. Also, it may or may not be worth mentioning which directory to install to for the new version of TeXLive, since the installer finds the system-installed version.
Thanks a lot for your help.
-Ben
I've revised the documentation for the next version (out in a few days) to emphasize the permissions issues. I've also revised the installer to warn about this.
Thanks! FYI. I got PythonTeX to work with LyX as per my solution here: http://tex.stackexchange.com/questions/114285/pythontex-workflow-with-lyx .
I installed pythontex via the install script into my 2012 TeXLive installation directory.
When I try to run pythontex on a tex file, I get:
I've verified the install location by crashing the program. In a random directory, I type
pythontex.py 312#?/123
and get the error:and when I use the locate command to find the file, I find that there's a copy in the same directory as the pythontex.py script:
(the other copies represented by "..." are from different install attempts).
Also, running the command by itself doesn't return anything:
What's going on here? Is it really necesssary to use the kpsewhich given that the two scripts should always be in the same directory anyway?