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

Installer resolves links and does not handle spaces in paths #1070

Closed
jnewman-altair opened this issue Oct 11, 2016 · 3 comments
Closed

Installer resolves links and does not handle spaces in paths #1070

jnewman-altair opened this issue Oct 11, 2016 · 3 comments

Comments

@jnewman-altair
Copy link

I received the following when attempting to install:

$ curl -L https://aka.ms/InstallAzureCli | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 167 100 167 0 0 210 0 --:--:-- --:--:-- --:--:-- 248
100 1048 100 1048 0 0 940 0 0:00:01 0:00:01 --:--:-- 940
Downloading Azure CLI install script from https://azurecliprod.blob.core.windows.net/install.py to /tmp/azure_cli_install_tmp_8637.

################################################################## 100.0%

Running install script.
In what directory would you like to place the install? (leave blank to use /usr/local/az): /share/software/azure
We will install at '/users/jnewman/Documents/Virtual Machines/share/software/azure'.
In what directory would you like to place the executable? (leave blank to use /usr/local/bin): /share/software/bin
The executable will be in '/users/jnewman/Documents/Virtual Machines/share/software/bin'.
Executing: /usr/bin/python virtualenv.py --python /usr/bin/python /users/jnewman/Documents/Virtual Machines/share/software/azure
Already using interpreter /usr/bin/python
There must be only one argument: DEST_DIR (you gave /users/jnewman/Documents/Virtual Machines/share/software/azure)
Usage: virtualenv.py [OPTIONS] DEST_DIR

Options:
--version show program's version number and exit
-h, --help show this help message and exit
-v, --verbose Increase verbosity.
-q, --quiet Decrease verbosity.
-p PYTHON_EXE, --python=PYTHON_EXE
The Python interpreter to use, e.g.,
--python=python2.5 will use the python2.5 interpreter
to create the new environment. The default is the
interpreter that virtualenv was installed with
(/usr/bin/python)
--clear Clear out the non-root install and start from scratch.
--no-site-packages DEPRECATED. Retained only for backward compatibility.
Not having access to global site-packages is now the
default behavior.
--system-site-packages
Give the virtual environment access to the global
site-packages.
--always-copy Always copy files rather than symlinking.
--unzip-setuptools Unzip Setuptools when installing it.
--relocatable Make an EXISTING virtualenv environment relocatable.
This fixes up scripts and makes all .pth files
relative.
--no-setuptools Do not install setuptools in the new virtualenv.
--no-pip Do not install pip in the new virtualenv.
--no-wheel Do not install wheel in the new virtualenv.
--extra-search-dir=DIR
Directory to look for setuptools/pip distributions in.
This option can be used multiple times.
--download Download preinstalled packages from PyPI.
--no-download, --never-download
Do not download preinstalled packages from PyPI.
--prompt=PROMPT Provides an alternative prompt prefix for this
environment.
--setuptools DEPRECATED. Retained only for backward compatibility.
This option has no effect.
--distribute DEPRECATED. Retained only for backward compatibility.
This option has no effect.
Traceback (most recent call last):
File "/tmp/azure_cli_install_tmp_8637", line 148, in
main()
File "/tmp/azure_cli_install_tmp_8637", line 136, in main
create_virtualenv(tmp_dir, VIRTUALENV_VERSION, install_dir)
File "/tmp/azure_cli_install_tmp_8637", line 77, in create_virtualenv
exec_command('{0} virtualenv.py --python {0} {1}'.format(sys.executable, install_dir), cwd=working_dir)
File "/tmp/azure_cli_install_tmp_8637", line 58, in exec_command
check_call(command_list, cwd=cwd, env=env)
File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python', 'virtualenv.py', '--python', '/usr/bin/python', '/users/jnewman/Documents/Virtual', 'Machines/share/software/azure']' returned non-zero exit status 2

probalby need to do a shlex.split on the command if you're not using shell=True.

@derekbekoe
Copy link
Member

derekbekoe commented Oct 28, 2016

Whilst the referenced PR will fix the virtual environment error that you see, pip will still fail later with an error such as bash: /users/jnewman/Documents/Virtual Machines/share/software/azure/bin/pip: "/users/jnewman/Documents/Virtual: bad interpreter: No such file or directory.

This is due to a bug in virtualenv/pip where whitespaces in virtualenv paths aren't handled correctly:
Whitespace in root path of virtualenv breaks scripts #53
pip does not support spaces in directories names #923

@derekbekoe derekbekoe removed their assignment Oct 28, 2016
@derekbekoe derekbekoe added the FAQ label Nov 16, 2016
@derekbekoe
Copy link
Member

Marking this as FAQ.
Pip and virtualenv don't work well with whitespace in paths.
We'll warn the user on curl install if their path contains whitespace.

@yajna-pandith
Copy link

yajna-pandith commented May 7, 2020

I am getting the following error when I execute this command:
mkvirtualenv <ENV_NAME> --python=python VERSION

Already using interpreter /usr/bin/python
There must be only one argument: DEST_DIR
Usage: virtualenv [OPTIONS] DEST_DIR

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

5 participants