skip to Main Content

I am working on a simple Python project using Poetry using a template, with some dependencies and files.

I have installed the dependencies with: poetry install

And then when I run: poetry run python src/server/app/__main__.py

I get the following:

💣 Could not load required libraries. Please check your installation
and make sure you activated any necessary virtual environment

I am not really quite sure what’s the issue since from a quick Google search there is no mention of anyone that has experienced this error.

Here is the pyproject.toml:

[tool.poetry]
classifiers = [
  "Development Status :: 5 - Production/Stable",
  "Environment :: Web Environment",
  "License :: OSI Approved :: MIT License",
  "Natural Language :: English",
  "Operating System :: OS Independent",
  "Programming Language :: Python :: 3.9",
  "Programming Language :: Python :: 3.10",
  "Programming Language :: Python",
  "Topic :: Internet :: WWW/HTTP",
  "Topic :: Software Development :: Libraries",
  "Topic :: Software Development",
  "Typing :: Typed",
]
description = "Opinionated template for integrating Starlite with a SPA"
documentation = "https://cofin.github.io/starlite-full-stack-example"
homepage = "https://github.com/cofin/starlite-full-stack-example"
include = ["CHANGELOG.md"]
keywords = ["api", "rest", "http", "asgi", "pydantic", "starlette", "fastapi", "framework", "websocket", "vite", "spa"]
license = "MIT"
maintainers = ["Cody Fincher <[email protected]>"]
name = "app"
packages = [
  {include = "app", from = "src/server"},
]
readme = "README.md"
repository = "https://github.com/cofin/starlite-full-stack-example"
version = "0.1.0"
[tool.poetry.scripts]
app = "app.__main__:main"

[tool.poetry.dependencies]
alembic = "*"
asyncpg = "*"
click = "*"
greenlet = "*"
hiredis = "*"
httpx = "*"
passlib = {version = "*", extras = ["argon2"]}
pydantic = {extras = ["dotenv", "email"], version = "*"}
python = ">=3.10,<4.0"
redis = "*"
rich = "*"
sqlalchemy = {git = "https://github.com/sqlalchemy/sqlalchemy.git", branch = "main", extras = ["asyncio"]}
starlite = {version = "^1.25.0", extras = ["brotli","picologging","structlog"]}
starlite-jwt = "^1.4.0"
uvicorn = {extras = ["standard"], version = "*"}
orjson = "^3.8.3"

[tool.poetry.group.dev.dependencies]
bump2version = "*"
coverage = {extras = ["toml"], version = "*"}
cython = "*"
hypothesis = {extras = ["cli"], version = "*"}
ipykernel = "*"
ipython = "*"
pytest = "*"
pytest-asyncio = "*"
pytest-cov = "*"
pytest-dotenv = "*"
pytest-mock = "*"
tox = "*"

[tool.poetry.group.docs]
optional = true

[tool.poetry.group.docs.dependencies]
mkdocs = "*"
mkdocs-material = "*"
mkdocstrings = "*"
mkdocstrings-python = "*"

[tool.poetry.group.lint]
optional = true

[tool.poetry.group.lint.dependencies]
autoflake = "*"
bandit = "*"
black = "*"
blacken-docs = "*"
flake8 = "*"
flake8-bugbear = "*"
flake8-comprehensions = "*"
flake8-mutable = "*"
flake8-print = "*"
flake8-simplify = "*"
flake8-type-checking = "*"
freezegun = "*"
httpx = "*"
isort = "*"
mypy = "*"
pre-commit = "*"
pylint = "*"
pyupgrade = "*"
slotscheck = "*"
types-click = "*"
types-freezegun = "*"
types-passlib = "*"
types-python-jose = "*"
types-pyyaml = "*"
types-redis = "*"

[build-system]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core", "setuptools", "wheel", "cython"]

[tool.black]
exclude = '''
/(
    .git
  | .mypy_cache
  | .tox
  | venv
  | .venv
  | _build
  | buck-out
  | build
  | dist
)/
'''
include = '.pyi?$'
line-length = 120
[tool.autoflake]
check = true

[tool.isort]
line_length = 119
multi_line_output = 3
profile = "black"
skip_gitignore = true
src_paths = ["src/server", "test/server"]

[tool.coverage.run]
omit = ["*/tests/server/*"]

[tool.coverage.report]
exclude_lines = [
  'pragma: no cover',
  'if TYPE_CHECKING:',
  'except ImportError as e:',
  '...',
  "if __name__ == '__main__':",
]

[tool.pytest.ini_options]
addopts = "--cov=src -v --doctest-modules --doctest-glob=*.md --ignore=migrations"
asyncio_mode = "auto"
env_files = [".env.example"]

[tool.bandit]
exclude_dirs = ["tests"]
skips = ["B101", "B601"]
tests = ["B201", "B301", "B101"]

What could cause this? What can I try to find out what’s causing this error?

2

Answers


  1. Take a look at this. By using this Python module you can easily create templates of Python projects. Not only the file system layout of the project files but also the debugger configs for vscode. I also suffered myself the pain of trying to get Python modules without reference errors

    Project description
    PyArchetype
    This project is used to simplify the skeleton creation of python projects
    Installation

    pip install pyarchetype

    Source Code
    https://github.com/redcorjo/pyarchetype.git
    Version: 2023010702

    Login or Signup to reply.
  2. You should run this command preferably: poetry run python -m app.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search