0

I was trying to use pipenv on Ubuntu 20.04 and got a perplexing error message. First, you must install pipenv. Install pipenv locally, not system wide, or you get into a whole different can of worms!

  > pip3 install --user pipenv

and be sure add ~/.local/bin to the head of your PATH environment variable. When you try to use pipenv, you get an error:

      > pipenv --python 3.8
      Creating a virtualenv for this project…
      Pipfile: /home/alan/expr/pydemo-10.05.a/Pipfile
      Using /usr/bin/python3.8 (3.8.2) to create virtualenv…
      ⠙ Creating virtual environment...ModuleNotFoundError: No module named 'virtualenv.seed.via_app_data'

      ✘ Failed creating virtual environment 

      [pipenv.exceptions.VirtualenvCreationException]: 
      Failed to create virtual environment.

What is the problem here?

1 Answer 1

1

I was fortunate enough to stumble onto the answer in this thread concerning the underlying implementation of virtualenv:

  > sudo pip3 uninstall virtualenv            # the latest version is broken
  > sudo pip3   install virtualenv==20.0.23   # this version works

At this point, you can use pipenv normally:

  > pipenv --python 3.8
  Creating a virtualenv for this project…
  Pipfile: /home/alan/expr/pydemo-10.05.a/Pipfile
  Using /usr/bin/python3.8 (3.8.2) to create virtualenv…
  ⠸ Creating virtual environment...created virtual environment CPython3.8.2.final.0-64 in 235ms
    creator CPython3Posix(dest=/home/alan/.local/share/virtualenvs/pydemo-10.05.a-MQUKFB85, clear=False, global=False)
    seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=/home/alan/.local/share/virtualenv/seed-app-data/v1.0.1)
    activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator

  ✔ Successfully created virtual environment! 
  Virtualenv location: /home/alan/.local/share/virtualenvs/pydemo-10.05.a-MQUKFB85
  Creating a Pipfile for this project…

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .