anaconda bug?

George Trojan george.trojan at noaa.gov
Tue Mar 17 12:51:03 EDT 2015


On 03/16/2015 11:47 PM, memilanuk wrote:
> Might be just you...
>
> monte at machin-shin:~$ python
> Python 3.4.3 |Continuum Analytics, Inc.| (default, Mar  6 2015, 12:03:53)
> [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import tkinter
> >>> tkinter.Tk()
> <tkinter.Tk object at 0x7ff4c6fc8160>
> >>>
>
>
> Just for the heck of it I created a new venv (using conda create -n 
> test) and tried it again.  Same thing.
>
> How are you creating your venv?
>
> Monte
>
>

Hmm. I tried on the different system (Fedora 20), with Python 3.4.2. 
Same results:

dilbert at gtrojan> python
Python 3.4.2 |Continuum Analytics, Inc.| (default, Oct 21 2014, 17:16:37)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
 >>> import tkinter
 >>> tkinter.Tk()
<tkinter.Tk object at 0x7f5713951630>
 >>>
dilbert at gtrojan> which pyvenv
/usr/local/miniconda3/bin/pyvenv
dilbert at gtrojan> pyvenv --system-site-packages ~/test
dilbert at gtrojan> source ~/test/bin/activate
(test) dilbert at gtrojan> python
Python 3.4.2 |Continuum Analytics, Inc.| (default, Oct 21 2014, 17:16:37)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
 >>> import tkinter
 >>> tkinter.Tk()
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/usr/local/miniconda3/lib/python3.4/tkinter/__init__.py", line 
1851, in __init__
     self.tk = _tkinter.create(screenName, baseName, className, 
interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: Can't find a usable init.tcl in the following 
directories:
     /opt/anaconda1anaconda2anaconda3/lib/tcl8.5 
/home/gtrojan/test/lib/tcl8.5 /home/gtrojan/lib/tcl8.5 
/home/gtrojan/test/library /home/gtrojan/library 
/home/gtrojan/tcl8.5.15/library /home/tcl8.5.15/library

This probably means that Tcl wasn't installed properly.
 >>>

I suspect faulty logic: pyvenv does not copy/links the tcl/tk libraries 
to the newly created directory. When I run python directly, the second 
directory to search is /usr/local/miniconda3/lib/tcl8.5, where conda 
puts its tcl version. In virtual environment, the path is replaced and 
tkinter fails. So the other fix would be to manually create symlinks 
after running pyvenv, or modify Continuum Analytics pyvenv to do that.
There is no issue with pyvenv when Python is built from the source, the 
first directory in the path is where tcl is found by configure and that 
does not change in virtual environment.

I found another similar bug report here: 
https://groups.google.com/a/continuum.io/forum/#!topic/anaconda/Q9xvJT8khTs
Looks this has not been fixed.

George





More information about the Python-list mailing list