Try ERPNext Buy Support Partners Foundation

Bench init frappe-bench issue pkg_resources.DistributionNotFound: The 'virtualenv==16.6.0'

i have successfully installed below mentioned packages,

**Python, MariaDB, Nginx,Git,Nodejs,yarn,Redis,wkhtmltopdf, virtualenv**

while executing bench init command, it show mentioned error. kindly suggestion solution.

bench init frappe-bench
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 6, in
from pkg_resources import load_entry_point
File “/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py”, line 3251, in
@_call_aside
File “/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py”, line 3235, in _call_aside
f(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py”, line 3264, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File “/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py”, line 583, in _build_master
ws.require(requires)
File “/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py”, line 900, in require
needed = self.resolve(parse_requirements(requirements))
File “/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py”, line 786, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The ‘virtualenv==16.6.0’ distribution was not found and is required by frappe-bench

Can you say the result of: virtualenv --version ?

virtualenv --version
Traceback (most recent call last):
File “/usr/local/bin/virtualenv”, line 7, in
from virtualenv import main
ImportError: cannot import name main

also tried to check status.

sudo apt-get install virtualenv
[sudo] password for frappe:
Reading package lists… Done
Building dependency tree
Reading state information… Done
virtualenv is already the newest version (15.1.0+ds-1).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

if your virtualenv package was installed via apt, uninstall it and perhaps let it be handled by python. Install it via pip, python3 -m pip install virtualenv or re-install the package with python3 -m pip install --no-cache-dir --force-reinstall virtualenv

removed virtualenv with command
sudo apt-get remove virtualenv

install
pip install virtualenv

check version
virtualenv --version
Traceback (most recent call last):
File “/usr/local/bin/virtualenv”, line 7, in
from virtualenv import main
ImportError: cannot import name main

this post may address same issue,

my computer command response.

frappe@mahavir:~$ python
Python 2.7.13 (default, Sep 26 2018, 18:42:22)
[GCC 6.3.0 20170516] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

import virtualenv
virtualenv.file
‘/home/frappe/.local/lib/python2.7/site-packages/virtualenv/init.pyc’

KeyboardInterrupt

exit
Use exit() or Ctrl-D (i.e. EOF) to exit

frappe@mahavir:~$ python3
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import virtualenv
virtualenv.file
‘/usr/lib/python3/dist-packages/virtualenv.py’

anyway it may help.