Closed samhiggs closed 2 years ago
Can you try to build and install httpstan when creating the container.
I think something in httpstan is precompiled, then linked but then fails if used.
Yep so tried to both install from source and build.
Install from source git clone ... && cd httpstan && git checkout 4.7.2 && pip install .
resulted in no module named setuptools
× Building wheel for httpstan (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [25 lines of output]
A setup.py file already exists. Using it.
Traceback (most recent call last):
File "/httpstan/setup.py", line 2, in <module>
from setuptools import setup
ModuleNotFoundError: No module named 'setuptools'
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
main()
File "/usr/local/lib/python3.10/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.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 261, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/tmp/pip-build-env-pit6zccr/overlay/lib/python3.10/site-packages/poetry/core/masonry/api.py", line 68, in build_wheel
return unicode(WheelBuilder.make_in(poetry, Path(wheel_directory)))
File "/tmp/pip-build-env-pit6zccr/overlay/lib/python3.10/site-packages/poetry/core/masonry/builders/wheel.py", line 78, in make_in
wb.build()
File "/tmp/pip-build-env-pit6zccr/overlay/lib/python3.10/site-packages/poetry/core/masonry/builders/wheel.py", line 110, in build
self._build(zip_file)
File "/tmp/pip-build-env-pit6zccr/overlay/lib/python3.10/site-packages/poetry/core/masonry/builders/wheel.py", line 162, in _build
self._run_build_command(setup)
File "/tmp/pip-build-env-pit6zccr/overlay/lib/python3.10/site-packages/poetry/core/masonry/builders/wheel.py", line 190, in _run_build_command
subprocess.check_call(
File "/usr/local/lib/python3.10/subprocess.py", line 369, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/local/bin/python', '/httpstan/setup.py', 'build', '-b', '/httpstan/build']' returned non-zero exit status 1.
Attempt to build package from source python setup.py sdist bdist_wheel
resulted in a missing header by the looks of it
root@87f1f8c9cb33:/httpstan# python setup.py sdist bdist_wheel
running sdist
running egg_info
creating httpstan.egg-info
writing httpstan.egg-info/PKG-INFO
writing dependency_links to httpstan.egg-info/dependency_links.txt
writing requirements to httpstan.egg-info/requires.txt
writing top-level names to httpstan.egg-info/top_level.txt
writing manifest file 'httpstan.egg-info/SOURCES.txt'
reading manifest file 'httpstan.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'httpstan.egg-info/SOURCES.txt'
running check
creating httpstan-4.7.2
creating httpstan-4.7.2/httpstan
creating httpstan-4.7.2/httpstan.egg-info
creating httpstan-4.7.2/httpstan/services
copying files to httpstan-4.7.2...
copying LICENSE -> httpstan-4.7.2
copying README.rst -> httpstan-4.7.2
copying pyproject.toml -> httpstan-4.7.2
copying setup.cfg -> httpstan-4.7.2
copying setup.py -> httpstan-4.7.2
copying httpstan/__init__.py -> httpstan-4.7.2/httpstan
copying httpstan/__main__.py -> httpstan-4.7.2/httpstan
copying httpstan/app.py -> httpstan-4.7.2/httpstan
copying httpstan/build_ext.py -> httpstan-4.7.2/httpstan
copying httpstan/cache.py -> httpstan-4.7.2/httpstan
copying httpstan/compile.py -> httpstan-4.7.2/httpstan
copying httpstan/config.py -> httpstan-4.7.2/httpstan
copying httpstan/empty.cpp -> httpstan-4.7.2/httpstan
copying httpstan/fits.py -> httpstan-4.7.2/httpstan
copying httpstan/models.py -> httpstan-4.7.2/httpstan
copying httpstan/openapi.py -> httpstan-4.7.2/httpstan
copying httpstan/routes.py -> httpstan-4.7.2/httpstan
copying httpstan/schemas.py -> httpstan-4.7.2/httpstan
copying httpstan/services_stub.py -> httpstan-4.7.2/httpstan
copying httpstan/socket_logger.hpp -> httpstan-4.7.2/httpstan
copying httpstan/socket_writer.hpp -> httpstan-4.7.2/httpstan
copying httpstan/stan.pyi -> httpstan-4.7.2/httpstan
copying httpstan/stan_services.cpp -> httpstan-4.7.2/httpstan
copying httpstan/utils.py -> httpstan-4.7.2/httpstan
copying httpstan/views.py -> httpstan-4.7.2/httpstan
copying httpstan.egg-info/PKG-INFO -> httpstan-4.7.2/httpstan.egg-info
copying httpstan.egg-info/SOURCES.txt -> httpstan-4.7.2/httpstan.egg-info
copying httpstan.egg-info/dependency_links.txt -> httpstan-4.7.2/httpstan.egg-info
copying httpstan.egg-info/requires.txt -> httpstan-4.7.2/httpstan.egg-info
copying httpstan.egg-info/top_level.txt -> httpstan-4.7.2/httpstan.egg-info
copying httpstan/services/__init__.py -> httpstan-4.7.2/httpstan/services
copying httpstan/services/arguments.py -> httpstan-4.7.2/httpstan/services
copying httpstan/services/cmdstan-help-all.json -> httpstan-4.7.2/httpstan/services
Writing httpstan-4.7.2/setup.cfg
creating dist
Creating tar archive
removing 'httpstan-4.7.2' (and everything under it)
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-310
creating build/lib.linux-x86_64-cpython-310/httpstan
copying httpstan/build_ext.py -> build/lib.linux-x86_64-cpython-310/httpstan
copying httpstan/compile.py -> build/lib.linux-x86_64-cpython-310/httpstan
copying httpstan/views.py -> build/lib.linux-x86_64-cpython-310/httpstan
copying httpstan/services_stub.py -> build/lib.linux-x86_64-cpython-310/httpstan
copying httpstan/openapi.py -> build/lib.linux-x86_64-cpython-310/httpstan
copying httpstan/__main__.py -> build/lib.linux-x86_64-cpython-310/httpstan
copying httpstan/__init__.py -> build/lib.linux-x86_64-cpython-310/httpstan
copying httpstan/fits.py -> build/lib.linux-x86_64-cpython-310/httpstan
copying httpstan/routes.py -> build/lib.linux-x86_64-cpython-310/httpstan
copying httpstan/config.py -> build/lib.linux-x86_64-cpython-310/httpstan
copying httpstan/schemas.py -> build/lib.linux-x86_64-cpython-310/httpstan
copying httpstan/app.py -> build/lib.linux-x86_64-cpython-310/httpstan
copying httpstan/utils.py -> build/lib.linux-x86_64-cpython-310/httpstan
copying httpstan/models.py -> build/lib.linux-x86_64-cpython-310/httpstan
copying httpstan/cache.py -> build/lib.linux-x86_64-cpython-310/httpstan
creating build/lib.linux-x86_64-cpython-310/httpstan/services
copying httpstan/services/arguments.py -> build/lib.linux-x86_64-cpython-310/httpstan/services
copying httpstan/services/__init__.py -> build/lib.linux-x86_64-cpython-310/httpstan/services
copying httpstan/stan_services.cpp -> build/lib.linux-x86_64-cpython-310/httpstan
copying httpstan/socket_writer.hpp -> build/lib.linux-x86_64-cpython-310/httpstan
copying httpstan/stan.pyi -> build/lib.linux-x86_64-cpython-310/httpstan
copying httpstan/empty.cpp -> build/lib.linux-x86_64-cpython-310/httpstan
copying httpstan/socket_logger.hpp -> build/lib.linux-x86_64-cpython-310/httpstan
copying httpstan/services/cmdstan-help-all.json -> build/lib.linux-x86_64-cpython-310/httpstan/services
running build_ext
building 'httpstan.empty' extension
creating build/temp.linux-x86_64-cpython-310
creating build/temp.linux-x86_64-cpython-310/httpstan
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Ihttpstan/include -I/usr/local/include/python3.10 -c httpstan/empty.cpp -o build/temp.linux-x86_64-cpython-310/httpstan/empty.o -fvisibility=hidden -std=c++14
httpstan/empty.cpp:1:10: fatal error: pybind11/pybind11.h: No such file or directory
1 | #include <pybind11/pybind11.h>
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1
I just tried pystan==3.0.0 which seemed to install OK, if that helps.
To install httpstan from source see the following instructions
OK so did that, and got the a similar result.
root@5938bd87209c:/httpstan# python3 -m poetry build
Creating virtualenv httpstan-tJ3t_SzP-py3.9 in /root/.cache/pypoetry/virtualenvs
Building httpstan (4.7.2)
- Building sdist
- Built httpstan-4.7.2.tar.gz
- Building wheel
running build
running build_py
creating /httpstan/build
creating /httpstan/build/lib.linux-x86_64-cpython-39
creating /httpstan/build/lib.linux-x86_64-cpython-39/httpstan
copying httpstan/build_ext.py -> /httpstan/build/lib.linux-x86_64-cpython-39/httpstan
copying httpstan/compile.py -> /httpstan/build/lib.linux-x86_64-cpython-39/httpstan
copying httpstan/views.py -> /httpstan/build/lib.linux-x86_64-cpython-39/httpstan
copying httpstan/services_stub.py -> /httpstan/build/lib.linux-x86_64-cpython-39/httpstan
copying httpstan/openapi.py -> /httpstan/build/lib.linux-x86_64-cpython-39/httpstan
copying httpstan/__main__.py -> /httpstan/build/lib.linux-x86_64-cpython-39/httpstan
copying httpstan/__init__.py -> /httpstan/build/lib.linux-x86_64-cpython-39/httpstan
copying httpstan/fits.py -> /httpstan/build/lib.linux-x86_64-cpython-39/httpstan
copying httpstan/routes.py -> /httpstan/build/lib.linux-x86_64-cpython-39/httpstan
copying httpstan/config.py -> /httpstan/build/lib.linux-x86_64-cpython-39/httpstan
copying httpstan/schemas.py -> /httpstan/build/lib.linux-x86_64-cpython-39/httpstan
copying httpstan/app.py -> /httpstan/build/lib.linux-x86_64-cpython-39/httpstan
copying httpstan/utils.py -> /httpstan/build/lib.linux-x86_64-cpython-39/httpstan
copying httpstan/models.py -> /httpstan/build/lib.linux-x86_64-cpython-39/httpstan
copying httpstan/cache.py -> /httpstan/build/lib.linux-x86_64-cpython-39/httpstan
creating /httpstan/build/lib.linux-x86_64-cpython-39/httpstan/services
copying httpstan/services/arguments.py -> /httpstan/build/lib.linux-x86_64-cpython-39/httpstan/services
copying httpstan/services/__init__.py -> /httpstan/build/lib.linux-x86_64-cpython-39/httpstan/services
copying httpstan/stan_services.cpp -> /httpstan/build/lib.linux-x86_64-cpython-39/httpstan
copying httpstan/socket_writer.hpp -> /httpstan/build/lib.linux-x86_64-cpython-39/httpstan
copying httpstan/stan.pyi -> /httpstan/build/lib.linux-x86_64-cpython-39/httpstan
copying httpstan/empty.cpp -> /httpstan/build/lib.linux-x86_64-cpython-39/httpstan
copying httpstan/socket_logger.hpp -> /httpstan/build/lib.linux-x86_64-cpython-39/httpstan
copying httpstan/services/cmdstan-help-all.json -> /httpstan/build/lib.linux-x86_64-cpython-39/httpstan/services
running build_ext
building 'httpstan.empty' extension
creating /httpstan/build/temp.linux-x86_64-cpython-39
creating /httpstan/build/temp.linux-x86_64-cpython-39/httpstan
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Ihttpstan/include -I/root/.cache/pypoetry/virtualenvs/httpstan-tJ3t_SzP-py3.9/include -I/usr/local/include/python3.9 -c httpstan/empty.cpp -o /httpstan/build/temp.linux-x86_64-cpython-39/httpstan/empty.o -fvisibility=hidden -std=c++14
httpstan/empty.cpp:1:10: fatal error: pybind11/pybind11.h: No such file or directory
1 | #include <pybind11/pybind11.h>
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1
CalledProcessError
Command '['/root/.cache/pypoetry/virtualenvs/httpstan-tJ3t_SzP-py3.9/bin/python', '/httpstan/setup.py', 'build', '-b', '/httpstan/build']' returned non-zero exit status 1.
at /usr/local/lib/python3.9/subprocess.py:373 in check_call
369│ if retcode:
370│ cmd = kwargs.get("args")
371│ if cmd is None:
372│ cmd = popenargs[0]
→ 373│ raise CalledProcessError(retcode, cmd)
374│ return 0
375│
376│
377│ def check_output(*popenargs, timeout=None, **kwargs):
https://github.com/stan-dev/httpstan/blob/main/.github/workflows/main.yml
Check how httpstan does it in workflows.
Judging by https://github.com/stan-dev/pystan/issues/350#issuecomment-1164047384, it looks like @samhiggs is having trouble installing httpstan from source. (Is make
being run, as indicated in the linked httpstan installation docs?)
Since this isn't a bug report, I'm going to close it. I think the right place for this is the Stan forums.
Describe the bug
Running any model definition results in a JSON document error as it's trying to build. I have tried using my model, the example model, a simple linear model all have the same result.
Trying to run pystan 3.4.0 in a linux/amd64 python container
Describe your system
Steps/Code to Reproduce
docker run --platform linux/amd64 --rm -it -v $(pwd)/sample_stan.py:/sample_stan.py python:3.10-bullseye bash
pip install pystan==3.4.0
(in container)python sample_stan.py
(in container)sample_stan.py
Full Trace