pythonpython-3.xvirtualenvpipenvpipfile

ModuleNotFoundError: No module named 'virtualenv.seed.via_app_data


I had installed virtualenv by sudo -H pip3 install virtualenv, and created a venv by virtualenv, but now I can't create env in my new Django project that includes Pipfile. I tried:

$ pipenv shell

But its result is:

Creating a virtualenv for this project...
Pipfile: /home/mostafa/py38/lib/python3.8/site-packages/carfix/Pipfile
Using /usr/bin/python3.8 (3.8.5) to create virtualenv...
⠹ Creating virtual environment...ModuleNotFoundError: No module named 'virtualenv.seed.via_app_data'

✘ Failed creating virtual environment

I tried these answers but the problem is not yet resolved:

  1. Answer 1

Solution

  • I finally found the solution to the problem:

    I Used poetry lockfor one app and everything worked fine!

    I Used poetry lock for a second app and received the following error message:

    $ poetry lock 
    
    Creating virtualenv mytestapp-vm7OCEgV-py3.8 in /home/alexb7217/.cache/pypoetry/virtualenvs
    
      ModuleNotFoundError
    
      No module named 'virtualenv.seed.via_app_data'
    
      at <frozen importlib._bootstrap>:973 in _find_and_load_unlocked
    

    Followed the most simple suggestion:

    $ sudo apt remove --purge python3-virtualenv
    

    Re-ran poetry-lock

    $ poetry lock  
    Updating dependenciesResolving dependencies... (1.1s)
    

    Everything works great, that's it! ;)