Virtualenv: Error with _sysconfigdata_nd.py missing in /usr/lib/python2.7/ for Ubuntu 13.04

Created on 16 Mar 2013  ·  11Comments  ·  Source: pypa/virtualenv

Hello! I'm testing the new Ubuntu beta version 13.04 and I'm having trouble with some virtualenv import error. I had this output while trying to build firefox:

Creating Python environment
Cannot find file /usr/include/x86_64-linux-gnu/python2.7 (bad symlink)
New python executable in /home/marco/bernardo/FD/src/obj-x86_64-unknown-linux-gnu/_virtualenv/bin/python2.7
Not overwriting existing python script /home/marco/bernardo/FD/src/obj-x86_64-unknown-linux-gnu/_virtualenv/bin/python (you must use /home/marco/bernardo/FD/src/obj-x86_64-unknown-linux-gnu/_virtualenv/bin/python2.7)
Installing setuptools...................................
  Complete output from command /home/marco/bernardo...ualenv/bin/python2.7 -c "#!python
\"\"\"Bootstra...sys.argv[1:])

" /home/bernardo/bernardo...ols-0.6c11-py2.7.egg:
  Traceback (most recent call last):
  File "<string>", line 278, in <module>
  File "<string>", line 239, in main
  File "/home/bernardo/bernardo/FD/src/python/virtualenv/virtualenv_support/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 1712, in main
  File "/home/marco/bernardo/FD/src/python/virtualenv/virtualenv_support/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 1700, in with_ei_usage
  File "/home/marco/bernardo/FD/src/python/virtualenv/virtualenv_support/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 1716, in <lambda>
  File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 971, in run_command
    cmd_obj.ensure_finalized()
  File "/usr/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
    self.finalize_options()
  File "/home/marco/bernardo/FD/src/python/virtualenv/virtualenv_support/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 125, in finalize_options
  File "/home/marco/bernardo/FD/src/python/virtualenv/virtualenv_support/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 1121, in _expand
  File "/usr/lib/python2.7/distutils/cmd.py", line 312, in get_finalized_command
    cmd_obj.ensure_finalized()
  File "/usr/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
    self.finalize_options()
  File "/home/marco/bernardo/FD/src/python/virtualenv/virtualenv_support/setuptools-0.6c11-py2.7.egg/setuptools/command/install.py", line 32, in finalize_options
  File "/usr/lib/python2.7/distutils/command/install.py", line 321, in finalize_options
    (prefix, exec_prefix) = get_config_vars('prefix', 'exec_prefix')
  File "/home/marco/bernardo/FD/src/obj-x86_64-unknown-linux-gnu/_virtualenv/lib/python2.7/distutils/__init__.py", line 92, in sysconfig_get_config_vars
    real_vars = old_get_config_vars(*args)
  File "/usr/lib/python2.7/distutils/sysconfig.py", line 503, in get_config_vars
    func()
  File "/usr/lib/python2.7/distutils/sysconfig.py", line 447, in _init_posix
    from _sysconfigdata import build_time_vars
  File "/usr/lib/python2.7/_sysconfigdata.py", line 6, in <module>
    from _sysconfigdata_nd import *
ImportError: No module named _sysconfigdata_nd
----------------------------------------
...Installing setuptool...

Searching for some kind of solution, I found this ticket at Ubuntu's but tracker describing the same problem I was having. Reading the comments there was a workaround to fix the problem, but there was also a comment saying that this is a virtualenv problem, as you can see here. I thought that it would be nice to open this ticket to see if I can help with something.

Most helpful comment

sudo rm /usr/lib/python2.7/_sysconfigdata_nd.py
sudo ln -fs /usr/lib/python2.7/plat-i386-linux-gnu/_sysconfigdata_nd.py /usr/lib/python2.7/

In my case, Ubuntu 13.04.

All 11 comments

@berinhard I had the same problem, this problem is in Ubuntu's Python package, to solves problem create a symbolic link of the file:

ln -fs /usr/lib/python2.7/plat-x86_64-linux-gnu/_sysconfigdata.py /usr/lib/python2.7/

Don't forgot this one too:

sudo ln -fs /usr/lib/python2.7/plat-x86_64-linux-gnu/_sysconfigdata_nd.py /usr/lib/python2.7/

sudo rm /usr/lib/python2.7/_sysconfigdata_nd.py
sudo ln -fs /usr/lib/python2.7/plat-i386-linux-gnu/_sysconfigdata_nd.py /usr/lib/python2.7/

In my case, Ubuntu 13.04.

I did the same thing.

On Fri, Jun 21, 2013 at 5:54 PM, emetemunoy [email protected]:

sudo rm /usr/lib/python2.7/_sysconfigdata_nd.py
sudo ln -fs /usr/lib/python2.7/plat-i386-linux-gnu/_sysconfigdata_nd.py
/usr/lib/python2.7/
In my case, Ubuntu 13.04.


Reply to this email directly or view it on GitHubhttps://github.com/pypa/virtualenv/issues/410#issuecomment-19824257
.

Arnaud

thanks..!!

@cleberjsantos tks ! work for me.

for the ubuntu 14.04 this problem arises due to the visualization

their is 2 methods to solve this problem .

just make an link to the _sysconfigdata_nd

$ ln -fs /usr/lib/python2.7/plat-x86_64-linux-gnu/_sysconfigdata.py /usr/lib/python2.7/
$ sudo ln -fs /usr/lib/python2.7/plat-x86_64-linux-gnu/_sysconfigdata_nd.py /usr/lib/python2.7/

thats it
now you will able to get the python2.7 console

use the virtual one

for exapmle to make an virtual python2.7
you can use the this command:

$ virtualenv --python=python2.7 py2
$ cd py2
$ source bin/activate

now you will see that py2 before your ubuntu@ubnutu , like

(py2)ubuntu@ubuntu$

now when you type the python you will see the python2.7 console

similarly you can do it for the python3 too

On Ubuntu 17.10 I still have the error:(
and I did what you suggest :(

I had the same problem with python3.5. After some time debugging I finally found out the solution. If you are using python3.5, the name of configuration file is "_sysconfigdata_m.py". Here's the code you wanna use:
sudo rm /usr/lib/python3.5/_sysconfigdata.py
sudo ln -fs /usr/lib/python3.5/plat-x86_64-linux-gnu/_sysconfigdata_m.py /usr/lib/python3.5/
sudo mv /usr/lib/python3.5/_sysconfigdata_m.py /usr/lib/python3.5/_sysconfigdata.py

I got this error on the service,and i did not have the root privileges, i can not run the command sudo, then what should i do to deal with this?

This issue usually arises when conda environment is installed. Therefore the environment should be activated before typing python . to enable a evironment source activate name-of-environment . To create environment conda create --name env1 python=2.7

Was this page helpful?
0 / 5 - 0 ratings