Opened 20 months ago

Last modified 13 months ago

#59147 assigned defect

py*-tkinter 3.6.9 is not compatible with virtualenvs

Reported by: paulray (Paul Ray) Owned by: jmroot (Joshua Root)
Priority: Normal Milestone:
Component: ports Version: 2.6.0
Keywords: Cc:
Port: python27 python35 python36 python37 py-tkinter

Description

The preferred way to use virtualenvs is without the --system-site-packages so that the virtualenv is encapsulated and installs its own stuff. However, if your python code uses tkinter there is a problem. The base ports pythonXX do not install tkinter, it is installed by pyXX-tkinter. Unfortunately, this puts _tkinter*.so into the site-packages directory, instead of in the main python library directory. Most python installs include tkinter natively and do not require site-packages to see it, so this means you can't use tkinter without having site-packags in your path (e.g. in a virtualenv). This would not really be a problem if tkinter were installable by pip, since it could just be installed in the virtualenv. So, I'd like to see one of two solutions implemented:

  • Make pythonXX port install tkinter as part of the base python
  • Or, make pyXX-tkinter create the _tkinter*.so (or a soft link to it) in the normal python directory, so that site-packages is not required for tkinter to work.

I'm guessing that the reason that tkinter is a separate port from python itself is related to the possible variants for tk (x11, quartz) and/or so that python itself does not have a direct tk dependency.

(Note that I hacked a solution to this problem on my system using this command: % sudo ln -s /opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/_tkinter.cpython-36m-darwin.so /opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/_tkinter.cpython-36m-darwin.so Obviously this is not an optimal solution! But if this were done by port install py36-tkinter all would be good.)

Change History (4)

comment:1 Changed 20 months ago by mf2k (Frank Schima)

In the future, please add the port maintainer(s) to Cc (port info --maintainers python36 py36-tkinter), if any.

comment:2 Changed 20 months ago by mf2k (Frank Schima)

Owner: set to jmroot
Port: python27 python35 python37 py-tkinter added; py36-tkinter removed
Status: newassigned

comment:3 in reply to:  1 Changed 20 months ago by paulray (Paul Ray)

Replying to mf2k:

In the future, please add the port maintainer(s) to Cc (port info --maintainers python36 py36-tkinter), if any.

Oops, sorry. Thanks for fixing that!

comment:4 Changed 13 months ago by paulray (Paul Ray)

Is anyone considering fixing this? I keep running into this issue.

Note: See TracTickets for help on using tickets.