Virtualenv: No module named 'virtualenv.seed.via_app_data'

Created on 24 Jun 2020  ·  27Comments  ·  Source: pypa/virtualenv

Issue

On calling virtualenv test i expect it to create a folder named test with all the virtual environment files in there. The observed behaviour is just the following message with no folder test created:
ModuleNotFoundError: No module named 'virtualenv.seed.via_app_data'

Environment

Provide at least:

  • OS: Ubuntu 20.04
  • pip list of the host python where virtualenv is installed:
Package                Version
---------------------- -------------
appdirs                1.4.4
apturl                 0.5.2
awscli                 1.17.14
blinker                1.4
botocore               1.14.14
Brlapi                 0.7.0
certifi                2019.11.28
chardet                3.0.4
chrome-gnome-shell     0.0.0
colorama               0.4.3
command-not-found      0.3
cryptography           2.8
cupshelpers            1.0
dbus-python            1.2.16
defer                  1.0.6
distlib                0.3.0
distro                 1.4.0
distro-info            0.23ubuntu1
docutils               0.16
entrypoints            0.3
filelock               3.0.12
httpie                 1.0.3
httplib2               0.14.0
idna                   2.8
importlib-metadata     1.5.0
jmespath               0.9.4
keyring                18.0.1
language-selector      0.1
launchpadlib           1.10.13
lazr.restfulclient     0.14.2
lazr.uri               1.0.3
louis                  3.12.0
macaroonbakery         1.3.1
more-itertools         4.2.0
netifaces              0.10.4
oauthlib               3.1.0
olefile                0.46
pexpect                4.6.0
Pillow                 7.0.0
pip                    20.1.1
protobuf               3.6.1
pyasn1                 0.4.2
pycairo                1.16.2
pycups                 1.9.73
Pygments               2.6.1
PyGObject              3.36.0
PyJWT                  1.7.1
pymacaroons            0.13.0
PyNaCl                 1.3.0
pyRFC3339              1.1
python-apt             2.0.0
python-dateutil        2.7.3
python-debian          0.1.36ubuntu1
pytz                   2019.3
pyxdg                  0.26
PyYAML                 5.3.1
reportlab              3.5.34
requests               2.22.0
requests-unixsocket    0.2.0
roman                  2.0.0
rsa                    4.0
s3transfer             0.3.3
SecretStorage          2.3.1
setuptools             45.2.0
simplejson             3.16.0
six                    1.14.0
systemd-python         234
ubuntu-advantage-tools 20.3
ubuntu-drivers-common  0.0.0
ufw                    0.36
unattended-upgrades    0.1
urllib3                1.25.8
virtualenv             20.0.24
wadllib                1.3.3
wheel                  0.34.2
xkit                   0.0.0
zipp                   1.0.0
  ```

**Output of the virtual environment creation**

```console
71 setup logging to NOTSET [DEBUG report:42]
88 find interpreter for spec PythonSpec(path=/usr/bin/python3) [INFO builtin:44]
88 proposed PythonInfo(spec=CPython3.8.2.final.0-64, exe=/usr/bin/python3, platform=linux, version='3.8.2 (default, Apr 27 2020, 15:53:34) \n[GCC 9.3.0]', encoding_fs_io=utf-8-utf-8) [INFO builtin:50]
88 accepted PythonInfo(spec=CPython3.8.2.final.0-64, exe=/usr/bin/python3, platform=linux, version='3.8.2 (default, Apr 27 2020, 15:53:34) \n[GCC 9.3.0]', encoding_fs_io=utf-8-utf-8) [DEBUG builtin:52]
89 filesystem is case-sensitive [DEBUG info:28]
Traceback (most recent call last):
  File "/home/florian/.local/bin/virtualenv", line 8, in <module>
    sys.exit(run_with_catch())
  File "/home/florian/.local/lib/python3.8/site-packages/virtualenv/__main__.py", line 63, in run_with_catch
    run(args, options)
  File "/home/florian/.local/lib/python3.8/site-packages/virtualenv/__main__.py", line 17, in run
    session = cli_run(args, options)
  File "/home/florian/.local/lib/python3.8/site-packages/virtualenv/run/__init__.py", line 24, in cli_run
    session = session_via_cli(args, options)
  File "/home/florian/.local/lib/python3.8/site-packages/virtualenv/run/__init__.py", line 32, in session_via_cli
    parser, elements = build_parser(args, options)
  File "/home/florian/.local/lib/python3.8/site-packages/virtualenv/run/__init__.py", line 60, in build_parser
    SeederSelector(interpreter, parser),
  File "/home/florian/.local/lib/python3.8/site-packages/virtualenv/run/plugin/seeders.py", line 8, in __init__
    possible = self.options("virtualenv.seed")
  File "/home/florian/.local/lib/python3.8/site-packages/virtualenv/run/plugin/base.py", line 39, in options
    cls._OPTIONS = cls.entry_points_for(key)
  File "/home/florian/.local/lib/python3.8/site-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 "/home/florian/.local/lib/python3.8/site-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'
question

Most helpful comment

Our boxes appeared to have both debian versions and pip versions installed.. but even after removing the debian version I couldn't get this to work with the latest (20.0.25) pip version. Everything works with...

sudo pip3 install virtualenv==20.0.23

All 27 comments

How did you install virtualenv?

sudo apt install python3-virtualenv

i already removed and reinstalled it multiple times with no success.

In this case, the issue isn't with virtualenv the project, but Debians repackaging, so please report your issue under http://bugs.debian.org/cgi-bin/pkgreport.cgi?package=python3-virtualenv

In the meantime, you might use our alternative installation methods to get the non debian version https://virtualenv.pypa.io/en/latest/installation.html#installation

@kitterma FYI

Thank you very much for the very fast response... i will try the alternate install method.

UPDATE:
I removed it with apt remove and tried the installation method with pip which said it was already installed. After trying to reinstall with --force-reinstall everything is working fine.

Thanks. The last Ubuntu release happened at a point where I was still working through some issues in Debian. I don't work on Ubuntu directly, so I'm not sure on the details.

I'm glad reinstalling resolved your issue.

@kitterma note that he reinstalled it with pip, note apt-get... so per se this is still broken at Debian level.

Thanks. Missed that. I haven't tested on Ubuntu. It works on Debian though.

Does it, what's your virtualenv version? Note virtualenv 20.0.24 refactored the internal implementation detail module seed... so Debian patching is likely broken unless you fixed that since then.

I'll check and make sure once I'm in front of a computer again.

Note virtualenv 20.0.24 refactored the internal implementation detail module seed... so Debian patching is likely broken unless you fixed that since then.

Ubuntu 20.04 has version 20.0.17.

The traceback in the issue points at /home/florian/.local/lib/python3.8/site-packages/virtualenv/ so I'm guessing @make-ing had installed 2.0.24 through pip, and that install was somehow broken. This would be before the Ubuntu virtualenv module in sys.path.

Our boxes appeared to have both debian versions and pip versions installed.. but even after removing the debian version I couldn't get this to work with the latest (20.0.25) pip version. Everything works with...

sudo pip3 install virtualenv==20.0.23

@gaborbernat I haven't packaged 2.0.24 yet, so anything 2.0.24 in Debian or Ubuntu isn't distro packaging related.

So it's as detailed above just users installing virtualenv both via pip and via apt at the same time and conflict between the repositories trigger this. Any way Debian can raise some error in such cases?

I hit this issue on ubuntu bionic as well when installing virtualenv with pip (not apt-get). Downgrading to 20.0.23 also solved it in my case.

I can also confirm that downgrading version to 20.0.23 solves the problem for focal fossa.

I have the same problem. How to make the downgrade?

@ruannyury pip uninstall virtualenv then pip install virtualenv==20.0.23

In all these cases downgrading it's not the actual solution. It might fix the issue for now but you'll get an outdated version of the software. You'd better find out why you have two versions installed in parallel and remove both, and then install the new one.

How to find out? forgiveness for the inconvenience

My OS is Manjaro 20.0.3

pip uninstall virtualenv, pip uninstall virtualenv? (Do it twice)

In the second time:
`ERROR: Exception:
Traceback (most recent call last):
File "/usr/lib/python3.8/shutil.py", line 788, in move
os.rename(src, real_dst)
OSError: [Errno 18] Link entre dispositivos inválido: '/usr/bin/virtualenv' -> '/tmp/pip-uninstall-mpsr19ya/virtualenv'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 186, in _main
status = self.run(options, args)
File "/usr/lib/python3.8/site-packages/pip/_internal/commands/uninstall.py", line 78, in run
uninstall_pathset = req.uninstall(
File "/usr/lib/python3.8/site-packages/pip/_internal/req/req_install.py", line 687, in uninstall
uninstalled_pathset.remove(auto_confirm, verbose)
File "/usr/lib/python3.8/site-packages/pip/_internal/req/req_uninstall.py", line 394, in remove
moved.stash(path)
File "/usr/lib/python3.8/site-packages/pip/_internal/req/req_uninstall.py", line 283, in stash
renames(path, new_path)
File "/usr/lib/python3.8/site-packages/pip/_internal/utils/misc.py", line 334, in renames
shutil.move(old, new)
File "/usr/lib/python3.8/shutil.py", line 803, in move
os.unlink(src)
PermissionError: [Errno 13] Permissão negada: '/usr/bin/virtualenv'
`
Should I use the sudo?

Maybe you installed it with your os installer, try to uninstall that too?

With the super user?
update: I got it.
So, do I install again?

Lubuntu 20.04 I had the same problem. Resolved by reverting to virtualenv==20.0.23

In all these cases downgrading it's not the actual solution. It might fix the issue for now but you'll get an outdated version of the software. You'd better find out why you have two versions installed in parallel and remove both, and then install the new one.

Was this page helpful?
0 / 5 - 0 ratings