Python extensions complain about PYTHONPATH

Asked by Ned Konz

When I try to run extensions or importers that require Python, I always get a dialog saying:

Your PYTHONPATH points to a site-packages dir for Python 3.x but you are running Python 2.x!
     PYTHONPATH is currently: "/Applications/Inkscape 2.app/Contents/Resources/share/inkscape/extensions:/Applications/Inkscape 2.app/Contents/Resources/lib/python2.7/site-packages/"
     You should `unset PYTHONPATH` to fix this.

However, my PYTHONPATH is being set in the Inkscape launcher file.
When I run Inkscape from the command line with DEBUG set, I see this output:

+ export VERSIONER_PYTHON_VERSION=2.7
+ VERSIONER_PYTHON_VERSION=2.7
+ '[' x86_64 = i386 ']'
+ export VERSIONER_PYTHON_PREFER_32_BIT=no
+ VERSIONER_PYTHON_PREFER_32_BIT=no
++ python -V
++ cut -c 8-10
+ PYTHON_VERS=2.7
+ export PYTHONPATH=/Applications/Inkscape.app/Contents/Resources/lib/python2.7/site-packages/
+ PYTHONPATH=/Applications/Inkscape.app/Contents/Resources/lib/python2.7/site-packages/

I've tried this both with versions
"Inkscape 0.91+devel+osxmenu r12922, built Jun 16 2015, 09:24:00"
and
"Inkscape 0.91 r13725"

I'm running os Mac OS/X 10.12.6; both versions of Inkscape have been working fine for quite a while, and I haven't changed them recently.

PYTHONPATH isn't set in my shell or at the system level.
There is no executable called 'python' other than the system Python 2.7 in /usr/bin .

I do have both Python2.7.14 and Python3.6.4 installed via Homebrew, but its executable is called '/usr/local/bin/python3'. I have tried prepending /usr/bin to my PATH and running from the command line with no difference.

How can I fix this?

Question information

Language:
English Edit question
Status:
Solved
For:
Inkscape Edit question
Assignee:
No assignee Edit question
Solved by:
Ned Konz
Solved:
Last query:
Last reply:
Revision history for this message
Hachmann (marenhachmann) said :
#1

What happens when you 'unset' the PYTHONPATH for Inkscape, as it suggests in the error message?

If you cannot or would not like to switch to Inkscape 0.92.2 (or if the problem persists with Inkscape 0.92.2), can you please join the user chat and ask for someone with Mac experience to help you with the issue?

https://inkscape.org/en/community/discussion/

Revision history for this message
Ned Konz (ned-bike-nomad) said :
#2

I don't understand.

I'm not setting PYTHONPATH, the Inkscape starter script is (and I haven't changed it since it was working).

Are you suggesting that I edit that script that came with the distribution?

PYTHONPATH is not set in the environment when I start Inkscape.

Revision history for this message
Ned Konz (ned-bike-nomad) said :
#3

I just tried 0.92.2 and the same thing happens.

Revision history for this message
Hachmann (marenhachmann) said :
#4

Then please visit the chat. I cannot help with this here.

Revision history for this message
Ned Konz (ned-bike-nomad) said :
#5

I ran opensnoop and noticed that Inkscape's Python interpreter was looking in a number of library directories, including (for some unknown reason) some Python 3 library directories. I removed these and was able to run Inkscape properly again.

So despite the Python 3 library directories not being on the PYTHONPATH, they were being searched.

Revision history for this message
Hachmann (marenhachmann) said :
#6

Can you make a bug report for this, please? Or do developers already know about the issue?