vprusso/toqito

New conda environment with Python 3.12 leads to installation issues

Closed this issue · 2 comments

If I try to use poetry in a new environment for Python 3.12, there are some installation issues where the project does not install at all.

conda create -n mytoqitoenv python=3.12
conda activate mytoqitoenv
pip install poetry
cd toqito
~/toqito$ poetry lock
~/toqito$ poetry install

Going down the rabbit hole of following what the error message says causes more dependency errors.

  • Installing pyflakes (3.2.0)
  • Installing qdldl (0.1.7.post0): Failed

  ChefBuildError

  Backend subprocess exited when trying to invoke build_wheel
  
  running bdist_wheel
  running build
  running build_ext
  Traceback (most recent call last):
    File "<string>", line 81, in build_extensions
    File "local_path/anaconda3/envs/mytoqitoenv/lib/python3.12/subprocess.py", line 466, in check_output
      return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "local_path/anaconda3/envs/mytoqitoenv/lib/python3.12/subprocess.py", line 548, in run
      with Popen(*popenargs, **kwargs) as process:
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "local_path/anaconda3/envs/mytoqitoenv/lib/python3.12/subprocess.py", line 1026, in __init__
      self._execute_child(args, executable, preexec_fn, close_fds,
    File "local_path/anaconda3/envs/mytoqitoenv/lib/python3.12/subprocess.py", line 1950, in _execute_child
      raise child_exception_type(errno_num, err_msg, err_filename)
  FileNotFoundError: [Errno 2] No such file or directory: 'cmake'
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "local_path/anaconda3/envs/mytoqitoenv/lib/python3.12/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "local_path/anaconda3/envs/mytoqitoenv/lib/python3.12/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "local_path/anaconda3/envs/mytoqitoenv/lib/python3.12/site-packages/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/tmp50gztfod/.venv/lib/python3.12/site-packages/setuptools/build_meta.py", line 410, in build_wheel
      return self._build_with_temp_dir(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/tmp50gztfod/.venv/lib/python3.12/site-packages/setuptools/build_meta.py", line 395, in _build_with_temp_dir
      self.run_setup()
    File "/tmp/tmp50gztfod/.venv/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup
      exec(code, locals())
    File "<string>", line 113, in <module>
    File "/tmp/tmp50gztfod/.venv/lib/python3.12/site-packages/setuptools/__init__.py", line 103, in setup
      return distutils.core.setup(**attrs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/tmp50gztfod/.venv/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 185, in setup
      return run_commands(dist)
             ^^^^^^^^^^^^^^^^^^
    File "/tmp/tmp50gztfod/.venv/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
      dist.run_commands()
    File "/tmp/tmp50gztfod/.venv/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
      self.run_command(cmd)
    File "/tmp/tmp50gztfod/.venv/lib/python3.12/site-packages/setuptools/dist.py", line 963, in run_command
      super().run_command(command)
    File "/tmp/tmp50gztfod/.venv/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/tmp/tmp50gztfod/.venv/lib/python3.12/site-packages/wheel/bdist_wheel.py", line 368, in run
      self.run_command("build")
    File "/tmp/tmp50gztfod/.venv/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "/tmp/tmp50gztfod/.venv/lib/python3.12/site-packages/setuptools/dist.py", line 963, in run_command
      super().run_command(command)
    File "/tmp/tmp50gztfod/.venv/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/tmp/tmp50gztfod/.venv/lib/python3.12/site-packages/setuptools/_distutils/command/build.py", line 131, in run
      self.run_command(cmd_name)
    File "/tmp/tmp50gztfod/.venv/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "/tmp/tmp50gztfod/.venv/lib/python3.12/site-packages/setuptools/dist.py", line 963, in run_command
      super().run_command(command)
    File "/tmp/tmp50gztfod/.venv/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/tmp/tmp50gztfod/.venv/lib/python3.12/site-packages/setuptools/command/build_ext.py", line 89, in run
      _build_ext.run(self)
    File "/tmp/tmp50gztfod/.venv/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
      self.build_extensions()
    File "<string>", line 83, in build_extensions
  RuntimeError: CMake must be installed to build qdldl
  

  at ~/anaconda3/envs/mytoqitoenv/lib/python3.12/site-packages/poetry/installation/chef.py:164 in _prepare
      160│ 
      161│                 error = ChefBuildError("\n\n".join(message_parts))
      162│ 
      163│             if error is not None:
    → 164│                 raise error from None
      165│ 
      166│             return path
      167│ 
      168│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with qdldl (0.1.7.post0) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "qdldl (==0.1.7.post0)"'.

python-poetry/poetry#6712 (comment)

osqp/qdldl-python#26

@vprusso What's a better option for resolving this issue?

  1. List additional dependencies in the toml file hoping there aren't other issues with dependencies for python 3.10 or 3.11.
  2. Add instructions in the documentation for how to fix build errors for python3.12.

Based on one of the above-linked comments, I used conda to install cmake before installing toqito. After this, poetry install failed again with a similar error for cvxopt. So, I used conda to install cvxopt based on another comment: robertmartin8/PyPortfolioOpt#284 (comment)

After this poetry install finally succeeds.

Closing this as the dependency conflict appears to have been resolved with a new release for qdldl.

Package operations: 80 installs, 1 update, 0 removals

  - Installing numpy (1.26.4)
  - Installing latexcodec (3.0.0)
  - Installing markupsafe (2.1.5)
  - Installing mdurl (0.1.2)
  - Installing pyyaml (6.0.1)
  - Installing scipy (1.13.0)
  - Installing six (1.16.0)
  - Installing alabaster (0.7.16)
  - Installing asttokens (2.4.1)
  - Installing babel (2.14.0)
  - Installing docutils (0.20.1)
  - Installing executing (2.0.1)
  - Installing imagesize (1.4.1)
  - Installing iniconfig (2.0.0)
  - Installing jinja2 (3.1.3)
  - Installing markdown-it-py (3.0.0)
  - Installing mccabe (0.7.0)
  - Installing mpmath (1.3.0)
  - Installing parso (0.8.4)
  - Installing pbr (6.0.0)
  - Installing pluggy (1.4.0)
  - Installing pure-eval (0.2.2)
  - Installing pybtex (0.24.0)
  - Installing pycodestyle (2.11.1)
  - Installing pyflakes (3.2.0)
  - Installing pygments (2.17.2)
  - Installing qdldl (0.1.7.post1)
  - Installing snowballstemmer (2.2.0)
  - Installing sphinxcontrib-applehelp (1.0.8)
  - Installing sphinxcontrib-devhelp (1.0.6)
  - Installing sphinxcontrib-htmlhelp (2.0.5)
  - Installing sphinxcontrib-jsmath (1.0.1)
  - Installing sphinxcontrib-qthelp (1.0.7)
  - Installing sphinxcontrib-serializinghtml (1.1.10)
  - Installing traitlets (5.14.2)
  - Installing wcwidth (0.2.13)
  - Installing anyascii (0.3.2)
  - Installing astroid (3.1.0)
  - Installing clarabel (0.7.1)
  - Installing coverage (7.4.4)
  - Installing cvxopt (1.3.2)
  - Installing decorator (5.1.1)
  - Installing dill (0.3.8)
  - Installing ecos (2.0.13)
  - Installing flake8 (7.0.0)
  - Installing isort (5.13.2)
  - Installing jedi (0.19.1)
  - Installing matplotlib-inline (0.1.6)
  - Installing mdit-py-plugins (0.4.0)
  - Installing mypy-extensions (1.0.0)
  - Installing osqp (0.6.4)
  - Installing prompt-toolkit (3.0.43)
  - Installing pybind11 (2.12.0)
  - Installing pybtex-docutils (1.0.3)
  - Installing pydocstyle (6.3.0)
  - Installing pytest (8.1.1)
  - Installing python-dateutil (2.9.0.post0)
  - Installing rustworkx (0.14.2)
  - Installing scs (3.2.4.post1)
  - Installing sphinx (7.2.6)
  - Installing stack-data (0.6.3)
  - Installing stevedore (5.2.0)
  - Installing symengine (0.11.0)
  - Installing sympy (1.12)
  - Installing typing-extensions (4.11.0)
  - Installing cvxpy (1.4.2): Installing...
  - Installing cvxpy (1.4.2)
  - Installing flake8-docstrings (1.7.0)
  - Installing ipython (8.23.0)
  - Installing mypy (1.9.0): Downloading... 50%
  - Installing mypy (1.9.0)
  - Installing myst-parser (2.0.0)
  - Installing pep8 (1.7.1)
  - Installing picos (2.4.17)
  - Installing pylint (3.1.0)
  - Installing pytest-cov (5.0.0)
  - Installing qiskit (1.0.2)
  - Installing readthedocs-sphinx-ext (2.2.5)
  - Installing ruff (0.3.5)
  - Updating setuptools (68.2.2 -> 69.2.0)
  - Installing sphinx-autoapi (3.0.0)
  - Installing sphinx-wagtail-theme (6.3.0)
  - Installing sphinxcontrib-bibtex (2.6.2)

Installing the current project: toqito (1.0.8)