Skip to content

poetry install incorrectly resolve python files in current folder #6627

@hms5232

Description

@hms5232
  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

My project is open source, so I directly put repo url in pyproject.toml item.

The project usage is:

  1. Download or clone repo.
  2. cd into project and run poetry install

but, the poetry install will give me following error:

Command ['/home/hhm/.cache/pypoetry/virtualenvs/0ver-department-keyword-d1mZarpb-py3.8/bin/python', '-W', 'ignore', '-'] errored with the following return code 1, and output:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.8/json/__init__.py", line 106, in <module>
    from .decoder import JSONDecoder, JSONDecodeError
  File "/usr/lib/python3.8/json/decoder.py", line 3, in <module>
    import re
  File "/usr/lib/python3.8/re.py", line 127, in <module>
    import functools
  File "/usr/lib/python3.8/functools.py", line 18, in <module>
    from collections import namedtuple
  File "/usr/lib/python3.8/collections/__init__.py", line 22, in <module>
    from keyword import iskeyword as _iskeyword
  File "/home/hhm/0ver-department-keyword/keyword.py", line 8, in <module>
    import data_model
  File "/home/hhm/0ver-department-keyword/data_model.py", line 4, in <module>
    from ckiptagger import data_utils
ModuleNotFoundError: No module named 'ckiptagger'
input was : import json
import sys

print(json.dumps(sys.path))

Both keyword.py and data_model.py is project business logic, and depend on ckiptagger package to work. Poetry resolve those files and I don't know why.

Current tree:

hms5232@wsl:~/0ver-department-keyword$ tree
.
├── LICENSE
├── README.md
├── __pycache__
│   ├── data_model.cpython-38.pyc
│   └── keyword.cpython-38.pyc
├── data_model.py
├── keyword.py
├── poetry.lock
├── pyproject.toml
└── school_data.csv

1 directory, 9 files

After googling and getting nothing, I try to change project directory as poetry new: mkdir src && mv *.py src/, and poetry install works!

hms5232@wsl:~/0ver-department-keyword$ tree
.
├── LICENSE
├── README.md
├── __pycache__
│   ├── data_model.cpython-38.pyc
│   └── keyword.cpython-38.pyc
├── poetry.lock
├── pyproject.toml
├── school_data.csv
└── src
    ├── data_model.py
    └── keyword.py

2 directories, 9 files

This is happened after Poetry 1.2. If I remember correctly, Poetry 1.1 had worked well. I'm not sure this is a bug or not, or maybe something (ex: pre-releasing note) I missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/venvRelated to virtualenv managementkind/bugSomething isn't working as expectedstatus/confirmedIssue is reproduced and confirmedversion/1.2.1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions