pythonpython-poetrysymengine

Cannot install timesynth with Poetry


When I run poetry add timesynth, I get the following error:

Backend subprocess exited when trying to invoke build_wheel

  error: Multiple top-level packages discovered in a flat-layout: ['cmake', 'symengine'].

  To avoid accidental inclusion of unwanted files or directories,
  setuptools will not proceed with this build.

  If you are trying to create a single distribution with multiple packages
  on purpose, you should not rely on automatic discovery.
  Instead, consider the following options:

  1. set up custom discovery (`find` directive with `include` or `exclude`)
  2. use a `src-layout`
  3. explicitly set `py_modules` or `packages` with a list of names

  To find more information, look for "package discovery" on setuptools docs.

The problem is with the symengine package (specifically 0.4.0 version). I've tried editing pyproject.toml like so:

[tool.setuptools]
py-modules = []

As suggested in this SO answer, nothing changed. I've also included "timesynth" and "symengine" inside this list, no luck.

I've also tried including this codeblock:

[tool.setuptools.packages.find]
where = ["symengine"]
include = ["pkg*", "symengine"]  # alternatively: `exclude = ["additional*"]`
namespaces = false

But it didn't help.

I'm trying to follow a book about timeseries, but I can't figure out how to install this package. I'm on Windows 11, and Python 3.11 if that matters.


Solution

  • I assume you are referring to the Modern Time Series Forecasting with Python book.

    I encountered the same problem. The problem is that the current TimeSynth version (0.2.4) depends on the 0.4 version of the symengine package (which is odd since inspecting the source code, the requirements are set to symengine>=0.4). I've tried installing the symengine==0.4 manually, however that did not work either. I assume that the book's environment also depends on the latest version of the symengine (0.13.0), thus leading to a dependency version conflict.

    The solution is to install the TimeSynth directly from its github repository:

    poetry add git+https://github.com/TimeSynth/TimeSynth.git

    If you now open your pyproject.toml file, you will see

    timesynth = {git = "https://github.com/TimeSynth/TimeSynth.git"}

    under the tool.poetry.dependencies section.

    Hope this helps!