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

$(pyenv root)/version file may not present #33

Closed
jxltom opened this issue Nov 6, 2018 · 0 comments
Closed

$(pyenv root)/version file may not present #33

jxltom opened this issue Nov 6, 2018 · 0 comments

Comments

@jxltom
Copy link
Collaborator

jxltom commented Nov 6, 2018

From the pyenv doc, the version file may not present such as when pyenv global is never run, and it did happens in my system.

The global $(pyenv root)/version file. You can modify this file using the pyenv global command. If the global version file is not present, pyenv assumes you want to use the "system" Python. (In other words, whatever version would run if pyenv weren't in your PATH.)

Then self.root.joinpath("version").read_text(encoding="utf-8") will raise exceptions during running pipenv --python somever

pipenv --python 3.6.6
Traceback (most recent call last):
  File "/usr/local/bin/pipenv", line 11, in <module>
    load_entry_point('pipenv', 'console_scripts', 'pipenv')()
  File "/mnt/d/dev/pipenv/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/mnt/d/dev/pipenv/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/mnt/d/dev/pipenv/pipenv/vendor/click/core.py", line 1114, in invoke
    return Command.invoke(self, ctx)
  File "/mnt/d/dev/pipenv/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/mnt/d/dev/pipenv/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/mnt/d/dev/pipenv/pipenv/vendor/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/mnt/d/dev/pipenv/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/mnt/d/dev/pipenv/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/mnt/d/dev/pipenv/pipenv/cli/command.py", line 203, in cli
    clear=state.clear,
  File "/mnt/d/dev/pipenv/pipenv/core.py", line 595, in ensure_project
    pypi_mirror=pypi_mirror,
  File "/mnt/d/dev/pipenv/pipenv/core.py", line 537, in ensure_virtualenv
    ensure_python(three=three, python=python)
  File "/mnt/d/dev/pipenv/pipenv/core.py", line 421, in ensure_python
    path_to_python = find_a_system_python(python)
  File "/mnt/d/dev/pipenv/pipenv/core.py", line 384, in find_a_system_python
    python_entry = finder.find_python_version(line)
  File "/mnt/d/dev/pipenv/pipenv/vendor/backports/functools_lru_cache.py", line 137, in wrapper
    result = user_function(*args, **kwds)
  File "/mnt/d/dev/pipenv/pipenv/vendor/pythonfinder/pythonfinder.py", line 112, in find_python_version
    return self.system_path.find_python_version(
  File "/mnt/d/dev/pipenv/pipenv/vendor/pythonfinder/pythonfinder.py", line 53, in system_path
    ignore_unsupported=self.ignore_unsupported,
  File "/mnt/d/dev/pipenv/pipenv/vendor/pythonfinder/models/path.py", line 395, in create
    ignore_unsupported=ignore_unsupported,
  File "<attrs generated init 8b5e681b06af133646fcafad5a215f2a935c5776>", line 37, in __init__
  File "/mnt/d/dev/pipenv/pipenv/vendor/pythonfinder/models/path.py", line 107, in __attrs_post_init__
    self._setup_pyenv()
  File "/mnt/d/dev/pipenv/pipenv/vendor/pythonfinder/models/path.py", line 139, in _setup_pyenv
    root=PYENV_ROOT, ignore_unsupported=self.ignore_unsupported
  File "/mnt/d/dev/pipenv/pipenv/vendor/pythonfinder/models/pyenv.py", line 128, in create
    return cls(root=root, ignore_unsupported=ignore_unsupported)
  File "<attrs generated init 4de89767b072a69810db4e7339c0a5b71f486a52>", line 15, in __init__
  File "/mnt/d/dev/pipenv/pipenv/vendor/pythonfinder/models/pyenv.py", line 75, in get_versions
    for p in self.get_version_order():
  File "/mnt/d/dev/pipenv/pipenv/vendor/pythonfinder/models/pyenv.py", line 48, in get_version_order
    version_order_file = self.root.joinpath("version").read_text(encoding="utf-8")
  File "/mnt/d/dev/pipenv/pipenv/vendor/pathlib2/__init__.py", line 1399, in read_text
    with self.open(mode='r', encoding=encoding, errors=errors) as f:
  File "/mnt/d/dev/pipenv/pipenv/vendor/pathlib2/__init__.py", line 1386, in open
    encoding, errors, newline)
IOError: [Errno 2] No such file or directory: '/home/jxltom/.pyenv/version'
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

1 participant