[Solved] ModuleNotFoundError: No module named’usysconfigdata u x86 64-u-gnu’

Technical background

In the last blog post, I performed the update of CONDA and installed gxx with CONDA_After linux-64, when some PIP instructions are executed, the following error messages will be given:

$ python3 -m pip list
Traceback (most recent call last):
  File "/home/dechin/anaconda3/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/dechin/anaconda3/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/dechin/anaconda3/lib/python3.8/site-packages/pip/__main__.py", line 29, in <module>
    from pip._internal.cli.main import main as _main
  File "/home/dechin/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 9, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/home/dechin/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 10, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/home/dechin/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
    from pip._internal.cli import cmdoptions
  File "/home/dechin/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
    from pip._internal.cli.parser import ConfigOptionParser
  File "/home/dechin/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/parser.py", line 12, in <module>
    from pip._internal.configuration import Configuration, ConfigurationError
  File "/home/dechin/anaconda3/lib/python3.8/site-packages/pip/_internal/configuration.py", line 27, in <module>
    from pip._internal.utils.misc import ensure_dir, enum
  File "/home/dechin/anaconda3/lib/python3.8/site-packages/pip/_internal/utils/misc.py", line 42, in <module>
    from pip._internal.locations import get_major_minor_version, site_packages, user_site
  File "/home/dechin/anaconda3/lib/python3.8/site-packages/pip/_internal/locations/__init__.py", line 9, in <module>
    from . import _distutils, _sysconfig
  File "/home/dechin/anaconda3/lib/python3.8/site-packages/pip/_internal/locations/_distutils.py", line 18, in <module>
    from .base import get_major_minor_version
  File "/home/dechin/anaconda3/lib/python3.8/site-packages/pip/_internal/locations/base.py", line 14, in <module>
    site_packages = sysconfig.get_path("purelib")  # type: typing.Optional[str]
  File "/home/dechin/anaconda3/lib/python3.8/sysconfig.py", line 521, in get_path
    return get_paths(scheme, vars, expand)[name]
  File "/home/dechin/anaconda3/lib/python3.8/sysconfig.py", line 511, in get_paths
    return _expand_vars(scheme, vars)
  File "/home/dechin/anaconda3/lib/python3.8/sysconfig.py", line 172, in _expand_vars
    _extend_dict(vars, get_config_vars())
  File "/home/dechin/anaconda3/lib/python3.8/sysconfig.py", line 559, in get_config_vars
    _init_posix(_CONFIG_VARS)
  File "/home/dechin/anaconda3/lib/python3.8/sysconfig.py", line 430, in _init_posix
    _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
ModuleNotFoundError: No module named '_sysconfigdata_x86_64_conda_linux_gnu'

Problem location and solution

After a round of searching, the cause of the problem is finally located as: a backup file is lost in a certain version of Python. Usually, there are two identical in the same version of Python_ sysconfigdata_ x86_ 64_ conda_ cos6_ linux_ GNU. Py files and _ sysconfigdata_ x86_ 64_ conda_ linux_ GNU. Py file. Some programs depend on one of them during operation, so what we need to do is to retrieve whether these two files exist in the system:

$ sudo find ~ -name _sysconfigdata_x86_64*
[sudo] dechin password is:
/home/dechin/anaconda3/lib/python3.8/_sysconfigdata_x86_64_apple_darwin13_4_0.py
/home/dechin/anaconda3/lib/python3.8/__pycache__/_sysconfigdata_x86_64_apple_darwin13_4_0.cpython-38.pyc
/home/dechin/anaconda3/lib/python3.8/_sysconfigdata_x86_64_conda_cos6_linux_gnu.py

Here we find that there is only one under the Python 3.8 Path currently used_sysconfigdata_x86_64_conda_cos6_linux_GNU.Py file without _sysconfigdata_x86_64_conda_linux_Gnu.py file, so we only need to make a copy of the file:

$ cp /home/dechin/anaconda3/lib/python3.8/_sysconfigdata_x86_64_conda_cos6_linux_gnu.py /home/dechin/anaconda3/lib/python3.8/_sysconfigdata_x86_64_conda_linux_gnu.py

At this time, execute the PIP instruction again:

$ python3 -m pip listPackage                            Version
---------------------------------- -----------------
absl-py                            0.13.0
adamod                             0.0.3
affinity                           0.1.0
alabaster                          0.7.12
anaconda-client                    1.8.0
anaconda-navigator                 1.10.0
anaconda-project                   0.10.1
anyio                              2.2.0
...

Successful operation, problem solved.

Summary summary

In the recent version update of CONDA, the files under the path may be deleted_sysconfigdata_x86_64_conda_linux_GNU module related backup file, which may be relied on during the operation of some other software, which will lead to the problem that the error module cannot be found during the operation. Finally, we solved the problem by copying and backing up the file again.

 

Similar Posts: