Skip to content

install-poetry.py fails when using an empty PATH #43

@dmarinuswoodwing

Description

@dmarinuswoodwing

Description

We deploy poetry from cfn-init (which is a tool from AWS to run commands when an virtual machine is started). Apparently cfn-init starts processes with an (almost) empty environment.

Steps to reproduce

  1. Start a shell with an empty environment:

    env -i bash
  2. Execute the poetry installer:

    curl -sSL https://install.python-poetry.org/ | python3.7 - --version 1.2.0

Expected result

Either:

  • Poetry properly installed (using a sane PATH) (preferred)
  • A warning that you should configure your PATH
  • A warning that some command could not be executed.

Actual result:

Retrieving Poetry metadata

# Welcome to Poetry!

This will download and install the latest version of Poetry,
a dependency and package manager for Python.

It will add the `poetry` command to Poetry's bin directory, located at:

/root/.local/bin

You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.

Installing Poetry (1.2.0): An error occurred. Removing partial environment.
Traceback (most recent call last):
  File "<stdin>", line 935, in <module>
  File "<stdin>", line 914, in main
  File "<stdin>", line 545, in run
  File "<stdin>", line 566, in install
  File "/usr/lib64/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "<stdin>", line 638, in make_env
  File "<stdin>", line 624, in make_env
  File "<stdin>", line 314, in make
  File "/usr/lib64/python3.7/venv/__init__.py", line 66, in create
    self.setup_python(context)
  File "/usr/lib64/python3.7/venv/__init__.py", line 233, in setup_python
    copier(context.executable, path)
  File "/usr/lib64/python3.7/venv/__init__.py", line 176, in symlink_or_copy
    shutil.copyfile(src, dst)
  File "/usr/lib64/python3.7/shutil.py", line 120, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: ''

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions