I want to use python311 with seaborn, matplotlib to do my homework, but when I run example code
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 10, 100)
y = np.sin(x)
fig, ax = plt.subplots()
ax.plot(x, y)
ax.set_xlabel('X-axis')
ax.set_ylabel('Y-axis')
ax.set_title('Sine Wave')
plt.show()
_tkinter.TclError: Can't find a usable tk.tcl in the following directories:
/nix/store/rxy496gpd84rvpz8c2whp70fzcbxdwk7-tcl-8.6.13/lib/tcl8.6/tk8.6 /nix/store/rxy496gpd84rvpz8c2whp70fzcbxdwk7-tcl-8.6.13/lib/tk8.6 /nix/store/2nzwxmvb9n18iahgszzc3lfafg3rjzmz-python3-3.11.3/lib/tk8.6 /nix/store/2nzwxmvb9n18iahgszzc3lfafg3rjzmz-python3-3.11.3/lib/tk8.6 /nix/store/lib/tk8.6 /nix/store/2nzwxmvb9n18iahgszzc3lfafg3rjzmz-python3-3.11.3/library
This probably means that tk wasn't installed properly.
a piece of configuration with tk and tkinter installed.
environment.systemPackages = with pkgs; [
(python311.withPackages(ps: with ps; [
python-lsp-server
pandas
numpy # numerical computing library
matplotlib # plotting library
seaborn # data visualization library
tkinter
vtk
pmw
]))
tk
tcl
}
I tried to switch to x11 (using plasma5)
I tried to use python311Full
I checkout the error given directories, the only exist path is /nix/store/-tcl-8.6.13/lib/tcl8.6, and there is
auto.tcl clock.tcl encoding history.tcl http1.0 init.tcl msgs opt0.4 package.tcl parray.tcl safe.tcl tclAppInit.c tclIndex tm.tcl word.tcl
no ‘tk.tcl’, and still tring to figure out some solution, but poor information on internet about this problem with nixos.
I’d like to share more information, if you ask.