← Back to DAGDA | Support | Source: https://github.com/travis-ci/travis-ci/issues/8363
Skip to content

pyenv for python3.5 misconfigured? #8363

Closed

Description

@asottile

Getting an error when running virtualenv -ppython3.5 ...:

https://travis-ci.org/pre-commit/pre-commit/jobs/272956128

It was working 45 minutes ago:

https://travis-ci.org/pre-commit/pre-commit/builds/272943558

Here's the relevant output:

E           CalledProcessError: Command: ('/home/travis/build/pre-commit/pre-commit/.tox/py27/bin/python2.7', '-m', 'virtualenv', '/tmp/pytest-of-travis/pytest-0/test_arbitrary_bytes_hook0/0/repoXLdwhd/py_env-python3.5', '-p', 'python3.5')
E           Return code: 127
E           Expected return code: 0
E           Output: 
E               Running virtualenv with interpreter /opt/pyenv/shims/python3.5
E               
E           Errors: 
E               pyenv: python3.5: command not found
E               
E               The `python3.5' command exists in these Python versions:
E                 3.5
E                 3.5.3

Activity

  1. asottile commented on Sep 7, 2017

    @asottile
    Author

    This seems to line up with the release made here

  2. changed the title [-]pyvenv for python3.5 misconfigured?[/-] [+]pyenv for python3.5 misconfigured?[/+] on Sep 7, 2017
  3. asottile commented on Sep 7, 2017

    @asottile
    Author

    Here's my crummy workaround: pre-commit/pre-commit@e3ab890

  4. added a commit that references this issue on Sep 7, 2017
  5. BanzaiMan commented on Sep 7, 2017

    @BanzaiMan
    Contributor
  6. ruslo commented on Sep 7, 2017

    @ruslo

    Here's my crummy workaround: pre-commit/pre-commit@e3ab890

    @asottile Thanks for the fix.

    I have to use 3.4 because otherwise pip install doesn't have any effect.

    3.5:

    $ pyenv global system 3.5
    
    $ which pip3
    /opt/pyenv/shims/pip3
    
    $ pip3 --version
    pip 9.0.1 from /opt/python/3.5.3/lib/python3.5/site-packages (python 3.5)
    
    $ which python3
    /opt/pyenv/shims/python3
    
    $ python3 --version
    Python 3.4.3
    
    $ pip3 install --user requests
    Collecting requests
    Collecting idna<2.7,>=2.5 (from requests)
    Collecting chardet<3.1.0,>=3.0.2 (from requests)
    Collecting urllib3<1.23,>=1.21.1 (from requests)
    Collecting certifi>=2017.4.17 (from requests)
    Installing collected packages: idna, chardet, urllib3, certifi, requests
    
    Successfully installed certifi-2017.7.27.1 chardet-3.0.4 idna-2.6 requests-2.18.4 urllib3-1.22
    
    $ python3 -c 'import requests'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ImportError: No module named 'requests'
    

    3.4 works:

    $ pyenv global system 3.4
    
    $ which pip3
    /opt/pyenv/shims/pip3
    
    $ pip3 --version
    pip 9.0.1 from /opt/python/3.4.6/lib/python3.4/site-packages (python 3.4)
    
    $ which python3
    /opt/pyenv/shims/python3
    
    $ python3 --version
    Python 3.4.3
    
    $ pip3 install --user requests
    Collecting requests
    Collecting chardet<3.1.0,>=3.0.2 (from requests)
    Collecting urllib3<1.23,>=1.21.1 (from requests)
    Collecting certifi>=2017.4.17 (from requests)
    Collecting idna<2.7,>=2.5 (from requests)
    Installing collected packages: chardet, urllib3, certifi, idna, requests
    
    Successfully installed certifi-2017.7.27.1 chardet-3.0.4 idna-2.6 requests-2.18.4 urllib3-1.22
    
    $ python3 -c 'import requests'
    The command "python3 -c 'import requests'" exited with 0.
    
  7. ruslo commented on Sep 7, 2017

    @ruslo

    3.4 works

    Still not happy...

    Seems that Python prepends some directories to PATH:

    $ export PATH=/.../my-custom-directory:$PATH
    
    $ echo $PATH
    /.../my-custom-directory:/home/travis/bin:/home/travis/.local/bin:/opt/pyenv/shims:...:
    
    $ python3 -c 'import os; print(os.getenv("PATH"))'
    /usr/bin:/opt/pyenv/libexec:/opt/pyenv/plugins/python-build/bin:/.../my-custom-directory:/home/travis/bin:/home/travis/.local/bin:/opt/pyenv/shims:...:
    

    As you can see /usr/bin added before old $PATH. That's the problem because with PATH=/.../my-custom-directory:$PATH I'm trying to overwrite tools from /usr/bin directory.

    Build:

  8. 38 remaining items

  9. bittner commented on Jan 12, 2018

    @bittner

    @cejkato2 If you have all the tools available you need for C in a Python image, and you only need a single Python version for each build, then the matrix build will do, I'm sure. You have to try that out yourself, though.

    Also, it may be more straight-forward to install missing pieces of your C tool chain (when you're good at that) than Python (especially when you're just an occasional user).

    Note that I'm not part of Travis (the company), so if you need reliable, first-hand information ask Travis support for help. I'm sure, though, they're good at maintaining their native build environments. (Much better than providing a working pyenv-powered setup, as proven in the past.)

  10. stale commented on Apr 12, 2018

    @stale

    Thanks for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please do feel free to either reopen this issue or open a new one. We'll gladly take a look again! You can read more here: https://blog.travis-ci.com/2018-03-09-closing-old-issues

  11. added a commit that references this issue on Jul 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions