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

pipenv fails to create a virtual environment with specific version of python #3210

Closed
rhazegh opened this issue Nov 12, 2018 · 2 comments
Closed
Labels
Type: Duplicate This issue is a duplicate of an already-existing issue.

Comments

@rhazegh
Copy link

rhazegh commented Nov 12, 2018

Issue description

Unable to install using a specific version of python (3.6.5). Here is how to reproduce:

[pipenv-test]$ which python3
/usr/local/bin/python3
[pipenv-test]$ python3 --version
Python 3.7.1
[pipenv-test]$ brew list --versions python
python 3.7.0 3.7.1 3.6.3 3.6.5 2.7.14
[pipenv-test]$ pipenv install --python 3.6.5
Warning: Python 3.6.5 was not found on your system…
You can specify specific versions of Python with:
  $ pipenv --python path/to/python
[pipenv-test]$ pipenv install --python /usr/local/Cellar/python/3.6.5/bin/python3

Expected result

A Virtual environment be created with python 3.6.5.

Actual result

Creating a virtualenv for this project…
Pipfile: /Users/ramin/projects/test/pipenv-test/Pipfile
Using /usr/local/Cellar/python/3.6.5/bin/python3 (3.6.5) to create virtualenv…
⠴Running virtualenv with interpreter /usr/local/Cellar/python/3.6.5/bin/python3
Using base prefix '/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6'
New python executable in /Users/ramin/.local/share/virtualenvs/pipenv-test-lmVJ1RwT/bin/python3.6
Traceback (most recent call last):
  File "/usr/local/Cellar/pipenv/2018.10.13_1/libexec/lib/python3.7/site-packages/virtualenv.py", line 2343, in <module>
    main()
  File "/usr/local/Cellar/pipenv/2018.10.13_1/libexec/lib/python3.7/site-packages/virtualenv.py", line 712, in main
    symlink=options.symlink)
  File "/usr/local/Cellar/pipenv/2018.10.13_1/libexec/lib/python3.7/site-packages/virtualenv.py", line 927, in create_environment
    site_packages=site_packages, clear=clear, symlink=symlink))
  File "/usr/local/Cellar/pipenv/2018.10.13_1/libexec/lib/python3.7/site-packages/virtualenv.py", line 1233, in install_python
    shutil.copyfile(executable, py_executable)
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/shutil.py", line 120, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/opt/python/bin/python3.6'

Traceback (most recent call last):
  File "/usr/local/Cellar/pipenv/2018.10.13_1/libexec/bin/pipenv", line 11, in <module>
    load_entry_point('pipenv==2018.10.13', 'console_scripts', 'pipenv')()
  File "/usr/local/Cellar/pipenv/2018.10.13_1/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/Cellar/pipenv/2018.10.13_1/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/Cellar/pipenv/2018.10.13_1/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/Cellar/pipenv/2018.10.13_1/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/Cellar/pipenv/2018.10.13_1/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/Cellar/pipenv/2018.10.13_1/libexec/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/Cellar/pipenv/2018.10.13_1/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/Cellar/pipenv/2018.10.13_1/libexec/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/Cellar/pipenv/2018.10.13_1/libexec/lib/python3.7/site-packages/pipenv/cli/command.py", line 249, in install
    editable_packages=state.installstate.editables,
  File "/usr/local/Cellar/pipenv/2018.10.13_1/libexec/lib/python3.7/site-packages/pipenv/core.py", line 1724, in do_install
    pypi_mirror=pypi_mirror,
  File "/usr/local/Cellar/pipenv/2018.10.13_1/libexec/lib/python3.7/site-packages/pipenv/core.py", line 565, in ensure_project
    pypi_mirror=pypi_mirror,
  File "/usr/local/Cellar/pipenv/2018.10.13_1/libexec/lib/python3.7/site-packages/pipenv/core.py", line 500, in ensure_virtualenv
    python=python, site_packages=site_packages, pypi_mirror=pypi_mirror
  File "/usr/local/Cellar/pipenv/2018.10.13_1/libexec/lib/python3.7/site-packages/pipenv/core.py", line 901, in do_create_virtualenv
    click.echo(crayons.blue("{0}".format(c.err)), err=True)
  File "/usr/local/Cellar/pipenv/2018.10.13_1/libexec/lib/python3.7/site-packages/pipenv/vendor/delegator.py", line 146, in err
    return self._pexpect_out
  File "/usr/local/Cellar/pipenv/2018.10.13_1/libexec/lib/python3.7/site-packages/pipenv/vendor/delegator.py", line 114, in _pexpect_out
    result += self.subprocess.after
TypeError: can only concatenate str (not "type") to str

Steps to replicate

See above.


$ pipenv --support

Pipenv version: '2018.10.13'

Pipenv location: '/usr/local/Cellar/pipenv/2018.10.13_1/libexec/lib/python3.7/site-packages/pipenv'

Python location: '/usr/local/Cellar/pipenv/2018.10.13_1/libexec/bin/python3.7'

Python installations found:

  • 3.7.1: /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/bin/python3.7
  • 3.7.1: /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/bin/python3.7m
  • 2.7.15: /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/bin/python2.7
  • 2.7.10: /usr/bin/python
  • 2.7.10: /usr/bin/pythonw
  • 2.7.10: /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.7.1',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '18.2.0',
 'platform_system': 'Darwin',
 'platform_version': 'Darwin Kernel Version 18.2.0: Fri Oct  5 19:41:49 PDT '
                     '2018; root:xnu-4903.221.2~2/RELEASE_X86_64',
 'python_full_version': '3.7.1',
 'python_version': '3.7',
 'sys_platform': 'darwin'}

System environment variables:

  • PATH
  • TERM_PROGRAM
  • rvm_bin_path
  • NVM_CD_FLAGS
  • GEM_HOME
  • ANDROID_HOME
  • SHELL
  • TERM
  • CLICOLOR
  • IRBRC
  • TMPDIR
  • Apple_PubSub_Socket_Render
  • TERM_PROGRAM_VERSION
  • MY_RUBY_HOME
  • TERM_SESSION_ID
  • USER
  • NVM_DIR
  • COMMAND_MODE
  • _system_type
  • rvm_path
  • SSH_AUTH_SOCK
  • __CF_USER_TEXT_ENCODING
  • LSCOLORS
  • rvm_prefix
  • _
  • PWD
  • LANG
  • ITERM_PROFILE
  • _system_arch
  • XPC_FLAGS
  • _system_version
  • XPC_SERVICE_NAME
  • rvm_version
  • COLORFGBG
  • SHLVL
  • HOME
  • ITERM_SESSION_ID
  • LOGNAME
  • GEM_PATH
  • NVM_BIN
  • GOPATH
  • PROMPT_COMMAND
  • DISPLAY
  • SECURITYSESSIONID
  • RUBY_VERSION
  • _system_name
  • COLORTERM
  • PYTHONDONTWRITEBYTECODE
  • PIP_SHIMS_BASE_MODULE
  • PIP_PYTHON_PATH

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /usr/local/Cellar/pipenv/2018.10.13_1/libexec/tools:/Users/ramin/.rvm/gems/ruby-2.3.5/bin:/Users/ramin/.rvm/gems/ruby-2.3.5@global/bin:/Users/ramin/.rvm/rubies/ruby-2.3.5/bin:/Users/ramin/.nvm/versions/node/v6.10.1/bin:/usr/local/heroku/bin:/Library/PostgreSQL/9.4/bin:/Users/ramin/android-sdks:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/usr/local/sbin:/Users/ramin/Library/Android/sdk/tools:/Users/ramin/Library/Android/sdk/platform-tools:/usr/local/opt/go/libexec/bin:/Users/ramin/projects/go/bin:/Users/ramin/.rvm/bin
  • SHELL: /usr/local/bin/bash
  • LANG: en_CA.UTF-8
  • PWD: /Users/ramin/projects/test/pipenv-test

Contents of Pipfile ('/Users/ramin/projects/test/pipenv-test/Pipfile'):

@pqiaohaoq
Copy link

pqiaohaoq commented Nov 13, 2018

Something in the error.

FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/opt/python/bin/python3.6'

Python path may be wrong, check it?

Try to use the absolute path!

@techalchemy
Copy link
Member

This error has been resolved in #3159 and #3161 (and a few other prs as well) -- see also #3124

Sorry for the bug, thanks for the report

@techalchemy techalchemy added the Type: Duplicate This issue is a duplicate of an already-existing issue. label Nov 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Duplicate This issue is a duplicate of an already-existing issue.
Projects
None yet
Development

No branches or pull requests

3 participants