I removed system wise frappe-bench, and tried to install in virtual environment.
frappe@cc:~$ which bench
# Nothing in output, so bench is not installed.
frappe@cc:~$ bench
-bash: bench: command not found
frappe@cc:~$ python3 -m venv venvRai
frappe@cc:~$ source venvRai/bin/activate
(venvRai) frappe@cc:~$ pip3 install frappe-bench
It installled following packages:
Successfully installed MarkupSafe-3.0.2 certifi-2024.8.30 charset-normalizer-3.4.0
click-8.1.7 frappe-bench-5.22.9 gitdb-4.0.11 gitpython-3.1.43 honcho-2.0.0 idna-3.10
jinja2-3.1.4 python-crontab-2.6.0 python-dateutil-2.9.0.post0 requests-2.32.3
semantic-version-2.10.0 six-1.16.0 smmap-5.0.1 urllib3-2.2.3
(venvRai) frappe@cc:~$
But still faced the same issue:
(venvRai) frappe@cc:~$ which bench
/home/frappe/venvRai/bin/bench
(venvRai) frappe@cc:~$ bench init frappe-bench
Traceback (most recent call last):
File "/home/frappe/venvRai/bin/bench", line 8, in <module>
sys.exit(cli())
^^^^^
File "/home/frappe/venvRai/lib/python3.11/site-packages/bench/cli.py", line 74, in cli
cmd_from_sys = get_cmd_from_sysargv()
^^^^^^^^^^^^^^^^^^^^^^
File "/home/frappe/venvRai/lib/python3.11/site-packages/bench/utils/__init__.py", line 581, in get_cmd_from_sysargv
if sys_argv.index(arg) == 0 and arg in Bench(".").apps:
^^^^^^^^^^
File "/home/frappe/venvRai/lib/python3.11/site-packages/bench/bench.py", line 67, in __init__
self.apps = BenchApps(self)
^^^^^^^^^^^^^^^
File "/home/frappe/venvRai/lib/python3.11/site-packages/bench/bench.py", line 177, in __init__
self.initialize_apps()
File "/home/frappe/venvRai/lib/python3.11/site-packages/bench/bench.py", line 284, in initialize_apps
self.apps.remove("frappe")
ValueError: list.remove(x): x not in list
(venvRai) frappe@cc:~$
and same for bench --version
:
(venvRai) frappe@cc:~$ bench --version
Traceback (most recent call last):
File "/home/frappe/venvRai/bin/bench", line 8, in <module>
sys.exit(cli())
^^^^^
File "/home/frappe/venvRai/lib/python3.11/site-packages/bench/cli.py", line 74, in cli
cmd_from_sys = get_cmd_from_sysargv()
^^^^^^^^^^^^^^^^^^^^^^
File "/home/frappe/venvRai/lib/python3.11/site-packages/bench/utils/__init__.py", line 581, in get_cmd_from_sysargv
if sys_argv.index(arg) == 0 and arg in Bench(".").apps:
^^^^^^^^^^
File "/home/frappe/venvRai/lib/python3.11/site-packages/bench/bench.py", line 67, in __init__
self.apps = BenchApps(self)
^^^^^^^^^^^^^^^
File "/home/frappe/venvRai/lib/python3.11/site-packages/bench/bench.py", line 177, in __init__
self.initialize_apps()
File "/home/frappe/venvRai/lib/python3.11/site-packages/bench/bench.py", line 284, in initialize_apps
self.apps.remove("frappe")
ValueError: list.remove(x): x not in list