JavaScript and TypeScript syntax highlighting

Can you be more specific? What is the operation that you are performing? I guess there should be some problem running Python maybe? We also need to know the OS and the version of TeXmacs.

You could also try running a Python session, to see if TeXmacs can find your Python executable.

From there, try “import pygments”. It could be that TeXmacs uses a different Python than the one for which you have installed Pygments.

But some more details are definitely necessary.

I had the same problem and was able to avoid it by installing the generic TeXmacs package, see my answer above.

thanks for reply!

here some informations:

  • OS: macOS
  • TexMacs version: 2.1.1

I can use a python session in TexMacs (Executable > Python)
there I can run a "print(“hello world”), but when I try to execute
“import pygments”, it is telling me that there is no module called “import pygments”

but pygements is already installed:
“Requirement already satisfied: pygments in /opt/homebrew/lib/python3.9/site-packages (2.11.2)”

I installed TexMacs with brew and by downloading the dmg

where can I get the “generic package of TeXmacs” ?

hope that helps

On Mac there are several versions of python installed usually. You would have to be sure that you installed pygments for the python system that got run by TeXmacs. Maybe TeXmacs picks up the system python while you installed pygments for the Homebrew’s python installation.

here is what I have so far:

I created a python executable
(Insert > Fold > Executable > Python)

There I added this code:

import sys
print(sys.version)

output:

3.8.9 (default, Oct 26 2021, 07:25:54) 
[Clang 13.0.0 (clang-1300.0.29.30)]

On another python executable I did this:

import pip
pip.main(['install', 'pygments'])

output:

WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.

To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
WARNING: The script pygmentize is installed in '/Users/peter/Library/Python/3.8/bin' which is not on PATH.

Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

WARNING: You are using pip version 20.2.3; however, version 22.0.4 is available.
You should consider upgrading via the '/Library/Developer/CommandLineTools/usr/bin/python3 -m pip install --upgrade pip' command.

In the OS-Terminal I executed this:

python3 -m pip install --upgrade pip

output:

DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future.
If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621

Requirement already satisfied: pip in /opt/homebrew/lib/python3.9/site-packages (22.0.4)
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future.

If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621

Not sure what to do next

Your output indicates indeed that TeXmacs is using a different version of Python (3.8) than what is used from the command line (3.9). You can check which one TeXmacs finds by doing (url-resolve-in-path (python-command)) in a Scheme session.

in a Scheme Session I used this:

(url-resolve-in-path (python-command))

output:

Scheme]  (url-resolve-in-path (python-command))

<url /usr/bin/python3>

what can I do next?

You can try to install pygments for the Python version that TeXmacs uses:

/usr/bin/python3 -m pip install pygments
1 Like

I installed pyenv and this solved my problem

there is another problem, and thats the line breaks
all of them are ignored

can anyone help out?

I made some changes to the plugin recently, did you pull the most recent commits?

If yes, please share the input you inserted and I’ll have a look.

@jeroen: thanks! works like a charm

this plugin must become part of TeXmacs by default!

2 Likes

Any news on this Python issue?

Not that I know of.
I find it strange. I compile with Qt 5.15.5 on Fedora and 5.15.2 on Debian. Both builds run plugins without a problem. I use cmake, though, perhaps that somehow makes a difference?

Okay, yes, I get the segfault only when using autotools (configure), so we may learn something from how cmake sets up the compilation. I’ll add this to the bug report.

It seems that cmake is in general better than autotools, especially for cross-platform softwares?

I much prefer cmake as well, but Joris favors Autotools.

The cmake build definition is maintained by me, but Joris favors Autotools.

And I think xmake is a better choice.

8 posts were split to a new topic: TeXmacs crashes when selecting semantically