bodono / scs-python

Python interface for SCS
MIT License
41 stars 33 forks source link

fix unable to install due to setuptools conflicts #65

Closed ZhiyuanChen closed 1 year ago

ZhiyuanChen commented 1 year ago

setuptools == 65.6.0 remove distutils.log.Log, this leads to numpy issues see https://github.com/pypa/setuptools/issues/3693

bodono commented 1 year ago

Thanks!

andruten commented 1 year ago

Are you planning to release a version containing this change? I can't install latest scs version in a docker container (ARM) with debian 11 but it works installing it from git.

Thanks in advance!

EDIT:

ARM traceback:

$ docker run --platform=linux/arm64/v8 -it python:3.9-slim-bullseye bash
Unable to find image 'python:3.9-slim-bullseye' locally
3.9-slim-bullseye: Pulling from library/python
Digest: sha256:9ef969a374118f28a61261e2b018a7f9debcc0dc1342481bd8b8693c1457f46d
Status: Downloaded newer image for python:3.9-slim-bullseye
root@729d9b86b71f:/# pip install scs
Collecting scs
  Downloading scs-3.2.2.tar.gz (663 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 663.9/663.9 KB 1.2 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [62 lines of output]
      Namespace(scs=False, gpu=False, mkl=False, float32=False, extraverbose=False, gpu_atrans=True, int32=False, blas64=False)
      running dist_info
      creating /tmp/pip-modern-metadata-iobqfyl1/scs.egg-info
      writing /tmp/pip-modern-metadata-iobqfyl1/scs.egg-info/PKG-INFO
      writing dependency_links to /tmp/pip-modern-metadata-iobqfyl1/scs.egg-info/dependency_links.txt
      writing requirements to /tmp/pip-modern-metadata-iobqfyl1/scs.egg-info/requires.txt
      writing top-level names to /tmp/pip-modern-metadata-iobqfyl1/scs.egg-info/top_level.txt
      writing manifest file '/tmp/pip-modern-metadata-iobqfyl1/scs.egg-info/SOURCES.txt'
      Traceback (most recent call last):
        File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 164, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
        File "/tmp/pip-build-env-onq4m0o2/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 377, in prepare_metadata_for_build_wheel
          self.run_setup()
        File "/tmp/pip-build-env-onq4m0o2/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 299, in <module>
        File "<string>", line 271, in install_scs
        File "/tmp/pip-build-env-onq4m0o2/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
        File "/tmp/pip-build-env-onq4m0o2/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/tmp/pip-build-env-onq4m0o2/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/tmp/pip-build-env-onq4m0o2/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/tmp/pip-build-env-onq4m0o2/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1217, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-onq4m0o2/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-onq4m0o2/overlay/lib/python3.9/site-packages/setuptools/command/dist_info.py", line 96, in run
          self.egg_info.run()
        File "/tmp/pip-build-env-onq4m0o2/overlay/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 308, in run
          self.find_sources()
        File "/tmp/pip-build-env-onq4m0o2/overlay/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 316, in find_sources
          mm.run()
        File "/tmp/pip-build-env-onq4m0o2/overlay/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 560, in run
          self.add_defaults()
        File "/tmp/pip-build-env-onq4m0o2/overlay/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 597, in add_defaults
          sdist.add_defaults(self)
        File "/tmp/pip-build-env-onq4m0o2/overlay/lib/python3.9/site-packages/setuptools/command/sdist.py", line 106, in add_defaults
          super().add_defaults()
        File "/tmp/pip-build-env-onq4m0o2/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/sdist.py", line 252, in add_defaults
          self._add_defaults_ext()
        File "/tmp/pip-build-env-onq4m0o2/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/sdist.py", line 336, in _add_defaults_ext
          build_ext = self.get_finalized_command('build_ext')
        File "/tmp/pip-build-env-onq4m0o2/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 305, in get_finalized_command
          cmd_obj.ensure_finalized()
        File "/tmp/pip-build-env-onq4m0o2/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 111, in ensure_finalized
          self.finalize_options()
        File "<string>", line 138, in finalize_options
        File "<string>", line 93, in get_infos
        File "/tmp/pip-build-env-onq4m0o2/overlay/lib/python3.9/site-packages/numpy/distutils/__init__.py", line 24, in <module>
          from . import ccompiler
        File "/tmp/pip-build-env-onq4m0o2/overlay/lib/python3.9/site-packages/numpy/distutils/ccompiler.py", line 20, in <module>
          from numpy.distutils import log
        File "/tmp/pip-build-env-onq4m0o2/overlay/lib/python3.9/site-packages/numpy/distutils/log.py", line 4, in <module>
          from distutils.log import Log as old_Log
      ImportError: cannot import name 'Log' from 'distutils.log' (/tmp/pip-build-env-onq4m0o2/overlay/lib/python3.9/site-packages/setuptools/_distutils/log.py)
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
WARNING: You are using pip version 22.0.4; however, version 22.3.1 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.

amd64 traceback:

$ docker run --platform=linux/amd64 -it python:3.9-slim-bullseye bash
Unable to find image 'python:3.9-slim-bullseye' locally
3.9-slim-bullseye: Pulling from library/python
a603fa5e3b41: Pull complete
b00aaacf759c: Pull complete
d50f75309cbe: Pull complete
eea95839e7aa: Pull complete
768bc4d5c5fd: Pull complete
Digest: sha256:9ef969a374118f28a61261e2b018a7f9debcc0dc1342481bd8b8693c1457f46d
Status: Downloaded newer image for python:3.9-slim-bullseye
root@dfc641c2efc4:/# pip install scs
Collecting scs
  Downloading scs-3.2.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (10.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.7/10.7 MB 9.8 MB/s eta 0:00:00
Collecting numpy>=1.7
  Downloading numpy-1.23.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.1/17.1 MB 11.2 MB/s eta 0:00:00
Collecting scipy>=0.13.2
  Downloading scipy-1.9.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (33.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 33.8/33.8 MB 9.5 MB/s eta 0:00:00
Installing collected packages: numpy, scipy, scs
Successfully installed numpy-1.23.5 scipy-1.9.3 scs-3.2.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: You are using pip version 22.0.4; however, version 22.3.1 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
root@dfc641c2efc4:/#

Both containers are using

# pip list
Package    Version
---------- -------
pip        22.0.4
setuptools 58.1.0
wheel      0.38.4
andruten commented 1 year ago

It has been fixed in setuptools https://github.com/pypa/setuptools/pull/3709

bodono commented 1 year ago

Does this mean we can revert this change?

andruten commented 1 year ago

It seems so...

$ docker run --platform=linux/arm64/v8 -it python:3.9-slim-bullseye bash
root@ec3fe9472542:/# apt update && apt install gcc -y
[..]
root@ce2b13600224:/# pip install scs
Collecting scs
  Downloading scs-3.2.2.tar.gz (663 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 663.9/663.9 KB 1.4 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting scipy>=0.13.2
  Downloading scipy-1.9.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (30.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 30.1/30.1 MB 8.6 MB/s eta 0:00:00
Collecting numpy>=1.7
  Downloading numpy-1.23.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (14.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 14.0/14.0 MB 9.7 MB/s eta 0:00:00
Building wheels for collected packages: scs
  Building wheel for scs (pyproject.toml) ... done
  Created wheel for scs: filename=scs-3.2.2-cp39-cp39-linux_aarch64.whl size=90575 sha256=64693239c3a17da8421df531ff183cd65ad1b2c21db9f69e6c54d2af0e7f9744
  Stored in directory: /root/.cache/pip/wheels/8b/d6/e9/14b1c9800f9f8d5ef7f73d03b1459e3816aaf911a9884df31a
Successfully built scs
Installing collected packages: numpy, scipy, scs
Successfully installed numpy-1.23.5 scipy-1.9.3 scs-3.2.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: You are using pip version 22.0.4; however, version 22.3.1 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
bodono commented 1 year ago

I will keep it in for a while anyway. Do you still need another release or is this sufficient?

andruten commented 1 year ago

I don't need it at the moment. Thank you @bodono :)

It would be nice to have wheels for aarch64. Do you know if there is any kind of limitation for this? I could publish a PR.

bodono commented 1 year ago

Yes that would be great. The wheels are all published by a github action, at some point I don't think actions could run on aarch64 but it looks like maybe now they can, I guess via cross-compilation.