Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting unrequested parenthesis around the prompt when using the --prompt option of virtualenv #2337

Open
fantauzzi opened this issue Apr 27, 2022 · 3 comments

Comments

@fantauzzi
Copy link

fantauzzi commented Apr 27, 2022

Issue
I am creating a virtualenv with a given prompt, and the prompt I provide gets surrounded by parenthesis.
After activating the virtualenv, I would like to have the given prompt only, without parentheses added around it.

E.g. I make the virtualenv with:

virtualenv -p /usr/bin/python3 --prompt "-" /home/fanta/.local/virtualenv/python3.10

And the prompt I get, after activating the virtualenv, is:

(-)

I expected it to be:

-

Environment

Provide at least:

  • OS: Ubuntu 22.04 LTS
  • pip list of the host python where virtualenv is installed:
apturl                  0.5.2
bcrypt                  3.2.0
blinker                 1.4
Brlapi                  0.8.3
certifi                 2020.6.20
chardet                 4.0.0
click                   8.0.3
colorama                0.4.4
command-not-found       0.3
cryptography            3.4.8
cupshelpers             1.0
dbus-python             1.2.18
defer                   1.0.6
distlib                 0.3.4
distro                  1.7.0
distro-info             1.1build1
duplicity               0.8.21
fasteners               0.14.1
filelock                3.6.0
future                  0.18.2
httplib2                0.20.2
idna                    3.3
importlib-metadata      4.6.4
jeepney                 0.7.1
keyring                 23.5.0
language-selector       0.1
launchpadlib            1.10.16
lazr.restfulclient      0.14.4
lazr.uri                1.0.6
lockfile                0.12.2
louis                   3.20.0
macaroonbakery          1.3.1
Mako                    1.1.3
MarkupSafe              2.0.1
monotonic               1.6
more-itertools          8.10.0
netifaces               0.11.0
oauthlib                3.2.0
olefile                 0.46
paramiko                2.9.3
pexpect                 4.8.0
Pillow                  9.0.1
pip                     22.0.2
platformdirs            2.5.1
protobuf                3.12.4
ptyprocess              0.7.0
pycairo                 1.20.1
pycups                  2.0.1
PyGObject               3.42.0
PyJWT                   2.3.0
pymacaroons             0.13.0
PyNaCl                  1.5.0
pyparsing               2.4.7
pyRFC3339               1.1
python-apt              2.3.0+ubuntu2
python-dateutil         2.8.1
python-debian           0.1.43ubuntu1
pytz                    2022.1
pyxdg                   0.27
PyYAML                  5.4.1
reportlab               3.6.8
requests                2.25.1
screen-resolution-extra 0.0.0
SecretStorage           3.3.1
setuptools              59.6.0
six                     1.16.0
systemd-python          234
ubuntu-advantage-tools  27.7
ubuntu-drivers-common   0.0.0
ufw                     0.36.1
unattended-upgrades     0.1
urllib3                 1.26.5
usb-creator             0.3.7
virtualenv              20.13.0+ds
wadllib                 1.3.6
wheel                   0.37.1
xdg                     5
xkit                    0.0.0
zipp                    1.0.0

Output of the virtual environment creation

Make sure to run the creation with -vvv --with-traceback:

fanta@tardis:~$ virtualenv -p /usr/bin/python3  --prompt "-" -vvv --with-traceback /home/fanta/.local/virtualenv/python3.10
83 setup logging to NOTSET [DEBUG report:39]
88 find interpreter for spec PythonSpec(path=/usr/bin/python3) [INFO builtin:62]
88 proposed PythonInfo(spec=CPython3.10.4.final.0-64, exe=/usr/bin/python3, platform=linux, version='3.10.4 (main, Apr  2 2022, 09:04:19) [GCC 11.2.0]', encoding_fs_io=utf-8-utf-8) [INFO builtin:69]
88 accepted PythonInfo(spec=CPython3.10.4.final.0-64, exe=/usr/bin/python3, platform=linux, version='3.10.4 (main, Apr  2 2022, 09:04:19) [GCC 11.2.0]', encoding_fs_io=utf-8-utf-8) [DEBUG builtin:71]
90 filesystem is case-sensitive [DEBUG info:29]
116 create virtual environment via CPython3Posix(dest=/home/fanta/.local/virtualenv/python3.10, clear=False, no_vcs_ignore=False, global=False) [INFO session:52]
116 create folder /home/fanta/.local/virtualenv/python3.10/bin [DEBUG _sync:24]
116 create folder /home/fanta/.local/virtualenv/python3.10/lib/python3.10/site-packages [DEBUG _sync:24]
116 write /home/fanta/.local/virtualenv/python3.10/pyvenv.cfg [DEBUG pyenv_cfg:34]
116 	home = /usr [DEBUG pyenv_cfg:38]
116 	implementation = CPython [DEBUG pyenv_cfg:38]
116 	version_info = 3.10.4.final.0 [DEBUG pyenv_cfg:38]
116 	virtualenv = 20.13.0+ds [DEBUG pyenv_cfg:38]
116 	include-system-site-packages = false [DEBUG pyenv_cfg:38]
116 	base-prefix = /usr [DEBUG pyenv_cfg:38]
116 	base-exec-prefix = /usr [DEBUG pyenv_cfg:38]
116 	base-executable = /usr/bin/python3 [DEBUG pyenv_cfg:38]
117 symlink /usr/bin/python3 to /home/fanta/.local/virtualenv/python3.10/bin/python [DEBUG _sync:43]
117 create virtualenv import hook file /home/fanta/.local/virtualenv/python3.10/lib/python3.10/site-packages/_virtualenv.pth [DEBUG api:95]
117 create /home/fanta/.local/virtualenv/python3.10/lib/python3.10/site-packages/_virtualenv.py [DEBUG api:98]
117 ============================== target debug ============================== [DEBUG session:54]
118 debug via /home/fanta/.local/virtualenv/python3.10/bin/python /usr/lib/python3/dist-packages/virtualenv/create/debug.py [DEBUG creator:224]
117 {
  "sys": {
    "executable": "/home/fanta/.local/virtualenv/python3.10/bin/python",
    "_base_executable": "/home/fanta/.local/virtualenv/python3.10/bin/python",
    "prefix": "/home/fanta/.local/virtualenv/python3.10",
    "base_prefix": "/usr",
    "real_prefix": null,
    "exec_prefix": "/home/fanta/.local/virtualenv/python3.10",
    "base_exec_prefix": "/usr",
    "path": [
      "/usr/lib/python310.zip",
      "/usr/lib/python3.10",
      "/usr/lib/python3.10/lib-dynload",
      "/home/fanta/.local/virtualenv/python3.10/lib/python3.10/site-packages"
    ],
    "meta_path": [
      "<class '_virtualenv._Finder'>",
      "<class '_frozen_importlib.BuiltinImporter'>",
      "<class '_frozen_importlib.FrozenImporter'>",
      "<class '_frozen_importlib_external.PathFinder'>"
    ],
    "fs_encoding": "utf-8",
    "io_encoding": "utf-8"
  },
  "version": "3.10.4 (main, Apr  2 2022, 09:04:19) [GCC 11.2.0]",
  "makefile_filename": "/usr/lib/python3.10/config-3.10-x86_64-linux-gnu/Makefile",
  "os": "<module 'os' from '/usr/lib/python3.10/os.py'>",
  "site": "<module 'site' from '/usr/lib/python3.10/site.py'>",
  "datetime": "<module 'datetime' from '/usr/lib/python3.10/datetime.py'>",
  "math": "<module 'math' (built-in)>",
  "json": "<module 'json' from '/usr/lib/python3.10/json/__init__.py'>"
} [DEBUG session:55]
144 add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/fanta/.local/share/virtualenv) [INFO session:59]
148 install pip from wheel /usr/share/python-wheels/pip-22.0.2-py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:49]
148 install setuptools from wheel /usr/share/python-wheels/setuptools-59.6.0-py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:49]
149 Attempting to acquire lock 140096501803104 on /home/fanta/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-59.6.0-py3-none-any.lock [DEBUG _api:169]
149 install wheel from wheel /usr/share/python-wheels/wheel-0.37.1-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:49]
149 Attempting to acquire lock 140096501803152 on /home/fanta/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/pip-22.0.2-py3-none-any.lock [DEBUG _api:169]
149 Lock 140096501803104 acquired on /home/fanta/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-59.6.0-py3-none-any.lock [DEBUG _api:173]
149 Lock 140096501803152 acquired on /home/fanta/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/pip-22.0.2-py3-none-any.lock [DEBUG _api:173]
150 Attempting to acquire lock 140096501802768 on /home/fanta/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/wheel-0.37.1-py2.py3-none-any.lock [DEBUG _api:169]
150 Attempting to release lock 140096501803104 on /home/fanta/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-59.6.0-py3-none-any.lock [DEBUG _api:203]
150 Lock 140096501802768 acquired on /home/fanta/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/wheel-0.37.1-py2.py3-none-any.lock [DEBUG _api:173]
150 Lock 140096501803104 released on /home/fanta/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-59.6.0-py3-none-any.lock [DEBUG _api:206]
150 Attempting to release lock 140096501803152 on /home/fanta/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/pip-22.0.2-py3-none-any.lock [DEBUG _api:203]
150 Lock 140096501803152 released on /home/fanta/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/pip-22.0.2-py3-none-any.lock [DEBUG _api:206]
150 Attempting to release lock 140096501802768 on /home/fanta/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/wheel-0.37.1-py2.py3-none-any.lock [DEBUG _api:203]
150 Lock 140096501802768 released on /home/fanta/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/wheel-0.37.1-py2.py3-none-any.lock [DEBUG _api:206]
150 copy /home/fanta/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-59.6.0-py3-none-any/setuptools-59.6.0.virtualenv to /home/fanta/.local/virtualenv/python3.10/lib/python3.10/site-packages/setuptools-59.6.0.virtualenv [DEBUG _sync:51]
151 copy directory /home/fanta/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/pip-22.0.2-py3-none-any/pip to /home/fanta/.local/virtualenv/python3.10/lib/python3.10/site-packages/pip [DEBUG _sync:51]
151 copy /home/fanta/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/wheel-0.37.1-py2.py3-none-any/wheel-0.37.1.virtualenv to /home/fanta/.local/virtualenv/python3.10/lib/python3.10/site-packages/wheel-0.37.1.virtualenv [DEBUG _sync:51]
151 copy directory /home/fanta/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-59.6.0-py3-none-any/setuptools to /home/fanta/.local/virtualenv/python3.10/lib/python3.10/site-packages/setuptools [DEBUG _sync:51]
151 copy directory /home/fanta/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/wheel-0.37.1-py2.py3-none-any/wheel-0.37.1.dist-info to /home/fanta/.local/virtualenv/python3.10/lib/python3.10/site-packages/wheel-0.37.1.dist-info [DEBUG _sync:51]
154 copy directory /home/fanta/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/wheel-0.37.1-py2.py3-none-any/wheel to /home/fanta/.local/virtualenv/python3.10/lib/python3.10/site-packages/wheel [DEBUG _sync:51]
162 generated console scripts wheel3.10 wheel-3.10 wheel3 wheel [DEBUG base:45]
180 copy /home/fanta/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-59.6.0-py3-none-any/distutils-precedence.pth to /home/fanta/.local/virtualenv/python3.10/lib/python3.10/site-packages/distutils-precedence.pth [DEBUG _sync:51]
180 copy directory /home/fanta/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-59.6.0-py3-none-any/pkg_resources to /home/fanta/.local/virtualenv/python3.10/lib/python3.10/site-packages/pkg_resources [DEBUG _sync:51]
184 copy directory /home/fanta/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-59.6.0-py3-none-any/setuptools-59.6.0.dist-info to /home/fanta/.local/virtualenv/python3.10/lib/python3.10/site-packages/setuptools-59.6.0.dist-info [DEBUG _sync:51]
186 copy directory /home/fanta/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-59.6.0-py3-none-any/_distutils_hack to /home/fanta/.local/virtualenv/python3.10/lib/python3.10/site-packages/_distutils_hack [DEBUG _sync:51]
187 generated console scripts  [DEBUG base:45]
214 copy directory /home/fanta/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/pip-22.0.2-py3-none-any/pip-22.0.2.dist-info to /home/fanta/.local/virtualenv/python3.10/lib/python3.10/site-packages/pip-22.0.2.dist-info [DEBUG _sync:51]
215 copy /home/fanta/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/pip-22.0.2-py3-none-any/pip-22.0.2.virtualenv to /home/fanta/.local/virtualenv/python3.10/lib/python3.10/site-packages/pip-22.0.2.virtualenv [DEBUG _sync:51]
216 generated console scripts pip-3.10 pip3 pip3.10 pip [DEBUG base:45]
216 add activators for Bash, CShell, Fish, Nushell, PowerShell, Python [INFO session:64]
218 write /home/fanta/.local/virtualenv/python3.10/pyvenv.cfg [DEBUG pyenv_cfg:34]
218 	home = /usr [DEBUG pyenv_cfg:38]
218 	implementation = CPython [DEBUG pyenv_cfg:38]
218 	version_info = 3.10.4.final.0 [DEBUG pyenv_cfg:38]
218 	virtualenv = 20.13.0+ds [DEBUG pyenv_cfg:38]
218 	include-system-site-packages = false [DEBUG pyenv_cfg:38]
218 	base-prefix = /usr [DEBUG pyenv_cfg:38]
218 	base-exec-prefix = /usr [DEBUG pyenv_cfg:38]
218 	base-executable = /usr/bin/python3 [DEBUG pyenv_cfg:38]
218 	prompt = - [DEBUG pyenv_cfg:38]
218 created virtual environment CPython3.10.4.final.0-64 in 137ms
  creator CPython3Posix(dest=/home/fanta/.local/virtualenv/python3.10, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/fanta/.local/share/virtualenv)
    added seed packages: pip==22.0.2, setuptools==59.6.0, wheel==0.37.1
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator [WARNING __main__:19]

Workaround:

After running virtualenv, edit the activate script to remove the extra parenthesis

@fantauzzi fantauzzi added the bug label Apr 27, 2022
@gaborbernat
Copy link
Contributor

This used to be the case but we reverted this behaviour in #2224 to align with how the venv module does things.

@gaborbernat
Copy link
Contributor

What shell are you using?

@fantauzzi
Copy link
Author

bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
@gaborbernat @fantauzzi and others