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

No file/folder found for package #8662

Closed
5 tasks done
m1guer opened this issue Nov 13, 2023 · 34 comments · May be fixed by #9651
Closed
5 tasks done

No file/folder found for package #8662

m1guer opened this issue Nov 13, 2023 · 34 comments · May be fixed by #9651
Labels
area/docs Documentation issues/improvements

Comments

@m1guer
Copy link

m1guer commented Nov 13, 2023

  • I have searched the issues of this repo and believe that this is not a duplicate.

Issue

The current project could not be installed: No file/folder found for package api-meucx
If you do not want to install the current project use --no-root

how to reproduce:

poetry install

the error may be here:
image

what i tried to do:

  • change the project name in pyproject.toml
  • reinstall poetry
  • reinstall project - delete and git clone again.
  • change path name.
@m1guer m1guer added area/docs Documentation issues/improvements status/triage This issue needs to be triaged labels Nov 13, 2023
@radoering
Copy link
Member

And do you have an api_meucx folder with Python files or an api_meucx.py in your project folder?

@m1guer
Copy link
Author

m1guer commented Nov 13, 2023

no, its a django project.

@m1guer
Copy link
Author

m1guer commented Nov 13, 2023

and the api_meucx is the base dir. inside have the poetry filess

@dimbleby
Copy link
Contributor

dimbleby commented Nov 13, 2023

what part of the message do you think is wrong?

@m1guer
Copy link
Author

m1guer commented Nov 13, 2023

hmhmh None?

@dimbleby
Copy link
Contributor

then please close the issue report

@m1guer m1guer closed this as completed Nov 13, 2023
@lexhl
Copy link

lexhl commented Nov 15, 2023

I don't understand what is going on here; I am sure my project used to work but now it doesn't. What does it mean - that I now have to have my source files in a sub-directory with the same name as my project?

@radoering
Copy link
Member

That's just a warning. If your project used to work, it will probably still work despite of this warning. It means that you either have to make your project packageable or use --no-root.

Or ignore the warning for now and wait for #8650.

@ughstudios
Copy link

this is a weird error happening for me as well.

@m1guer m1guer reopened this Nov 19, 2023
@m1guer
Copy link
Author

m1guer commented Nov 19, 2023

hi guys i've solved the problem renaming the project name in .toml_ to the project core folder.
dont use uppercase to the project folder name. and dont use special symbols like "-" or "_"

@m1guer m1guer closed this as completed Nov 19, 2023
@mathewvaughan
Copy link

mathewvaughan commented Nov 20, 2023

Facing a similar issue - just want to check my understanding. Here's my minimum repro:

  • I create a directory called 'test', and I cd into it. (Imagine that this is the repo of a web service, not a library)

  • I run poetry init and just accept all the defaults.

  • I run poetry install.

  • I see the following:

Installing the current project: test (0.1.0)
The current project could not be installed: No file/folder found for package test
If you do not want to install the current project use --no-root

I've not had this warning before - but to my understanding my root is the parent directory 'test' and this isn't being respected by the poetry install command?

Edits: Changed formatting for clarity

@radoering
Copy link
Member

poetry init just creates the pyproject.toml. Read the docs for poetry new to get an idea of a valid project structure.

@gaoming714
Copy link

gaoming714 commented Dec 4, 2023

A common poetry project should have four part:
1 pyproject.toml 2 README.md 3 "projectName folder/ __init__.py " 4 tests

If you use poetry version, such as 1.4.0, poetry will not check these files.
the warning (No file/folder found for package) only show the missing part, but it will not affect to use poetry to run scripts.

@kfsone

This comment has been minimized.

@adriangay
Copy link

adriangay commented Dec 21, 2023

I upgraded from 1.4.1 to 1.7.1. requiring the folder in which you want to create a .venv to match the name in the toml file is a breaking change IMHO. Yes, I get the message is a warning.

@enlore
Copy link

enlore commented Jan 3, 2024

I upgraded from 1.6 to 1.7.

I did not understand that this message is a warning. That is because it does not say "Warning" anywhere in the message.

Unhelpful.

➜  backend git:(main) poetry install
Installing dependencies from lock file

No dependencies to install or update

Installing the current project: src (0.1.0)
The current project could not be installed: No file/folder found for package src
If you do not want to install the current project use --no-root

@m1guer
Copy link
Author

m1guer commented Jan 3, 2024

just create an folder with the name in pyproject.toml and put py file inside.

@m1guer
Copy link
Author

m1guer commented Jan 3, 2024

pyproject.toml
image

__init__.py
image

@conoremclaughlin
Copy link

conoremclaughlin commented Jan 9, 2024

+1 to this being a breaking change - No explicit statement this is a warning causes a lot of worry, and we shouldn't have to require the name of the folder to match the name of the project. We may want the project name to be more descriptive vs the folder name in the case of monorepos.

@AlfredMoore
Copy link

I meet this warning because the folder name is different from the project name in 'pyproject.toml'

@ZachHandley
Copy link

ZachHandley commented Jan 11, 2024

Yeah so I don't know who is using pyproject.toml in their project root (e.g. outside the base folder, for instance I have my files inside api/ as FastAPI + Poetry is my API), but this just feels like an oversight to me. If it's a warning it shouldn't stop me from installing. Don't limit me based on the name of my package. NPM doesn't do this, so why in the world does Poetry feel like they need to be the first? It's hard enough to get Poetry setup, nevermind random warnings like this that don't seem to even have a point.

@m1guer
Copy link
Author

m1guer commented Jan 11, 2024

your setup needs be like this:
project_name/
├── pyproject.toml
├── api/
│ ├── init.py
└── ...

@m1guer
Copy link
Author

m1guer commented Jan 11, 2024

Yeah so I don't know who is using pyproject.toml in their project root (e.g. outside the base folder, for instance I have my files inside api/ as FastAPI + Poetry is my API), but this just feels like an oversight to me. If it's a warning it shouldn't stop me from installing. Don't limit me based on the name of my package. NPM doesn't do this, so why in the world does Poetry feel like they need to be the first? It's hard enough to get Poetry setup, nevermind random warnings like this that don't seem to even have a point.

pyproject.toml image

__init__.py image

@ZachHandley
Copy link

ZachHandley commented Jan 12, 2024

your setup needs be like this:

project_name/

├── pyproject.toml

├── api/

│ ├── init.py

└── ...

I get it, I just also think don't tell me how to scaffold my projects or how they should be designed, it's not Poetry's job. Give me an entry point like Node / Bun.

@radoering
Copy link
Member

I did not understand that this message is a warning. That is because it does not say "Warning" anywhere in the message.

In hindsight, we should probably have prefixed the message with Warning: and maybe even not printed the error inside the warning in red.

I get it, I just also think don't tell me how to scaffold my projects or how they should be designed, it's not Poetry's job.

Unfortunately, it is Poetry's job to tell you if your project can't be packaged and thus not installed since Poetry is not only for dependency management but also for packaging. There are two opposite groups of users:

All in all. #8662 (comment) still holds true. With #8650, you will have a means to silence this warning without always typing --no-root.

@ZachHandley
Copy link

ZachHandley commented Jan 13, 2024

@radoering I get that it is poetry's job to tell me if it can or can't be packaged, but this is not a packaging issue. My poetry project worked perfectly fine before requiring an asinine folder. If you want to fix this, include more details in the warning so people like me don't go wtf for an hour and a half and then come here because it was suddenly added. On top of that, the pyproject.toml could be used to find the root folder instead of some arbitrary requirement. Or maybe look for a src folder or allow an entrypoint???

Finally,
image

I added the __init__.py to my api folder (and my app folder has had one) and I still get the same error. Putting the pyproject.toml at my root folder doesn't make a ton of sense, as it's an API.

@finswimmer
Copy link
Member

On top of that, the pyproject.toml could be used to find the root folder instead of some arbitrary requirement.

This is exactly what poetry does. If not specified explicit (https://python-poetry.org/docs/pyproject/#packages) Poetry will look for a folder with a normalized name of the project, that contains at least one .py file in the folder where the pyproject.toml is located or in a src folder.

@kyleshrader
Copy link

kyleshrader commented Jan 17, 2024

Can you provide configuration so that the project always installs as --no-root? Maybe private = true or something?

@AlexanderLanin
Copy link

@kyleshrader yes, see #8650

@AlexanderLanin
Copy link

FYI I encountered this problem today and --no-root is not what I wanted, as I did want to use poetry run with my scripts.

I cannot follow the standard directory structure, so what helped me is to define packages to point poetry to where my code actually is.

packages = [
    { include = "custom_components" },
    { include = "scripts" },
]

(It's a home assistant integration, therefore it has a fixed directory structure where the integration is in custom_components).

@Lamarcke
Copy link

Lamarcke commented Feb 1, 2024

I'm also facing this issue. The message doesn't come off as a "warning" at all.

@danisztls
Copy link

That's just a warning. If your project used to work, it will probably still work despite of this warning. It means that you either have to make your project packageable or use --no-root.

Or ignore the warning for now and wait for #8650.

First time I see warnings in bright red.

@radoering
Copy link
Member

To be fair: The warning starts in yellow and ends in yellow, only part of it is red.

Nevertheless, the feedback makes it clear, that it's too confusing for many users if parts of a warning are printed in red. In the next release the warning will be prefixed with "Warning:" and printed completely in yellow.

For future reference: The change will be made in #8650 since it will change the text of the warning anyway.

Just to be clear: Even if it's fine to ignore the warning for now, you probably want to address it in the next Poetry release with #8650 because this warning will eventually become an error in a future release to resolve #8637.

Copy link

github-actions bot commented Apr 2, 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 Apr 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/docs Documentation issues/improvements
Projects
None yet
Development

Successfully merging a pull request may close this issue.