{"id":1133,"hash":"97d79cdc3ecbc6cbabeaae7b6a9c0bdf44c5db51b02f132d44be9d5ba5d1b1c3","pattern":"poetry install | SolverProblemError Because my_project depends on string (*) which doesn&#39;t match any versions, version solving failed","full_message":"I am yet to use poetry to run project, so excuse lack of understanding.\n\nI successfully installed the poetry python library manager, using:\n\ncurl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3\n\nNext step poetry install initially returned this error:\n\nme@LAPTOP-G1DAPU88:~/.ssh/workers-python/workers$ poetry install\n\n  RuntimeError\n\n  Poetry could not find a pyproject.toml file in /home/me/.ssh/workers-python/workers or its parents\n\n  at ~/.poetry/lib/poetry/_vendor/py3.8/poetry/core/factory.py:369 in locate\n      365│             if poetry_file.exists():\n      366│                 return poetry_file\n      367│\n      368│         else:\n    → 369│             raise RuntimeError(\n      370│                 \"Poetry could not find a pyproject.toml file in {} or its parents\".format(\n      371│                     cwd\n      372│                 )\n      373│             )\n\nI soon realised I needed my own made pyproject.toml file. Running poetry install again yielded:\n\n$ poetry install\n\n  TOMLError\n\n  Invalid TOML file /home/me/.ssh/workers-python/workers/pyproject.toml: Key \"json \" already exists.\n\n  at ~/.poetry/lib/poetry/_vendor/py3.8/poetry/core/toml/file.py:34 in read\n      30│     def read(self):  # type: () -> \"TOMLDocument\"\n      31│         try:\n      32│             return super(TOMLFile, self).read()\n      33│         except (ValueError, TOMLKitError) as e:\n    → 34│             raise TOMLError(\"Invalid TOML file {}: {}\".format(self.path.as_posix(), e))\n      35│\n      36│     def __getattr__(self, item):  # type: (str) -> Any\n      37│         return getattr(self.__path, item)\n      38│\n\nAbove error indicates there were duplicate entries.\n\nRunning poetry install again with the now updated pyproject.toml file in cwd threw this error (in the post's title):\n\n$ poetry install\nCreating virtualenv my_project-1_EUeV5I-py3.8 in /home/me/.cache/pypoetry/virtualenvs\nUpdating dependencies\nResolving dependencies... (28.4s)\n\n  SolverProblemError\n\n  Because my_project depends on string (*) which doesn't match any versions, version solving failed.\n\n  at ~/.poetry/lib/poetry/puzzle/solver.py:241 in _solve\n      237│             packages = result.packages\n      238│         except OverrideNeeded as e:\n      239│             return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)\n      240│         except SolveFailure as e:\n    → 241│             raise SolverProblemError(e)\n      242│\n      243│         results = dict(\n      244│             depth_first_search(\n      245│                 PackageNode(self._package, packages), aggregate_package_nodes\n\nHowever, temporarily removing all instances = \"*\" gave me this error of \\n on line 12... which doesn't appear to be there:\n\n$ poetry install\n\n  TOMLError\n\n  Invalid TOML file /home/me/.ssh/workers-python/workers/pyproject.toml: Unexpected character: '\\n' at line 12 col 5\n\n  at ~/.poetry/lib/poetry/_vendor/py3.8/poetry/core/toml/file.py:34 in read\n      30│     def read(self):  # type: () -> \"TOMLDocument\"\n      31│         try:\n      32│             return super(TOMLFile, self).read()\n      33│         except (ValueError, TOMLKitError) as e:\n    → 34│             raise TOMLError(\"Invalid TOML file {}: {}\".format(self.path.as_posix(), e))\n      35│\n      36│     def __getattr__(self, item):  # type: (str) -> Any\n      37│         return getattr(self.__path, item)\n      38│\nme@LAPTOP-G1DAPU88:~/.ssh/workers-python/workers$ cat pyproject.toml\n[tool.poetry]\nname = \"my_project\"\nversion = \"0.1.0\"\ndescription = \"Top-level package for my_project.\"\nauthors = [\"\"]\npackages = [\n    { include = \"my_project\"},\n]\n\n[tool.poetry.dependencies]\npython = \"^3.8\"\nclick  # Suspect line\n\nI have reverted this.\n\nCurrent pyproject.toml:\n\n[tool.poetry]\nname = \"data_simulator\"\nversion = \"0.1.0\"\ndescription = \"Top-level package for data_simulator.\"\nauthors = [\"email <email@email.com>\"] # email@email.com / email@email.com\npackages = [\n    { include = \"data_simulator\"},\n]\n\n[tool.poetry.dependencies]\npython = \"^3.8\"\nclick = \"*\"\n#logging = \"*\"\n#os = \"*\"\n#pathlib = \"*\"\n#time = \"*\"\nnumpy = \"*\"\npandas = \"*\"\n#json = \"*\"\n#random = \"*\"\nfaker = \"*\"\ntransformers = \"4.4.2\"\n#re = \"*\"\n#itertools = \"*\"\n#datetime = \"*\"\n#requests = \"*\"\n#copy = \"*\"\n#collections = \"*\"\n#collections.abc = \"*\"\n#multiprocessing = \"*\"\n#multiprocessing.dummy = \"*\"\nnltk = \"*\"\n#nltk.corpus = \"*\"\n#string = \"*\"\n\n[tool.poetry.dev-dependencies]\nisort = \"5.6.4\"\nblack = \"^20.8b1\"\ninvoke = \"^1.4.1\"\ncoveralls = \"^2.2.0\"\npytest = \"^3.0\"\nflake8 = \"^3.8.3\"\nmypy = \"^0.782\"\n\n[[tool.poetry.source]]\nname = \"azure\"\nurl = \"https://pkgs.dev.azure.com/iotahoe/Halo/_packaging/private-sources/pypi/simple/\"\nsecondary = true\n\n[build-system]\nrequires = [\"poetry>=0.12\"]\nbuild-backend = \"poetry.masonry.api\"\n\nNote: 'name', 'authors', 'include', 'url' have been censored.","ecosystem":"pypi","package_name":"solver","package_version":null,"solution":"As a general advise I recommend to use poetry's command line instead of creating/manipulating the pyproject.toml.\n\nStart with a poetry init or poetry init -n and add your dependencies with poetry add.\n\nThe problem with your current pyproject.toml is, that you declare built-in packages as dependencies, like os, pathlib, string and others. This is why you receive the message Because my_project depends on string (*) which doesn't match any versions, version solving failed., which means poetry cannot find any matching package information in the repository.","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/68395472/poetry-install-solverproblemerror-because-my-project-depends-on-string-whi","votes":28,"created_at":"2026-04-19T04:52:24.098001+00:00","updated_at":"2026-04-19T04:52:24.098001+00:00"}