$ # (Barsha) barshalamichhane@SI-P-778962 pyomo_approach % python product_1.py
WARNING: Could not locate the 'cbc' executable, which is required for solver
cbc
Traceback (most recent call last):
File "/Users/barshalamichhane/Library/CloudStorage/OneDrive-UniversitéLaval/Barsha/iid/nutrition_project/Barsha/src/pyomo_approach/product_1.py", line 16, in <module>
result = solver.solve(model)
^^^^^^^^^^^^^^^^^^^
File "/Users/barshalamichhane/Documents/Laval_University/iid/nutrition_project/Barsha/lib/python3.12/site-packages/pyomo/opt/base/solvers.py", line 534, in solve
self.available(exception_flag=True)
File "/Users/barshalamichhane/Documents/Laval_University/iid/nutrition_project/Barsha/lib/python3.12/site-packages/pyomo/opt/solver/shellcmd.py", line 139, in available
raise ApplicationError(msg % self.name)
pyomo.common.errors.ApplicationError: No executable found for solver 'cbc'
$ # (Barsha) barshalamichhane@SI-P-778962 pyomo_approach % pip install cbc
Collecting cbc
Using cached cbc-1.1.0-py3-none-any.whl.metadata (5.5 kB)
Collecting absl-py==1.1.0 (from cbc)
Using cached absl_py-1.1.0-py3-none-any.whl.metadata (2.3 kB)
Collecting alabaster==0.7.12 (from cbc)
Using cached alabaster-0.7.12-py2.py3-none-any.whl.metadata (2.0 kB)
Collecting astunparse==1.6.3 (from cbc)
Using cached astunparse-1.6.3-py2.py3-none-any.whl.metadata (4.4 kB)
Collecting attrs==21.4.0 (from cbc)
Using cached attrs-21.4.0-py2.py3-none-any.whl.metadata (9.8 kB)
Collecting Babel==2.10.1 (from cbc)
Using cached Babel-2.10.1-py3-none-any.whl.metadata (1.3 kB)
Collecting bleach==5.0.0 (from cbc)
Using cached bleach-5.0.0-py3-none-any.whl.metadata (26 kB)
Collecting build==0.8.0 (from cbc)
Using cached build-0.8.0-py3-none-any.whl.metadata (4.0 kB)
Collecting cachetools==5.2.0 (from cbc)
Using cached cachetools-5.2.0-py3-none-any.whl.metadata (5.1 kB)
Collecting certifi==2022.5.18.1 (from cbc)
Using cached certifi-2022.5.18.1-py3-none-any.whl.metadata (2.8 kB)
Collecting cffi==1.15.0 (from cbc)
Using cached cffi-1.15.0.tar.gz (484 kB)
Preparing metadata (setup.py) ... done
Collecting charset-normalizer==2.0.12 (from cbc)
Using cached charset_normalizer-2.0.12-py3-none-any.whl.metadata (11 kB)
Collecting commonmark==0.9.1 (from cbc)
Using cached commonmark-0.9.1-py2.py3-none-any.whl.metadata (5.7 kB)
Collecting cryptography==37.0.2 (from cbc)
Using cached cryptography-37.0.2-cp36-abi3-macosx_10_10_universal2.whl.metadata (5.5 kB)
Collecting cycler==0.11.0 (from cbc)
Using cached cycler-0.11.0-py3-none-any.whl.metadata (785 bytes)
Collecting docutils==0.18.1 (from cbc)
Using cached docutils-0.18.1-py2.py3-none-any.whl.metadata (2.9 kB)
Collecting flatbuffers==1.12 (from cbc)
Using cached flatbuffers-1.12-py2.py3-none-any.whl.metadata (872 bytes)
Collecting fonttools==4.33.3 (from cbc)
Using cached fonttools-4.33.3-py3-none-any.whl.metadata (125 kB)
Collecting gast==0.4.0 (from cbc)
Using cached gast-0.4.0-py3-none-any.whl.metadata (1.1 kB)
Collecting google-auth==2.6.6 (from cbc)
Using cached google_auth-2.6.6-py2.py3-none-any.whl.metadata (3.6 kB)
Collecting google-auth-oauthlib==0.4.6 (from cbc)
Using cached google_auth_oauthlib-0.4.6-py2.py3-none-any.whl.metadata (2.7 kB)
Collecting google-pasta==0.2.0 (from cbc)
Using cached google_pasta-0.2.0-py3-none-any.whl.metadata (814 bytes)
Collecting grpcio==1.46.3 (from cbc)
Using cached grpcio-1.46.3.tar.gz (21.8 MB)
Preparing metadata (setup.py) ... done
Collecting h5py==3.7.0 (from cbc)
Using cached h5py-3.7.0.tar.gz (392 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting idna==3.3 (from cbc)
Using cached idna-3.3-py3-none-any.whl.metadata (9.8 kB)
Collecting imagesize==1.3.0 (from cbc)
Using cached imagesize-1.3.0-py2.py3-none-any.whl.metadata (1.4 kB)
Collecting importlib-metadata==4.11.4 (from cbc)
Using cached importlib_metadata-4.11.4-py3-none-any.whl.metadata (4.0 kB)
Collecting iniconfig==1.1.1 (from cbc)
Using cached iniconfig-1.1.1-py2.py3-none-any.whl.metadata (2.4 kB)
Collecting jeepney==0.8.0 (from cbc)
Using cached jeepney-0.8.0-py3-none-any.whl.metadata (1.3 kB)
Collecting Jinja2==3.1.2 (from cbc)
Using cached Jinja2-3.1.2-py3-none-any.whl.metadata (3.5 kB)
Collecting keras==2.9.0 (from cbc)
Using cached keras-2.9.0-py2.py3-none-any.whl.metadata (1.3 kB)
Collecting Keras-Preprocessing==1.1.2 (from cbc)
Using cached Keras_Preprocessing-1.1.2-py2.py3-none-any.whl.metadata (1.9 kB)
Collecting keyring==23.5.1 (from cbc)
Using cached keyring-23.5.1-py3-none-any.whl.metadata (19 kB)
Collecting kiwisolver==1.4.2 (from cbc)
Using cached kiwisolver-1.4.2.tar.gz (96 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting libclang==14.0.1 (from cbc)
Using cached libclang-14.0.1-py2.py3-none-macosx_11_0_arm64.whl.metadata (4.8 kB)
Collecting Markdown==3.3.7 (from cbc)
Using cached Markdown-3.3.7-py3-none-any.whl.metadata (4.6 kB)
Collecting MarkupSafe==2.1.1 (from cbc)
Using cached MarkupSafe-2.1.1.tar.gz (18 kB)
Preparing metadata (setup.py) ... done
Collecting matplotlib==3.5.2 (from cbc)
Using cached matplotlib-3.5.2.tar.gz (35.2 MB)
Preparing metadata (setup.py) ... done
Collecting numpy==1.22.4 (from cbc)
Using cached numpy-1.22.4.zip (11.5 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [33 lines of output]
Traceback (most recent call last):
File "/Users/barshalamichhane/Documents/Laval_University/iid/nutrition_project/Barsha/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/Users/barshalamichhane/Documents/Laval_University/iid/nutrition_project/Barsha/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/barshalamichhane/Documents/Laval_University/iid/nutrition_project/Barsha/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 112, in get_requires_for_build_wheel
backend = _build_backend()
^^^^^^^^^^^^^^^^
File "/Users/barshalamichhane/Documents/Laval_University/iid/nutrition_project/Barsha/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 77, in _build_backend
obj = import_module(mod_path)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 994, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/private/var/folders/5q/gqq_38qd7ygbjx8qx5hj512r0000gn/T/pip-build-env-p5koig8r/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 16, in <module>
import setuptools.version
File "/private/var/folders/5q/gqq_38qd7ygbjx8qx5hj512r0000gn/T/pip-build-env-p5koig8r/overlay/lib/python3.12/site-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/private/var/folders/5q/gqq_38qd7ygbjx8qx5hj512r0000gn/T/pip-build-env-p5koig8r/overlay/lib/python3.12/site-packages/pkg_resources/__init__.py", line 2172, in <module>
register_finder(pkgutil.ImpImporter, find_on_path)
^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
$ # (Barsha) barshalamichhane@SI-P-778962 pyomo_approach % python product_1.py
WARNING: Could not locate the 'glpsol' executable, which is required for
solver 'glpk'
Traceback (most recent call last):
File "/Users/barshalamichhane/Library/CloudStorage/OneDrive-UniversitéLaval/Barsha/iid/nutrition_project/Barsha/src/pyomo_approach/product_1.py", line 16, in <module>
result = solver.solve(model)
^^^^^^^^^^^^^^^^^^^
File "/Users/barshalamichhane/Documents/Laval_University/iid/nutrition_project/Barsha/lib/python3.12/site-packages/pyomo/opt/base/solvers.py", line 534, in solve
self.available(exception_flag=True)
File "/Users/barshalamichhane/Documents/Laval_University/iid/nutrition_project/Barsha/lib/python3.12/site-packages/pyomo/opt/solver/shellcmd.py", line 139, in available
raise ApplicationError(msg % self.name)
pyomo.common.errors.ApplicationError: No executable found for solver 'glpk'
$ # (Barsha) barshalamichhane@SI-P-778962 pyomo_approach % pip install glpk
Collecting glpk
Using cached glpk-0.4.7.tar.gz (161 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: glpk
Building wheel for glpk (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for glpk (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [16 lines of output]
WARNING setuptools_scm.pyproject_reading toml section missing 'pyproject.toml does not contain a tool.setuptools_scm section'
running bdist_wheel
running build
running build_ext
building 'glpk' extension
creating build
creating build/temp.macosx-10.9-universal2-cpython-312
creating build/temp.macosx-10.9-universal2-cpython-312/src
clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -arch arm64 -arch x86_64 -g -DVERSION_NUMBER=\"0.4.7\" -I/Users/barshalamichhane/Documents/Laval_University/iid/nutrition_project/Barsha/include -I/Library/Frameworks/Python.framework/Versions/3.12/include/python3.12 -c src/2to3.c -o build/temp.macosx-10.9-universal2-cpython-312/src/2to3.o
clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -arch arm64 -arch x86_64 -g -DVERSION_NUMBER=\"0.4.7\" -I/Users/barshalamichhane/Documents/Laval_University/iid/nutrition_project/Barsha/include -I/Library/Frameworks/Python.framework/Versions/3.12/include/python3.12 -c src/bar.c -o build/temp.macosx-10.9-universal2-cpython-312/src/bar.o
In file included from src/bar.c:22:
src/lp.h:24:10: fatal error: 'glpk.h' file not found
#include <glpk.h>
^~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for glpk
Failed to build glpk
ERROR: Could not build wheels for glpk, which is required to install pyproject.toml-based projects
Information on your system
Pyomo version: 6.7.1
Python version: 3.11.5
Operating system: macOS Sonoma ; Chip: Apple M1
How Pyomo was installed (PyPI, conda, source): pip
Solver (if applicable): solver not able to install
Summary
I ran
pyomo.SolverFactory('cbc')
and alsopyomo.SolverFactory('glpk')
but I am facing the error.Steps to reproduce the issue
Error Message
Information on your system
Pyomo version: 6.7.1 Python version: 3.11.5 Operating system: macOS Sonoma ; Chip: Apple M1 How Pyomo was installed (PyPI, conda, source): pip Solver (if applicable): solver not able to install
Additional information