-
I’m working on a FastAPI project where I’m managing dependencies with Poetry. Here is my current pyproject.toml file:
My FastAPI app is located in a main.py file under the src directory. To run the app, I use this command:
When I run this command, I get the following error: Additional Details:
Attempts to Resolve:
Question: Why does Python fail to find docling even though it’s listed as an installed dependency? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The issue is likely due to Poetry managing virtual environments in a way that’s causing conflicts or making it difficult for your environment to access the installed dependencies. 1. Disable Poetry’s Virtual Environments:Run the following command to prevent Poetry from creating virtual environments:
2. Remove Existing Virtual Environments:If you’ve already installed dependencies in virtual environments, remove them by running:
3. Reinstall Dependencies:Finally, reinstall your dependencies without the virtual environment:
After this, your dependencies should be available directly to your environment, and the ModuleNotFoundError for docling (or any other dependency) should be resolved. Now you can run:
|
Beta Was this translation helpful? Give feedback.
The issue is likely due to Poetry managing virtual environments in a way that’s causing conflicts or making it difficult for your environment to access the installed dependencies.
Here’s the solution that worked:
1. Disable Poetry’s Virtual Environments:
Run the following command to prevent Poetry from creating virtual environments:
poetry config virtualenvs.create false
2. Remove Existing Virtual Environments:
If you’ve already installed dependencies in virtual environments, remove them by running:
poetry env remove --all
3. Reinstall Dependencies:
Finally, reinstall your dependencies without the virtual environment:
poetry install
After this, your dependencies should be available direct…