Poetry could not find a pyproject.toml file in C:\

We Are Going To Discuss About Poetry could not find a pyproject.toml file in C:\. So lets Start this Python Article.

Poetry could not find a pyproject.toml file in C:\

Solution 1

You have to create a pyproject.toml first. Go into your project folder, run poetry init and follow the instructions. As an alternative you can run poetry new myproject to create a basic folder structure and a pyproject.toml. Also have a look into the docs.

Original Author finswimmer Of This Content

Solution 2

In my case, I was in a Docker container of a legacy Python version (3.6). I had to use pip instead of conda and therefore, I installed Poetry to keep the dependencies right.

bash-4.4# docker exec -it MY_CONTAINER bash

starts the command prompt of the container.

Now turning to answer the question, which is not a Docker question.

In the next command, you might need to write /usr/local/bin/poetry instead of just poetry instead.

bash-4.4# poetry init

This command will guide you through creating your pyproject.toml config.

Package name []:  test
Version [0.1.0]:  1.0.0
Description []:  test
Author [None, n to skip]:  n
License []:
Compatible Python versions [^3.6]:

Would you like to define your main dependencies interactively? (yes/no) [yes] no
Would you like to define your development dependencies interactively? (yes/no) [yes] no
Generated file

name = "test"
version = "0.1.0"
description = "test"
authors = ["Your Name <[email protected]>"]

python = "^3.6"


requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

Do you confirm generation? (yes/no) [yes]

Very easy side remark which should be clear to the most: If you press Enter at a field of filled brackets, it will just enter what is written in the brackets. For example, if you press Enter at Version [0.1.0]:, you will make it the version 0.1.0, unless you enter your own. That is also to say that those brackets [] do not mean that you have to enter a list, it is just to show what is entered when you just press Enter.

After this, I could run:

bash-4.4# poetry add pandas

Another Docker side note: It turned out that apk (Alpine containers) on legacy Python 3.6 cannot handle basic packages well enough, with or without Poetry, see Installing pandas in docker Alpine. I had to switch to a newer Python version. And you can install Poetry already by means of the Dockerfile and not just in the container bash, see Integrating Python Poetry with Docker

Wrapping up:

It was strange to me that I had to enter things that I would only use when I published a self-written single package (see: Package name []), although I was expecting a general setup of a package manager of many packages as a whole. In the end, I just followed the menu by entering some irrelevant placeholders. The right Python version as the only important core of the pyproject.toml file was already automatically suggested. This was all that was needed.

Original Author questionto42standswithUkraine Of This Content


So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

ittutorial team

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment