stan-dev / httpstan

HTTP interface to Stan, a package for Bayesian inference.
ISC License
39 stars 15 forks source link

Failed to build from source #618

Closed junfang219 closed 1 year ago

junfang219 commented 1 year ago

Following instructions at https://httpstan.readthedocs.io/en/latest/installation.html, I tried to build httpstan from source but ran into an error:

$ python3 -m poetry build
Preparing build environment with build-system requirements poetry_core>=1.0.0
Building httpstan (4.8.2)
A setup.py file already exists. Using it.
Traceback (most recent call last):
  File "/Users/junfang/httpstan/setup.py", line 2, in <module>
    from setuptools import setup
ModuleNotFoundError: No module named 'setuptools'

Command '['/var/folders/xt/054c0wwd5kg9jywqp3vkpz140000gn/T/tmpey1wrxzn/.venv/bin/python', '/Users/junfang/httpstan/setup.py', 'build', '-b', '/Users/junfang/httpstan/build']' returned non-zero exit status 1.

I tried various pip commands to install setuptools. Even though it seems to have been installed successfully, I keep getting the same error message. Any ideas?

riddell-stan commented 1 year ago

Perhaps try again using a clean clone of the repository? httpstan does not contain a file called "setup.py".

thomas-brx commented 1 year ago

I ran into the same issue when building inside a venv. setup.py is created by poetry. I did manage to build by using poetry==1.1.12 instead, so I used this procedure:

# Build shared libraries and generate code
python3 -m pip install poetry==1.1.12
make

# Build the httpstan wheel
python3 -m poetry build

# Install the wheel
python3 -m pip install dist/*.whl
riddell-stan commented 1 year ago

I can reproduce this problem. It's caused by a change in poetry 1.2. I'll push a fix in a moment.

junfang219 commented 1 year ago

Thanks for fixing the issue. I reinstalled it but ran into another error

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. poetry 1.1.12 requires packaging<21.0,>=20.4, but you have packaging 21.3 which is incompatible. poetry-plugin-export 1.0.7 requires poetry<2.0.0,>=1.2.0, but you have poetry 1.1.12 which is incompatible. poetry-plugin-export 1.0.7 requires poetry-core<2.0.0,>=1.1.0, but you have poetry-core 1.0.8 which is incompatible.

Any ideas?

riddell-stan commented 1 year ago

I'd start over with a clean virtualenv and follow the instructions.

It probably would be a good idea to indicate somewhere that poetry 1.2 is required now.