I'd like to try the lexer and highlighter for Mathematica that's based on Pygments, but I'm lost in a morass of getting Pygments installed.

Here's what I have so far.

  • I'm using MacPorts python37 (invoked from command line by "python").
  • Again with MacPorts I have installed the python 3.7 setuptools (port py37-setuptools, wheel (port py37-wheel), and pip (port py37-pip).
  • I created a virtual environment via:

    python -m venv ~/PyithonVirtualEnvironments/pygments
  • I'm invoking (I hope) that environment by command:

    python -m venv pygments
  • With Pygments-2.2.0-py2.py3-none-any.whl downloaded, I try

     pip install "Pygments-2.2.0-py2.py3-none-any.whl"

but this fails with:

Installing collected packages: Pygments
Could not install packages due to an EnvironmentError: [Errno 13]   
Permission denied: '/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pygments'
Consider using the `--user` option or check the permissions.

Evidently this install is trying to put pygments not into the virtual enviroment location (which I thought was the purpose of the virtual environment) but rather into the MacPorts /opt location (which is definitely where I do not want it to be).

How should I proceed here?

Comment: I do hate it when somebody creates a potentially useful tool (for example, for Mathematica), then leaves everything to the user to work through a seemingly infinite regress to get it to work!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.