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

Result of create_bootstrap_script fails without virtualenv #767

Closed
asottile opened this issue Jun 3, 2015 · 7 comments
Closed

Result of create_bootstrap_script fails without virtualenv #767

asottile opened this issue Jun 3, 2015 · 7 comments

Comments

@asottile
Copy link
Contributor

asottile commented Jun 3, 2015

Here's the simplest reproduction I could come up with (the actual case is slightly more complicated in pre-commit/pre-commit.com#52)

# make.py
import io
import virtualenv

with io.open('f.py', 'w') as f:
    f.write(virtualenv.create_bootstrap_script(
        'def adjust_options(options, args):\n'
        '    args[:] = ["venv-bootstrapped"]\n',
    ))
# test.sh
set -ex

virtualenv --version
virtualenv venv >& /dev/null
. venv/bin/activate
pip install virtualenv >& /dev/null
python make.py
# Verify the script works when virtualenv is installed
python f.py
# Cool
rm -rf venv-bootstrapped
pip uninstall -y virtualenv
# Womp
python f.py

Runtime:

root@042dbf41e80c:/build# ./test.sh
++ virtualenv --version
13.0.3
++ virtualenv venv
++ . venv/bin/activate
+++ deactivate nondestructive
+++ unset pydoc
+++ '[' -n '' ']'
+++ '[' -n '' ']'
+++ '[' -n /bin/bash -o -n '' ']'
+++ hash -r
+++ '[' -n '' ']'
+++ unset VIRTUAL_ENV
+++ '[' '!' nondestructive = nondestructive ']'
+++ VIRTUAL_ENV=/build/venv
+++ export VIRTUAL_ENV
+++ _OLD_VIRTUAL_PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+++ PATH=/build/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+++ export PATH
+++ '[' -n '' ']'
+++ '[' -z '' ']'
+++ _OLD_VIRTUAL_PS1=
+++ '[' x '!=' x ']'
++++ basename /build/venv
+++ '[' venv = __ ']'
++++ basename /build/venv
+++ PS1='(venv)'
+++ export PS1
+++ alias 'pydoc=python -m pydoc'
+++ '[' -n /bin/bash -o -n '' ']'
+++ hash -r
++ pip install virtualenv
++ python make.py
++ python f.py
Using real prefix '/usr'
New python executable in venv-bootstrapped/bin/python
Installing setuptools, pip, wheel...done.
++ rm -rf venv-bootstrapped
++ pip uninstall -y virtualenv
Uninstalling virtualenv-13.0.3:
  Successfully uninstalled virtualenv-13.0.3
++ python f.py
Using real prefix '/usr'
New python executable in venv-bootstrapped/bin/python
Cannot find a wheel for setuptools
Cannot find a wheel for pip
Installing setuptools, pip, wheel...
  Complete output from command /build/venv-bootstrapped/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel:
  Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named pip
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "f.py", line 2367, in <module>
    main()
  File "f.py", line 834, in main
    symlink=options.symlink)
  File "f.py", line 1006, in create_environment
    install_wheel(to_install, py_executable, search_dirs)
  File "f.py", line 971, in install_wheel
    'PIP_NO_INDEX': '1'
  File "f.py", line 912, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /build/venv-bootstrapped/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel failed with error code 1
@bukzor
Copy link

bukzor commented Jun 5, 2015

I suspect that this feature should be deleted from virtualenv, spun off into its own, separate project where it can be better loved.

@stale
Copy link

stale bot commented Jan 14, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Just add a comment if you want to keep it open. Thank you for your contributions.

@stale stale bot added the wontfix label Jan 14, 2019
@asottile
Copy link
Contributor Author

this is still a problem, I suspect @bukzor is correct in assessment. Perhaps this can be closed in favor of #1092

@stale stale bot removed the wontfix label Jan 14, 2019
@gaborbernat
Copy link
Contributor

I think this is more a problem of documentation. The create bootstrap script works but the way it's intended to be used is to replace the virtualenv.py rather than exists on its own. Maybe we should also generate (copy) the other files alongside it, zip it, and ship it like that to the user?

@asottile
Copy link
Contributor Author

at the time of writing this issue, dc96555 wasn't in the documentation (which is more "documenting this bug" than fixing it imo)

@stale
Copy link

stale bot commented Apr 15, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Just add a comment if you want to keep it open. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 15, 2019
@gaborbernat
Copy link
Contributor

In a post rewrite world this no longer exists, so closing for now.

@pypa pypa locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants