[Nix-dev] Need help with virtualenv and python2.6

Jascha Geerds jg at ekby.de
Wed Aug 20 20:56:47 CEST 2014


Hi there,

I'm currently struggling with virtualenv and python2.6. I've a work
related project which sadly uses the old python2.6 interpreter and a
bunch of python dependencies specified in a requirements.txt. Because
most of the dependencies aren't available in NixOS (and even more not in
the correct version), I want to use virtualenv with pip to set up a dev
environment.

Unfortunately, I can't create a virtual environment with python2.6:

[jascha at loshi:~]$ mkvirtualenv foobar -p
/nix/store/ymysni3zc4y2khppj4b3vvlxbkwqvdgk-python-2.6.9/bin/python2.6
Running virtualenv with interpreter
/nix/store/ymysni3zc4y2khppj4b3vvlxbkwqvdgk-python-2.6.9/bin/python2.6
Traceback (most recent call last):
  File
  "/nix/store/4s9dqqfg28zp3cm62nsli610nni3xwy5-python2.7-virtualenv-1.11.4/lib/python2.7/site-packages/virtualenv.py",
  line 2335, in <module>
    main()
  File
  "/nix/store/4s9dqqfg28zp3cm62nsli610nni3xwy5-python2.7-virtualenv-1.11.4/lib/python2.7/site-packages/virtualenv.py",
  line 824, in main
    symlink=options.symlink)
  File
  "/nix/store/4s9dqqfg28zp3cm62nsli610nni3xwy5-python2.7-virtualenv-1.11.4/lib/python2.7/site-packages/virtualenv.py",
  line 984, in create_environment
    site_packages=site_packages, clear=clear, symlink=symlink))
  File
  "/nix/store/4s9dqqfg28zp3cm62nsli610nni3xwy5-python2.7-virtualenv-1.11.4/lib/python2.7/site-packages/virtualenv.py",
  line 1151, in install_python
    fix_lib64(lib_dir, symlink)
  File
  "/nix/store/4s9dqqfg28zp3cm62nsli610nni3xwy5-python2.7-virtualenv-1.11.4/lib/python2.7/site-packages/virtualenv.py",
  line 1543, in fix_lib64
    if [p for p in distutils.sysconfig.get_config_vars().values()
  File
  "/nix/store/c5kna2kla5nf02kllzkd50bws58qp59r-python2.7-distutils.cfg/lib/python2.7/site-packages/distutils/sysconfig.py",
  line 453, in get_config_vars
    func()
  File
  "/nix/store/c5kna2kla5nf02kllzkd50bws58qp59r-python2.7-distutils.cfg/lib/python2.7/site-packages/distutils/sysconfig.py",
  line 397, in _init_posix
    from _sysconfigdata import build_time_vars
ImportError: No module named _sysconfigdata


Of course, creating a virtual environment with python2.7 works without
problems. It also work with python2.6 on debian systems. What I already
know:

- "mkvirtualenv" (virtualenvwrapper) isn't the problem. I tried plain
virtualenv as well
- In the example above I used myEnvFun for python2.6. However,
installing python2.6 via "nix-env -i" doesn't solve the problem
- I can import the needed module interactively in a python2.7 shell
- I cannot import it in a python2.6 shell. However, this seems to be
normal (can't import it with python2.6 on debian systems as well)

Any suggestions? or is there an easier way to set up a dev environment
with python2.6 and quite old python deps? I've no idea how to debug this
problem. I guess it has something to do with PYTHONPATH or something
like that? 

This bug report may be helpful:
https://bugs.launchpad.net/ubuntu/+source/python2.7/+bug/1115466
> Python has been recently multiarched, virtualenv should be fixed 
> to include multiarch python locations.

Thanks for your help!

-- 
  Jascha Geerds
  jg at ekby.de


More information about the nix-dev mailing list