pypa / virtualenv

Virtual Python Environment builder
https://virtualenv.pypa.io
MIT License
4.83k stars 1.03k forks source link

No module named 'virtualenv.seed.via_app_data' #1989

Closed akrejczinger closed 4 years ago

akrejczinger commented 4 years ago

Issue

This is a duplicate of #1873, because that issue was closed and I cannot comment on it. I have the same issue, it is still not resolved. I tried installing virtualenv both by sudo apt install python3-virtualenv and sudo pip3 install virtualenv. I removed the apt version before trying with pip. The problem is the same in both cases.

Environment

% pip3 list
Package                      Version
---------------------------- --------------------
appdirs                      1.4.4
apturl                       0.5.2
argcomplete                  1.8.1
argh                         0.26.2
astroid                      2.4.2
attrs                        20.2.0
awscli                       1.18.159
bcrypt                       3.1.7
blessings                    1.6
blinker                      1.4
botocore                     1.18.18
bpython                      0.18
Brlapi                       0.7.0
CacheControl                 0.12.6
cachy                        0.3.0
catfish                      1.4.13
certifi                      2019.11.28
chardet                      3.0.4
cleo                         0.7.6
Click                        7.0
clikit                       0.4.3
colorama                     0.4.3
command-not-found            0.3
crashtest                    0.3.1
cryptography                 2.8
cupshelpers                  1.0
curtsies                     0.3.1
dbus-python                  1.2.16
defer                        1.0.6
distlib                      0.3.1
distro                       1.4.0
distro-info                  0.23ubuntu1
dnspython                    2.0.0
docutils                     0.15.2
duplicity                    0.8.12.0
entrypoints                  0.3
fasteners                    0.14.1
filelock                     3.0.12
future                       0.18.2
greenlet                     0.4.15
html5lib                     1.1
httpie                       2.2.0
httplib2                     0.14.0
idna                         2.8
importlib-metadata           1.5.0
isort                        5.6.4
jeepney                      0.4.3
jmespath                     0.10.0
jsonschema                   3.2.0
keyring                      20.0.1
language-selector            0.1
launchpadlib                 1.10.13
lazr.restfulclient           0.14.2
lazr.uri                     1.0.3
lazy-object-proxy            1.4.3
lightdm-gtk-greeter-settings 1.2.2
lockfile                     0.12.2
louis                        3.12.0
macaroonbakery               1.3.1
Mako                         1.1.0
MarkupSafe                   1.1.0
mccabe                       0.6.1
menulibre                    2.2.1
monotonic                    1.5
more-itertools               4.2.0
msgpack                      0.6.2
mugshot                      0.4.2
netifaces                    0.10.4
oauthlib                     3.1.0
olefile                      0.46
onboard                      1.4.1
packaging                    20.4
paramiko                     2.6.0
pastel                       0.2.1
pathtools                    0.1.2
pbr                          5.5.1
pexpect                      4.8.0
Pillow                       7.0.0
pip                          20.0.2
pkginfo                      1.5.0.1
poetry                       1.0.10
poetry-core                  1.0.0
protobuf                     3.6.1
psutil                       5.5.1
ptyprocess                   0.6.0
pyasn1                       0.4.8
pycairo                      1.16.2
pycups                       1.9.73
Pygments                     2.7.1
PyGObject                    3.36.0
PyJWT                        1.7.1
pylev                        1.3.0
pylint                       2.6.0
pymacaroons                  0.13.0
PyNaCl                       1.3.0
pynvim                       0.4.1
pyparsing                    2.4.7
pyRFC3339                    1.1
pyrsistent                   0.14.11
python-apt                   2.0.0+ubuntu0.20.4.1
python-dateutil              2.7.3
python-debian                0.1.36ubuntu1
pytz                         2019.3
pyxattr                      0.6.1
pyxdg                        0.26
PyYAML                       5.3.1
ranger-fm                    1.9.3
reportlab                    3.5.34
requests                     2.22.0
requests-toolbelt            0.8.0
requests-unixsocket          0.2.0
rsa                          4.5
s3transfer                   0.3.3
SecretStorage                3.1.2
setproctitle                 1.1.10
setuptools                   45.2.0
sgt-launcher                 0.2.5
shellingham                  1.3.2
simplejson                   3.16.0
six                          1.15.0
systemd-python               234
testresources                2.0.1
toml                         0.10.1
tomlkit                      0.5.11
ubuntu-advantage-tools       20.3
ubuntu-drivers-common        0.0.0
ufw                          0.36
unattended-upgrades          0.1
urllib3                      1.25.8
usb-creator                  0.3.7
vboxapi                      1.0
virtualenv                   20.0.35
virtualenv-clone             0.3.0
vpn-slice                    0.14.4
wadllib                      1.3.3
watchdog                     0.9.0
wcwidth                      0.1.8
webencodings                 0.5.1
wheel                        0.34.2
wrapt                        1.12.1
xcffib                       0.8.1
xkit                         0.0.0
youtube-dl                   2020.3.24
zipp                         1.0.0

Output of the virtual environment creation

Make sure to run the creation with -vvv --with-traceback:

% virtualenv my_env -vvv --with-traceback
44 setup logging to NOTSET [DEBUG report:43]
61 find interpreter for spec PythonSpec(path=/usr/bin/python3) [INFO builtin:44]
61 proposed PythonInfo(spec=CPython3.8.5.final.0-64, exe=/usr/bin/python3, platform=linux, version='3.8.5 (default, Jul 28 2020, 12:59:40) \n[GCC 9.3.0]', encoding_fs_io=utf-8-utf-8) [INFO builtin:50]
61 accepted PythonInfo(spec=CPython3.8.5.final.0-64, exe=/usr/bin/python3, platform=linux, version='3.8.5 (default, Jul 28 2020, 12:59:40) \n[GCC 9.3.0]', encoding_fs_io=utf-8-utf-8) [DEBUG builtin:52]
62 filesystem is case-sensitive [DEBUG info:28]
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 8, in <module>
    sys.exit(run_with_catch())
  File "/usr/local/lib/python3.8/dist-packages/virtualenv/__main__.py", line 62, in run_with_catch
    run(args, options)
  File "/usr/local/lib/python3.8/dist-packages/virtualenv/__main__.py", line 16, in run
    session = cli_run(args, options)
  File "/usr/local/lib/python3.8/dist-packages/virtualenv/run/__init__.py", line 26, in cli_run
    of_session = session_via_cli(args, options, setup_logging)
  File "/usr/local/lib/python3.8/dist-packages/virtualenv/run/__init__.py", line 42, in session_via_cli
    parser, elements = build_parser(args, options, setup_logging)
  File "/usr/local/lib/python3.8/dist-packages/virtualenv/run/__init__.py", line 69, in build_parser
    SeederSelector(interpreter, parser),
  File "/usr/local/lib/python3.8/dist-packages/virtualenv/run/plugin/seeders.py", line 8, in __init__
    possible = self.options("virtualenv.seed")
  File "/usr/local/lib/python3.8/dist-packages/virtualenv/run/plugin/base.py", line 39, in options
    cls._OPTIONS = cls.entry_points_for(key)
  File "/usr/local/lib/python3.8/dist-packages/virtualenv/run/plugin/base.py", line 18, in entry_points_for
    return OrderedDict((e.name, e.load()) for e in cls.entry_points().get(key, {}))
  File "/usr/local/lib/python3.8/dist-packages/virtualenv/run/plugin/base.py", line 18, in <genexpr>
    return OrderedDict((e.name, e.load()) for e in cls.entry_points().get(key, {}))
  File "/usr/lib/python3.8/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'virtualenv.seed.via_app_data'
gaborbernat commented 4 years ago

Post the output of:

/usr/bin/python3 -c 'import sys; import os; print("\n".join(i for i in sys.path if os.path.exists(os.path.join(os.path.abspath(i), "virtualenv"))))'
akrejczinger commented 4 years ago

I actually reinstalled virtualenv a couple of times, investigating the issue. My environment changed since I opened the ticket. I don't know what I did differently this time, but reinstalling again via pip3, it works. My guess is that the apt and pip versions of virtualenv were both installed / not removed correctly and it caused issues.