I’m trying to figure out how to manage python venvs in the ‘normal’ way in nixos. I do a lot of small python projects, often using other people’s code/requirements.txt so this is essential.
To start with I followed the instructions on the wiki and created a pip-shell.nix containing
{ pkgs ? import <nixpkgs> {} }:
(pkgs.buildFHSUserEnv {
name = "pipzone";
targetPkgs = pkgs: (with pkgs; [
python39
python39Packages.pip
python39Packages.virtualenv
]);
runScript = "bash";
}).env
I enter the shell and create the venv as on the wiki, then install the requirements (just numpy and matplotlib in this) with
pip install -r requriements.txt
when I try to run the simple test script such as
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 10, 100)
y = np.exp(x)
plt.plot(x, y)
plt.show()
I get libz.so.1 not found
Any idea how I can manage this type of thing in the traditional way? Preferably using my normal zsh shell or at least a shell with the same plugins/aliases etc.
Thanks
edit: I’m on 23.05 using the python3 package installed in configuration.nix