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

Permission denied with Python 3.4 #171

Closed
pytoxbot opened this issue Sep 17, 2016 · 7 comments
Closed

Permission denied with Python 3.4 #171

pytoxbot opened this issue Sep 17, 2016 · 7 comments

Comments

@pytoxbot
Copy link

$ tox --version
1.7.1 imported from /Users/myint/Library/Python/3.4/lib/python/site-packages/tox/__init__.py

$ virtualenv --version
1.11.5

$ pip --version
pip 1.5.5 from /Users/myint/Library/Python/3.4/lib/python/site-packages (python 3.4)

$ python --version
Python 3.4.0

$ uname -a
Darwin macbookpro.local 13.1.0 Darwin Kernel Version 13.1.0: Wed Apr  2 23:52:02 PDT 2014; root:xnu-2422.92.1~2/RELEASE_X86_64 x86_64

$ git clone https://github.com/jcrocholl/pep8
$ cd pep8
$ tox -e py34
GLOB sdist-make: /Users/myint/tmp/show/pep8/setup.py
py34 create: /Users/myint/tmp/show/pep8/.tox/py34
py34 inst: /Users/myint/tmp/show/pep8/.tox/dist/pep8-1.5.7a0.zip
ERROR: invocation failed, logfile: /Users/myint/tmp/show/pep8/.tox/py34/log/py34-1.log
ERROR: actionid=py34
msg=installpkg
cmdargs=[local('/Users/myint/tmp/show/pep8/.tox/py34/bin/pip'), 'install', '--pre', '/Users/myint/tmp/show/pep8/.tox/dist/pep8-1.5.7a0.zip']
env={'HISTSIZE': '10000', '__CF_USER_TEXT_ENCODING': '0x1F5:0:0', 'TERM_PROGRAM': 'iTerm.app', 'C_INCLUDE_PATH': '/Users/myint/local/include:/opt/local/include:', 'LANG': 'en_US.UTF-8', '_': '/Users/myint/Library/Python/3.4/bin/tox', 'EDITOR': "vim -c ':0'", 'COMMAND_MODE': 'unix2003', 'PATH': '/Users/myint/tmp/show/pep8/.tox/py34/bin:/Users/myint/.cabal/bin:/Users/myint/Library/Python/3.4/bin:/Users/myint/local/bin:/Users/myint/dotfiles/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin', 'GIT_PS1_SHOWDIRTYSTATE': '1', 'LS_COLORS': 'no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mng=01;35:*.pcx=01;35:*.m4a=01;35:*.mov=01;35:*.mp4=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:', 'TERM': 'xterm-256color', '__PYVENV_LAUNCHER__': '/opt/local/bin/python', 'GIT_PS1_SHOWUNTRACKEDFILES': '1', 'SSH_AUTH_SOCK': '/tmp/launch-wwoDIO/Listeners', 'Apple_PubSub_Socket_Render': '/tmp/launch-SXo6Tz/Render', 'COMP_KNOWN_HOSTS_WITH_HOSTFILE': '', 'TMPDIR': '/var/folders/yl/dlrlbmgx2nqcwn6qfrrkf7440000gn/T/', 'ITERM_PROFILE': 'Default', 'DYLD_LIBRARY_PATH': '/Users/myint/local/lib:', 'PWD': '/Users/myint/tmp/show/pep8', 'SHELL': '/opt/local/bin/bash', 'MANPATH': '/Users/myint/local/share/man:/Users/myint/local/man:/opt/local/share/man:', '__CHECKFIX1436934': '1', 'COLORFGBG': '0;15', 'HISTFILESIZE': '10000', 'LOGNAME': 'myint', 'PKG_CONFIG_PATH': '/Users/myint/local/lib/pkgconfig:', 'OLDPWD': '/Users/myint/tmp/show', 'ITERM_SESSION_ID': 'w3t0p0', 'PS1': '\\[\\e[01;32m\\]\\u@\\h\\[\\e[00m\\]:\\[\\e[01;34m\\]\\w\\[\\e[00m\\]$(__git_ps1 " \\[\\e[01;31m\\](%s)\\[\\e[00m\\]")\\n\\$ ', 'LIBRARY_PATH': '/Users/myint/local/lib:/opt/local/lib:', 'CPLUS_INCLUDE_PATH': '/Users/myint/local/include:/opt/local/include:', 'ACK_PAGER': 'less -FRSX', 'USER': 'myint', 'HOME': '/Users/myint', 'PYTHONIOENCODING': 'utf_8', 'CLICOLOR': 'yes', 'SHLVL': '1', 'OBJCPLUS_INCLUDE_PATH': '/Users/myint/local/include:/opt/local/include:', 'OBJC_INCLUDE_PATH': '/Users/myint/local/include:/opt/local/include:', 'SECURITYSESSIONID': '186a4', 'PYTHONHASHSEED': '2745185536'}
Unpacking ./.tox/dist/pep8-1.5.7a0.zip
  Running setup.py (path:/var/folders/yl/dlrlbmgx2nqcwn6qfrrkf7440000gn/T/pip-figzwl8d-build/setup.py) egg_info for package from file:https:///Users/myint/tmp/show/pep8/.tox/dist/pep8-1.5.7a0.zip

    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'testsuite'
    warning: no previously-included files matching '*.pyo' found under directory 'testsuite'
    no previously-included directories found matching 'docs/_build'
Installing collected packages: pep8
  Found existing installation: pep8 1.5.6
    Uninstalling pep8:
      Successfully uninstalled pep8
  Running setup.py install for pep8

    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'testsuite'
    warning: no previously-included files matching '*.pyo' found under directory 'testsuite'
    no previously-included directories found matching 'docs/_build'
    error: could not create '/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pep8.py': Permission denied
    Complete output from command /opt/local/bin/python -c "import setuptools, tokenize;__file__='/var/folders/yl/dlrlbmgx2nqcwn6qfrrkf7440000gn/T/pip-figzwl8d-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/yl/dlrlbmgx2nqcwn6qfrrkf7440000gn/T/pip-_rjf1t94-record/install-record.txt --single-version-externally-managed --compile:
    running install

running build

running build_py

creating build

creating build/lib

copying pep8.py -> build/lib

running egg_info

writing dependency_links to pep8.egg-info/dependency_links.txt

writing pep8.egg-info/PKG-INFO

writing namespace_packages to pep8.egg-info/namespace_packages.txt

writing entry points to pep8.egg-info/entry_points.txt

writing top-level names to pep8.egg-info/top_level.txt

warning: manifest_maker: standard file '-c' not found



reading manifest file 'pep8.egg-info/SOURCES.txt'

reading manifest template 'MANIFEST.in'

warning: no previously-included files matching '*.pyc' found under directory 'docs'

warning: no previously-included files matching '*.pyo' found under directory 'docs'

warning: no previously-included files matching '*.pyc' found under directory 'testsuite'

warning: no previously-included files matching '*.pyo' found under directory 'testsuite'

no previously-included directories found matching 'docs/_build'

writing manifest file 'pep8.egg-info/SOURCES.txt'

running install_lib

copying build/lib/pep8.py -> /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages

error: could not create '/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pep8.py': Permission denied

----------------------------------------
  Rolling back uninstall of pep8
Cleaning up...
Command /opt/local/bin/python -c "import setuptools, tokenize;__file__='/var/folders/yl/dlrlbmgx2nqcwn6qfrrkf7440000gn/T/pip-figzwl8d-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/yl/dlrlbmgx2nqcwn6qfrrkf7440000gn/T/pip-_rjf1t94-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /var/folders/yl/dlrlbmgx2nqcwn6qfrrkf7440000gn/T/pip-figzwl8d-build
Storing debug log for failure in /Users/myint/.pip/pip.log

___________________________________ summary ____________________________________
ERROR:   py34: InvocationError: /Users/myint/tmp/show/pep8/.tox/py34/bin/pip install --pre /Users/myint/tmp/show/pep8/.tox/dist/pep8-1.5.7a0.zip (see /Users/myint/tmp/show/pep8/.tox/py34/log/py34-1.log)
@pytoxbot
Copy link
Author

Original comment by @hpk42

Fix "PYVENV_LAUNCHER" problem

This resolves the use of the non-virtualenv Python executable.

This fixes #171.

→ <>

@pytoxbot
Copy link
Author

Original comment by @myint

Please see pul request 118 for the fix.

@pytoxbot
Copy link
Author

Original comment by @myint

Okay, I see what the problem is. It is caused by the __PYVENV_LAUNCHER__ issue. A similar issue was resolved resolved in virtualenv, but it turns out that that is not enough. tox itself makes subprocess calls independent of virtualenv and those still suffer from __PYVENV_LAUNCHER__. The below example shows the problem and how to resolve it.

import os
import subprocess
import sys

print('__PYVENV_LAUNCHER__:', os.environ.get('__PYVENV_LAUNCHER__'),
      file=sys.stderr)

# The below line fixes the problem shown in tox.
# os.unsetenv('__PYVENV_LAUNCHER__')

process = subprocess.Popen(
    ['/Users/myint/projects/pep8/.tox/py34/bin/pip',
     'install', '--pre',
     '-U', '--no-deps',
     '/Users/myint/projects/pep8/.tox/dist/pep8-1.5.7a0.zip'])

process.communicate()

@pytoxbot
Copy link
Author

Original comment by @myint

Python 3.3 fails, but for a different reason.

$ tox -e py33
GLOB sdist-make: /Users/myint/projects/pep8/setup.py
py33 create: /Users/myint/projects/pep8/.tox/py33
py33 inst: /Users/myint/projects/pep8/.tox/dist/pep8-1.5.7a0.zip
ERROR: invocation failed, logfile: /Users/myint/projects/pep8/.tox/py33/log/py33-1.log
ERROR: actionid=py33
msg=installpkg
cmdargs=[local('/Users/myint/projects/pep8/.tox/py33/bin/pip'), 'install', '--pre', '/Users/myint/projects/pep8/.tox/dist/pep8-1.5.7a0.zip']
env={'SHELL': '/opt/local/bin/bash', 'TERM_PROGRAM': 'iTerm.app', 'ITERM_SESSION_ID': 'w1t0p0', 'LANG': 'en_US.UTF-8', 'PWD': '/Users/myint/projects/pep8', 'Apple_PubSub_Socket_Render': '/tmp/launch-SXo6Tz/Render', 'SSH_AUTH_SOCK': '/tmp/launch-wwoDIO/Listeners', 'TERM': 'xterm-256color', 'HISTFILESIZE': '10000', 'USER': 'myint', 'OBJCPLUS_INCLUDE_PATH': '/Users/myint/local/include:/opt/local/include:', 'COMMAND_MODE': 'unix2003', 'LIBRARY_PATH': '/Users/myint/local/lib:/opt/local/lib:', '__CF_USER_TEXT_ENCODING': '0x1F5:0:0', 'EDITOR': "vim -c ':0'", 'ACK_PAGER': 'less -FRSX', '__CHECKFIX1436934': '1', 'HISTSIZE': '10000', 'PYTHONIOENCODING': 'utf_8', 'TMPDIR': '/var/folders/yl/dlrlbmgx2nqcwn6qfrrkf7440000gn/T/', 'OBJC_INCLUDE_PATH': '/Users/myint/local/include:/opt/local/include:', 'PS1': '\\[\\e[01;32m\\]\\u@\\h\\[\\e[00m\\]:\\[\\e[01;34m\\]\\w\\[\\e[00m\\]$(__git_ps1 " \\[\\e[01;31m\\](%s)\\[\\e[00m\\]")\\n\\$ ', 'DYLD_LIBRARY_PATH': '/Users/myint/local/lib:', 'COMP_KNOWN_HOSTS_WITH_HOSTFILE': '', 'ITERM_PROFILE': 'Default', 'COLORFGBG': '0;15', 'OLDPWD': '/Users/myint', 'GIT_PS1_SHOWDIRTYSTATE': '1', '_': '/Users/myint/Library/Python/3.4/bin/tox', 'SECURITYSESSIONID': '186a4', 'PYTHONHASHSEED': '1835011300', 'C_INCLUDE_PATH': '/Users/myint/local/include:/opt/local/include:', '__PYVENV_LAUNCHER__': '/opt/local/bin/python', 'PKG_CONFIG_PATH': '/Users/myint/local/lib/pkgconfig:', 'GIT_PS1_SHOWUNTRACKEDFILES': '1', 'HOME': '/Users/myint', 'LOGNAME': 'myint', 'MANPATH': '/Users/myint/local/share/man:/Users/myint/local/man:/opt/local/share/man:', 'LS_COLORS': 'no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mng=01;35:*.pcx=01;35:*.m4a=01;35:*.mov=01;35:*.mp4=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:', 'SHLVL': '1', 'CPLUS_INCLUDE_PATH': '/Users/myint/local/include:/opt/local/include:', 'CLICOLOR': 'yes', 'PATH': '/Users/myint/projects/pep8/.tox/py33/bin:/Users/myint/.cabal/bin:/Users/myint/Library/Python/3.4/bin:/Users/myint/local/bin:/Users/myint/dotfiles/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin'}
Traceback (most recent call last):
  File ".tox/py33/bin/pip", line 7, in <module>
    from pip import main
ImportError: No module named 'pip'

___________________________________________________________________ summary ____________________________________________________________________
ERROR:   py33: InvocationError: /Users/myint/projects/pep8/.tox/py33/bin/pip install --pre /Users/myint/projects/pep8/.tox/dist/pep8-1.5.7a0.zip (see /Users/myint/projects/pep8/.tox/py33/log/py33-1.log)

And Python 2.7 works fine.

This permission problem kind of reminds me of the PYVENV_LAUNCHER issue I encountered a year ago back on Python 3.3. But it should be resolved by now.

@pytoxbot
Copy link
Author

Original comment by @hpk42

Seems like instead of installing into the virtualenv, it goes to the global installation of Python. I don't know but suspect it's an issue with virtualenv/pip/python3.4. Tox is merely triggering the install here. Does it work with python3.3, btw?

@pytoxbot
Copy link
Author

Original comment by @myint

Manually installing the virtualenv seems to work fine. Here are a few variations I tried while trying to reproduce it.

$ virtualenv --python=python3.4 3.4
Running virtualenv with interpreter /opt/local/bin/python3.4
Using base prefix '/opt/local/Library/Frameworks/Python.framework/Versions/3.4'
New python executable in 3.4/bin/python3.4
Also creating executable in 3.4/bin/python
Installing setuptools, pip...done.
$ bash
$ . 3.4/bin/activate
$ pip install .
Unpacking /Users/myint/tmp/show/pep8
  Running setup.py (path:/var/folders/yl/dlrlbmgx2nqcwn6qfrrkf7440000gn/T/pip-5mzeaxm0-build/setup.py) egg_info for package from file:https:///Users/myint/tmp/show/pep8

    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'testsuite'
    warning: no previously-included files matching '*.pyo' found under directory 'testsuite'
    no previously-included directories found matching 'docs/_build'
Installing collected packages: pep8
  Running setup.py install for pep8

    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'testsuite'
    warning: no previously-included files matching '*.pyo' found under directory 'testsuite'
    no previously-included directories found matching 'docs/_build'
    Installing pep8 script to /Users/myint/tmp/show/pep8/3.4/bin
Successfully installed pep8
Cleaning up...

I tried installing the zip file that is contained in the tox directory.

$ virtualenv --python=python3.4 manual
Running virtualenv with interpreter /opt/local/bin/python3.4
Using base prefix '/opt/local/Library/Frameworks/Python.framework/Versions/3.4'
New python executable in manual/bin/python3.4
Also creating executable in manual/bin/python
Installing setuptools, pip...done.
$ bash
$ . manual/bin/activate
$ pip install --pre /Users/myint/tmp/show/pep8/.tox/dist/pep8-1.5.7a0.zip
Unpacking ./.tox/dist/pep8-1.5.7a0.zip
  Running setup.py (path:/var/folders/yl/dlrlbmgx2nqcwn6qfrrkf7440000gn/T/pip-p7xs0p_c-build/setup.py) egg_info for package from file:https:///Users/myint/tmp/show/pep8/.tox/dist/pep8-1.5.7a0.zip

    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'testsuite'
    warning: no previously-included files matching '*.pyo' found under directory 'testsuite'
    no previously-included directories found matching 'docs/_build'
Installing collected packages: pep8
  Running setup.py install for pep8

    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'testsuite'
    warning: no previously-included files matching '*.pyo' found under directory 'testsuite'
    no previously-included directories found matching 'docs/_build'
    Installing pep8 script to /Users/myint/tmp/show/pep8/manual/bin
Successfully installed pep8
Cleaning up...

And lastly, I tried using the same virtualenv created by tox.

$ bash
$ . .tox/py34/bin/activate
$ pip install --pre /Users/myint/tmp/show/pep8/.tox/dist/pep8-1.5.7a0.zip
Unpacking ./.tox/dist/pep8-1.5.7a0.zip
  Running setup.py (path:/var/folders/yl/dlrlbmgx2nqcwn6qfrrkf7440000gn/T/pip-zycbqid3-build/setup.py) egg_info for package from file:https:///Users/myint/tmp/show/pep8/.tox/dist/pep8-1.5.7a0.zip

    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'testsuite'
    warning: no previously-included files matching '*.pyo' found under directory 'testsuite'
    no previously-included directories found matching 'docs/_build'
Installing collected packages: pep8
  Running setup.py install for pep8

    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'testsuite'
    warning: no previously-included files matching '*.pyo' found under directory 'testsuite'
    no previously-included directories found matching 'docs/_build'
    Installing pep8 script to /Users/myint/tmp/show/pep8/.tox/py34/bin
Successfully installed pep8
Cleaning up...

Thanks

@pytoxbot
Copy link
Author

Original comment by @hpk42

what happens if you create a virtualenv yourself and then try to install the same dependencies you specify with tox?

@tox-dev tox-dev 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

1 participant