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

OS X virtualenv Handling is Broken #35

Closed
peblair opened this issue Sep 22, 2017 · 4 comments
Closed

OS X virtualenv Handling is Broken #35

peblair opened this issue Sep 22, 2017 · 4 comments

Comments

@peblair
Copy link

peblair commented Sep 22, 2017

When running hatch install -l, the following error appears:

Installing...
Obtaining file:///Users/pblair/views/test-project
Installing collected packages: test-project
  Running setup.py develop for test-project
    Complete output from command /opt/local/bin/python3 -c "import setuptools, tokenize;__file__='/Users/pblair/views/test-project/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" develop --no-deps:
    running develop
    error: can't create or remove files in install directory

    The following error occurred while trying to add or remove files in the
    installation directory:

        [Errno 13] Permission denied: '/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/test-easy-install-67789.write-test'

    The installation directory you specified (via --install-dir, --prefix, or
    the distutils default setting) was:

        /opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/

    Perhaps your account does not have write access to this directory?  If the
    installation directory is a system-owned directory, you may need to sign in
    as the administrator or "root" account.  If you do not have administrative
    access to this machine, you may wish to choose a different installation
    directory, preferably one that is listed in your PYTHONPATH environment
    variable.

    For information on other options, you may wish to consult the
    documentation at:

      https://setuptools.readthedocs.io/en/latest/easy_install.html

    Please make the appropriate changes for your system and try again.

The problem appears to be in the virutualenv handling:

 λ test-project git:(master) ✗ > hatch shell . pip --version
Running `pip --version` in this project's env...
pip 9.0.1 from /opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (python 3.6)
 λ test-project git:(master) ✗ > . ./venv/bin/activate && pip --version && deactivate
pip 9.0.1 from /Users/pblair/views/test-project/venv/lib/python3.6/site-packages (python 3.6)
 λ test-project git:(master) ✗ >

Further investigation seems to indicate that the culprit is the __PYENV_LAUNCHER__ variable:

 λ test-project git:(master) ✗ > hatch shell . env | grep LAUNCHER
__PYVENV_LAUNCHER__=/opt/local/bin/python3
 λ test-project git:(master) ✗ > . ./venv/bin/activate && (env | grep LAUNCHER) && deactivate

And, sure enough, unsetting it manually fixes the issue:

 λ test-project git:(master) ✗ > hatch shell .
source "/Users/pblair/views/test-project/venv/bin/activate"
 λ test-project git:(master) ✗ > source "/Users/pblair/views/test-project/venv/bin/activate"
(venv) λ test-project git:(master) ✗ > pip --version
pip 9.0.1 from /opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (python 3.6)
(venv) λ test-project git:(master) ✗ > unset __PYVENV_LAUNCHER__
(venv) λ test-project git:(master) ✗ > env | grep LAUNCHER
(venv) λ test-project git:(master) ✗ > pip --version
pip 9.0.1 from /Users/pblair/views/test-project/venv/lib/python3.6/site-packages (python 3.6)
(venv) λ test-project git:(master) ✗ >

Would it be possible to add a del os.environ["__PYVENV_LAUNCHER__"] in the venv code to remedy this problem?

@ofek
Copy link
Collaborator

ofek commented Sep 22, 2017

Found this too https://bugs.python.org/issue22490

I'm working on it now!

@ofek ofek closed this as completed in 0cee5c4 Sep 22, 2017
@ofek
Copy link
Collaborator

ofek commented Sep 22, 2017

@belph Please try fix in 0.17.1 and let me know!

@peblair
Copy link
Author

peblair commented Sep 22, 2017

Yes, that seems to have fixed it. Thank you!

@ofek
Copy link
Collaborator

ofek commented Sep 23, 2017

Yay, thanks for the report!

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

No branches or pull requests

2 participants