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

[IndexError] List index out of range when doing poetry install with Docker #1247

Closed
3 tasks done
Zuiluj opened this issue Jul 24, 2019 · 7 comments
Closed
3 tasks done

Comments

@Zuiluj
Copy link

Zuiluj commented Jul 24, 2019

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

Issue

Good day,
I would like to report an issue using Poetry.
I wanted to use Docker as the virtual machine and Poetry as a package manager yet when I execute
poetry install

It returns me this stacktrace:

list index out of range

Exception trace:
 /usr/local/lib/python3.7/site-packages/cleo/application.py in run() at line 94
   status_code = self.do_run(input_, output_)
 /usr/local/lib/python3.7/site-packages/poetry/console/application.py in do_run() at line 88
   return super(Application, self).do_run(i, o)
 /usr/local/lib/python3.7/site-packages/cleo/application.py in do_run() at line 197
   status_code = command.run(input_, output_)
 /usr/local/lib/python3.7/site-packages/poetry/console/commands/command.py in run() at line 77
   return super(BaseCommand, self).run(i, o)
 /usr/local/lib/python3.7/site-packages/cleo/commands/base_command.py in run() at line 146
   status_code = self.execute(input_, output_)
 /usr/local/lib/python3.7/site-packages/cleo/commands/command.py in execute() at line 107
   return self.handle()
 /usr/local/lib/python3.7/site-packages/poetry/console/commands/install.py in handle() at line 77
   builder.build()
 /usr/local/lib/python3.7/site-packages/poetry/masonry/builders/editable.py in build() at line 17
   return self._setup_build()
 /usr/local/lib/python3.7/site-packages/poetry/masonry/builders/editable.py in _setup_build() at line 30
   f.write(decode(builder.build_setup()))
 /usr/local/lib/python3.7/site-packages/poetry/masonry/builders/sdist.py in build_setup() at line 114
   pkg_dir, _packages, _package_data = self.find_packages(include)
 /usr/local/lib/python3.7/site-packages/poetry/masonry/builders/sdist.py in find_packages() at line 199
   base = str(include.elements[0].parent)

install [--no-dev] [--dry-run] [-E|--extras EXTRAS] [--develop DEVELOP]

This is the pyproject.toml

name = "app"
version = "0.1.0"
description = "###"
authors = ["exAuth <exampleauthor@email.com>"]

[tool.poetry.dependencies]
python = "^3.7"
django = "^2.2.3"
requests = "^2.22"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

This is my Dockerfile and docker-compose if it helps:
Dockerfile

FROM python:3.7

ENV PYTHONUNBUFFERED 1

RUN mkdir app
COPY . /app
WORKDIR /app
RUN pip install poetry
RUN poetry install -vvv

RUN adduser -D user 
USER user

docker-compose


services:
  app:
    restart: always
    build: .
    expose:
      - "8020"
    ports:
      - 8000:8020
    volumes:
      - ./appname:/app/appname
    working_dir: /app/appname
    command: >
      sh -c "python manage.py runserver 0.0.0.0:8000"

  mongo:
    image: mongo
    restart: always
    environment:
      MONGO_INITDB_ROOT_USERNAME: #####
      MONGO_INITDB_ROOT_PASSWORD: #####
  
  mongo-express:
    image: mongo-express
    restart: always
    ports:
      - 8081:8081
    environment:
      ME_CONFIG_MONGODB_ADMINUSERNAME: #####
      ME_CONFIG_MONGODB_ADMINPASSWORD: #####
@Zuiluj Zuiluj changed the title [IndexError] [IndexError] List index out of range when doing poetry install with Docker Jul 24, 2019
@rhocairn
Copy link

@Zuiluj Have you tracked down the issue or found a workaround yet? I'm facing a similar problem.

@Hartorn
Copy link
Contributor

Hartorn commented Sep 12, 2019

@gmaybrun removing temporarily the build system part may allow you to install

@Zuiluj
Copy link
Author

Zuiluj commented Sep 14, 2019

This issue was fixed by simply reinstalling my Windows 10 itself. I don't why but something might have collided with the system file. I don't know

@ephes
Copy link

ephes commented Jan 23, 2020

I ran in to this error, because I typed packages = [{ include = "./commands" }] instead of packages = [{ include = "./commands.py" }] pretty misleading error message.

@jedie
Copy link

jedie commented Feb 10, 2020

I ran in to this error, because I typed packages = [{ include = "./commands" }] instead of packages = [{ include = "./commands.py" }] pretty misleading error message.

Similar here: i have used:
packages = [{ include = "DragonPy" }]
instead of:
packages = [{ include = "dragonpy" }]

@autoferrit
Copy link

I have a solution for now, that I posted in #2139 . I will post it here as well since this issue came up first for me.

I have the same issue. for me I believe it is because of this portion of my pyproject.toml

packages = [
    { include = "bohemian", from = "src"}
]

I am mostly doing this, because my project is inside a src directory. This happens in CI when I add the pyproject.toml and poetry.lock into a container and run install, when my apps code isnt there yet.
But it work when I install with

poetry install --no-root

and then don't install or run poetry build until I add my code into the repo.

Copy link

github-actions bot commented Mar 3, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2024
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

6 participants