在 Nixos 上设置 Kubespray python 项目

在 Nixos 上设置 Kubespray python 项目
nix-shell -p libffi openssl python37Packages.virtualenv python37Packages.virtualenvwrapper python37Packages.pip python37Packages.setuptools
...
Collecting certifi>=2017.4.17 (from requests>=2.21.0->hvac==0.8.2->-r requirements.txt (line 5))
  Using cached https://files.pythonhosted.org/packages/b9/63/df50cac98ea0d5b006c55a399c3bf1db9da7b5a24de7890bc9cfd5dd9e99/certifi-2019.11.28-py2.py3-none-any.whl
Collecting idna<2.9,>=2.5 (from requests>=2.21.0->hvac==0.8.2->-r requirements.txt (line 5))
  Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography->ansible==2.7.12->-r requirements.txt (line 1))
Installing collected packages: MarkupSafe, jinja2, PyYAML, pycparser, cffi, cryptography, bcrypt, pynacl, paramiko, ansible, netaddr, pbr, chardet, urllib3, certifi, idna, requests, hvac, jmespath, ruamel.yaml
ERROR: Could not install packages due to an EnvironmentError: [Errno 30] Read-only file system: '/nix/store/4c3z5r6yxsf2cxwwyazhdn92xixn4j5b-python3-3.7.5/lib/python3.7/site-packages/MarkupSafe-1.1.1.dist-info'

WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

有没有我可以使用的解决方法,而无需为上述内容创建某种形式的 nix 派生?

我注意到,python37Packages.bootstrapped-pip但是这失败了,因为我需要unset SOURCE_DATE_EPOCH在 nix 之前这样做,这是“nix 魔法”......

    File "/nix/store/4c3z5r6yxsf2cxwwyazhdn92xixn4j5b-python3-3.7.5/lib/python3.7/zipfile.py", line 357, in __init__
      raise ValueError('ZIP does not support timestamps before 1980')
  ValueError: ZIP does not support timestamps before 1980

答案1

人们可以用它virtualenv来处理这个问题:

python3 -m venv env
source env/bin/activate

相关内容