Hi there!
I am having this issue with using Python pandas. It was working fine up until I moved my venv folder and broke it, so I had to reinstall the packages and since then I get this error.
Traceback (most recent call last):
File "/home/nix/Desktop/Python/v21/v21.py", line 19, in <module>
import pandas as pd
File "/home/nix/Desktop/Python/venv_1/lib/python3.11/site-packages/pandas/__init__.py", line 46, in <module>
from pandas.core.api import (
File "/home/nix/Desktop/Python/venv_1/lib/python3.11/site-packages/pandas/core/api.py", line 47, in <module>
from pandas.core.groupby import (
File "/home/nix/Desktop/Python/venv_1/lib/python3.11/site-packages/pandas/core/groupby/__init__.py", line 1, in <module>
from pandas.core.groupby.generic import (
File "/home/nix/Desktop/Python/venv_1/lib/python3.11/site-packages/pandas/core/groupby/generic.py", line 67, in <module>
from pandas.core.frame import DataFrame
File "/home/nix/Desktop/Python/venv_1/lib/python3.11/site-packages/pandas/core/frame.py", line 142, in <module>
from pandas.core.generic import (
File "/home/nix/Desktop/Python/venv_1/lib/python3.11/site-packages/pandas/core/generic.py", line 187, in <module>
from pandas.core.window import (
File "/home/nix/Desktop/Python/venv_1/lib/python3.11/site-packages/pandas/core/window/__init__.py", line 1, in <module>
from pandas.core.window.ewm import (
File "/home/nix/Desktop/Python/venv_1/lib/python3.11/site-packages/pandas/core/window/ewm.py", line 11, in <module>
import pandas._libs.window.aggregations as window_aggregations
ImportError: libstdc++.so.6: cannot open shared object file: No such file or directory
Based on this page: Packaging/Quirks and Caveats - NixOS Wiki
I am supposed to create a shell.nix file that looks like this:
{ pkgs ? (import <nixpkgs> {}).pkgs }:
with pkgs;
mkShell {
buildInputs = [
python3Packages.virtualenv # run virtualenv .
python3Packages.pyqt5 # avoid installing via pip
python3Packages.pyusb # fixes the pyusb 'No backend available' when installed directly via pip
];
shellHook = ''
# fixes libstdc++ issues and libgl.so issues
LD_LIBRARY_PATH=${stdenv.cc.cc.lib}/lib/:/run/opengl-driver/lib/
# fixes xcb issues :
QT_PLUGIN_PATH=${qt5.qtbase}/${qt5.qtbase.qtPluginPrefix}
'';
}
I am mostly new to NixOS and I have no idea what shell.nix is… I also am unable to find any useful information on how to use it.
Could someone please assist to helping me understand how to implement this fix? Best case scenario is being able to add it to configuration.nix so it continues to be a 1 file solution.
I am using NixOS 23.11 (updated from 23.05), with a single configuration.nix file.
configuration.nix
{ config, lib, pkgs, ... }:
{
system.autoUpgrade.enable = true;
system.autoUpgrade.allowReboot = false;
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
#Laptop stuff
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# COMMENT IF NOT USING NVIDIA!!!!!! The below is all for Nvidia driver stuff
# Laptop stuff
#intel
#boot.kernelParams = [ "module_blacklist=i915" ];
#AMD
#boot.kernelParams = [ "module_blacklist=amdgpu" ];
# hardware.nvidia.prime = {
# offload = {
# enable = true;
# enableOffloadCmd = true;
# };
# intelBusId = "PCI:0:2:0";
# nvidiaBusId = "PCI:1:0:0";
# };
# NVIDIA Make sure opengl is enabled
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
# NVIDIA Tell Xorg to use the nvidia driver (also valid for Wayland)
services.xserver.videoDrivers = [ "nvidia" ];
#boot.initrd.kernelModules = [ "nvidia" ];
#boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11 ];
hardware.nvidia = {
# NVIDIA Modesetting is needed for most wayland compositors
modesetting.enable = true;
# NVIDIA Use the open source version of the kernel module. Only available for driver 515.43.04+
open = false;
# NVIDIA Enable the nvidia settings menu
nvidiaSettings = true;
powerManagement.enable = true;
# NVIDIA Optionally, you may need to select the apporpriate driver version for your specific GPU
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Setup keyfile
boot.initrd.secrets = {
"/crypto_keyfile.bin" = null;
};
# Enable swap on luks. SPECIFIC TO MAIN DESKTOP
boot.initrd.luks.devices."luks-xxxxxxxxxxxxxxxx".device = "/dev/disk/by-uuid/xxxxxxxxxxxxxxxx";
boot.initrd.luks.devices."luks-xxxxxxxxxxxxxxxxxxx".keyFile = "/crypto_keyfile.bin";
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "Europe/Bucharest";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "ro_RO.UTF-8";
LC_IDENTIFICATION = "ro_RO.UTF-8";
LC_MEASUREMENT = "ro_RO.UTF-8";
LC_MONETARY = "ro_RO.UTF-8";
LC_NAME = "ro_RO.UTF-8";
LC_NUMERIC = "ro_RO.UTF-8";
LC_PAPER = "ro_RO.UTF-8";
LC_TELEPHONE = "ro_RO.UTF-8";
LC_TIME = "ro_RO.UTF-8";
};
# Enable the X11 windowing system.
services.xserver.enable = true;
# Enable the KDE Plasma Desktop Environment.
services.xserver.displayManager.sddm.enable = true;
services.xserver.desktopManager.plasma5.enable = true;
# Configure keymap in X11
services.xserver = {
layout = "us";
xkbVariant = "";
};
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.nix = {
isNormalUser = true;
description = "nix";
extraGroups = [ "networkmanager" "wheel" "adbusers" ];
packages = with pkgs; [
#firefox
kate
#thunderbird
];
};
# Autostart scripts for user
systemd.services.i2p = {
description = "I2P service.";
after = ["network.target"];
serviceConfig = {
Type = "simple";
};
serviceConfig = {
User = "nix";
};
script = "/run/current-system/sw/bin/i2prouter-plain";
enable = true; # Start automatically
wantedBy = [ "multi-user.target" ];
};
systemd.services.ipfs = {
description = "IPFS service.";
after = ["network.target"];
unitConfig = {
Type = "simple";
};
serviceConfig = {
User = "nix";
};
script = "/run/current-system/sw/bin/ipfs daemon";
enable = true; # Start automatically
wantedBy = [ "multi-user.target" ];
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
hardware.xone.enable = true; # For Xone xbox controller support
environment.plasma5.excludePackages = with pkgs.libsForQt5; [
elisa
okular
plasma-browser-integration
print-manager
];
# Installing unstable packages, as in up to date ones.
# This lets you install packages like "unstable.bitwarden" instead of "pkgs.bitwarden"
nixpkgs.config = {
packageOverrides = pkgs: {
unstable = import (builtins.fetchTarball https://github.com/nixos/nixpkgs/tarball/nixos-unstable) {
config = config.nixpkgs.config;
};
};
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
pkgs.mullvad-vpn
# Browser
pkgs.librewolf
pkgs.ungoogled-chromium
pkgs.mullvad-browser
unstable.firefox
pkgs.tor-browser-bundle-bin
# Social
unstable.ferdium
pkgs.signal-desktop
pkgs.element-desktop
pkgs.teams-for-linux # Fucking Microsoft
pkgs.gajim #XMPP
# Remote Connect Applications
unstable.rustdesk
pkgs.realvnc-vnc-viewer
pkgs.virt-viewer # SPICE client for Proxmox
pkgs.remmina
# Applications
unstable.bitwarden
pkgs.nedit # Text editor for LARGE text files.
unstable.freetube
pkgs.onlyoffice-bin
unstable.libsForQt5.kalk # KDE Calculator
unstable.libsForQt5.ksystemlog # KDE System logs (Same as journalctl -f just in a GUI)
pkgs.glogg # Other System logs reader
unstable.libsForQt5.kolourpaint # KDE Paint
pkgs.okteta # KDE Hex editor
pkgs.spotify
pkgs.vlc
pkgs.jetbrains.pycharm-community
pkgs.gpa # PGP or GPG key editor/user
pkgs.jellyfin-media-player
pkgs.flameshot
pkgs.gnome-decoder # QR generator and scanner
pkgs.onionshare-gui
pkgs.qdirstat
pkgs.persepolis
pkgs.sqlitebrowser
unstable.fluent-reader # RSS feed reader
unstable.localsend
unstable.filezilla
# Media stuff:
pkgs.handbrake
pkgs.krita # Photoshop alternative... Ish...
unstable.digikam # Also installs showfoto
pkgs.shotwell
unstable.obs-studio
pkgs.simplescreenrecorder
unstable.vokoscreen-ng
#Game stuff
pkgs.cataclysm-dda
pkgs.bottles
unstable.heroic
unstable.steam
pkgs.protonup-qt
unstable.scanmem # game conqueror
pkgs.prismlauncher # Minecraft
# VM stuff
unstable.distrobox
pkgs.virt-manager
pkgs.gnome.gnome-boxes
pkgs.android-studio
# System stuff
(pkgs.python3.withPackages(ps: with ps; [ pip requests pynput pyautogui pycryptodome pysocks ]))
pkgs.cifs-utils # SMB share requirement
pkgs.xorg.xhost # Needed for distrobox to work. xhost to give access to container.
unstable.podman-compose
unstable.podman
pkgs.pciutils
pkgs.lm_sensors
linuxKernel.packages.linux_zen.xone # Xbox controller dongle support
pkgs.wget
pkgs.git
pkgs.p7zip
pkgs.jre_minimal # Java
pkgs.jdk # Java
unstable.i2p # P2P Internet protocol.
unstable.kubo # Go-based implementation of IPFS
# unstable.lokinet # Oxen lokinet protocol. Disabled since doesn't work and you don't use it.
pkgs.appimage-run # To run appimages
unstable.gvfs # Needed for apps in Distrobox
];
#Samba share mount
services.gvfs.enable = true;
fileSystems."/mnt/xxxxxxx" = {
device = "//192.168.0.xxx/hdd";
fsType = "cifs";
options = let
# This line prevents hanging on network split
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout-60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=15s,uid=1000,gid=100";
in ["${automount_opts},username=xxxxxxxx,password=xxxxxxxxxx"];
};
# Shell aliases.
environment.shellAliases = {
py = "python3";
};
# Opening steam ports
programs.steam = {
enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
};
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
programs.adb.enable = true;
programs.mtr.enable = true;
programs.gnupg.agent = {
enable = true;
};
# List services that you want to enable:
services.flatpak.enable = true;
services.mullvad-vpn.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.05"; # Did you read the comment?
# Variable for Gnome-Boxes / Virt-manager to work
virtualisation.libvirtd.enable = true;
programs.dconf.enable = true;
# Needed for podman to work, so that distrobox works.
virtualisation = {
podman = {
enable = true;
# Create a 'docker' alias for podman, to use it as a drop in replacement
dockerCompat = true;
# Required for containers under podman-compose to be able to talk to each other
defaultNetwork.settings.dns_enabled = true;
};
};
# Commands that run on system startup.
# xhost line is for distrobox to have permission to the display.
# flatpak to add repo if it doesn't exist.
environment.shellInit = ''
[ -n "$DISPLAY" ] && xhost +si:localuser:$USER || true
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
'';
# https://nixos.wiki/wiki/Environment_variables
# Setting variables
#environment.sessionVariables = rec {
#QT_PLUGIN_PATH = ""; # distrobox fix: Could not load the Qt platform plugin "xcb" in "" even though it was found. Didn't work so not implementing.
#XDG_CACHE_HOME = "$HOME/.cache";
#XDG_CONFIG_HOME = "$HOME/.config";
#XDG_DATA_HOME = "$HOME/.local/share";
#XDG_STATE_HOME = "$HOME/.local/state";
# Not officially in the specification
#XDG_BIN_HOME = "$HOME/.local/bin";
#PATH = [
# "${XDG_BIN_HOME}"
#];
#};
# TEMP fix to not being able to update due to insecure packages.
nixpkgs.config.permittedInsecurePackages = [
#"electron-25.9.0"
];
# Swappiness to reduce swapfile usage.
boot.kernel.sysctl = { "vm.swappiness" = 10;};
}
Thank you in advance!