stan-dev / httpstan

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

No matching distribution found for httpstan==4.5.0 #574

Closed michaelnlindsay closed 2 years ago

michaelnlindsay commented 2 years ago

Down a rabbit hole with dependency resolution. Initial error tells me: ERROR: Could not find a version that satisfies the requirement httpstan<4.6,>=4.5

But when I attempt to install 4.5.0, I get ERROR: No matching distribution found for httpstan==4.5.0 (from -r requirements.txt (line 27))

Are there repo settings I can update to get this?

ahartikainen commented 2 years ago

What python do you use? What is your os?

michaelnlindsay commented 2 years ago

Sorry, that would have been helpful: Vagrant (2.2.18) -> Virtualbox (6.1.26) -> Ubuntu Bionic (18.04) Python 3.7 (venv) Host: Mac OS 11.5.1

riddell-stan commented 2 years ago

You cannot pip install the wheel on Ubuntu 18.04. Try Ubuntu 20.04.

Installation from source should work on Ubuntu 18.04. Instructions are here: https://httpstan.readthedocs.io/en/latest/installation.html

michaelnlindsay commented 2 years ago

Hi! Thanks for that. I'm actually having a bit of trouble following those commands. What I've done instead is: 1) git clone git@github.com:stan-dev/httpstan.git 2) run make out of there 3) ?? run python3 build.py

build.py exits 0, but doesn't output anything and I'm not sure what to do next. Sorry for my noobishness.

michaelnlindsay commented 2 years ago

Just now realizing poetry may be pseudo code for “the package in which this statement appears in the readme”. Sorry, slow to catch up. I'm making progress now, I'm sure I'll make quick work of this importlib.resources weirdness:

test (etl) vagrant@etl:/vagrant/tmp/httpstan$ python3 -m pip install importlib.resources
Collecting importlib.resources
  Downloading https://files.pythonhosted.org/packages/f2/6c/2f3b930513bb971172ffceb63cf4e910944e57451724e69b1dec97cfefa6/importlib_resources-5.2.2-py3-none-any.whl
Collecting zipp>=3.1.0; python_version < "3.10" (from importlib.resources)
  Downloading https://files.pythonhosted.org/packages/92/d9/89f433969fb8dc5b9cbdd4b4deb587720ec1aeb59a020cf15002b9593eef/zipp-3.5.0-py3-none-any.whl
Installing collected packages: zipp, importlib.resources
Successfully installed importlib.resources zipp-3.5.0
test (etl) vagrant@etl:/vagrant/tmp/httpstan$ python3 -m httpstan build
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/vagrant/tmp/httpstan/httpstan/__main__.py", line 10, in <module>
    import httpstan.app
  File "/vagrant/tmp/httpstan/httpstan/app.py", line 10, in <module>
    import httpstan.routes
  File "/vagrant/tmp/httpstan/httpstan/routes.py", line 7, in <module>
    import httpstan.views as views
  File "/vagrant/tmp/httpstan/httpstan/views.py", line 20, in <module>
    import httpstan.models
  File "/vagrant/tmp/httpstan/httpstan/models.py", line 11, in <module>
    import importlib.resources
ModuleNotFoundError: No module named 'importlib.resources'
ahartikainen commented 2 years ago

poetry is not pseudocode.

After you have cloned the repo and cd into it

git clone https://github.com/stan-dev/httpstan
cd httpstan

you need to pip install poetry

python3 -m pip install poetry

Then call make to build stan libs

make

after that build the wheel

python3 -m poetry build

And finally you can install the wheel

python3 -m pip install dist/*.whl
michaelnlindsay commented 2 years ago

Hi, thank you very much for walking me through this, I really appreciate it.

All of those steps I've now performed successfully except the last, installing the wheel, which reports: ERROR: httpstan-4.5.0-cp37-cp37m-manylinux_2_27_x86_64.whl is not a supported wheel on this platform. Any recommendations for how to address that?

ahartikainen commented 2 years ago

I think you need to update your pip

python3 -m pip install pip -U
michaelnlindsay commented 2 years ago

That totally worked, all dependencies nicely tucked in now. Thanks so much for all your help.

michaelnlindsay commented 2 years ago

Resolved

jpmvferreira commented 2 years ago

I'm having this same issue on a virtual environment with up to date Python and pip running on a fairly old machine running CentOS 6.6.

You cannot pip install the wheel on Ubuntu 18.04. Try Ubuntu 20.04.

Installation from source should work on Ubuntu 18.04. Instructions are here: https://httpstan.readthedocs.io/en/latest/installation.html

I haven't tried to install this from source, and I will, but before I do that I would like to know why, if you don't mind me asking, is it not possible to install this package directly from pypi (which says that such a version isn't found, which is weird considering it exists) in older OS's, even when inside a virtual environment?

riddell-stan commented 2 years ago

There are two different issues here.

  1. The wheels will not work on Ubuntu 18.04 because, in essence, the version of gcc which ships with Ubuntu 18.04 is too old to compile the various C++ source files involved here.
  2. Users of Ubuntu 20.04 (and perhaps other distributions) need to upgrade pip before trying to install the wheels because the wheels use a PEP600 "platform tag" which is relatively recent. Older versions of pip do not understand this tag.

If things work under Centos 6.6, please let us know. We can add it to the list of Linux distributions which seem to work: https://pystan.readthedocs.io/en/latest/faq.html#what-linux-distributions-are-supported.

jpmvferreira commented 2 years ago

This will not work with CentOS 6.6 out of the box, as the software there is fairly old, however, considering that both me and @michaelnlindsay are using virtual environments, why would the system version of gcc or pip matter to the problem at hand?

Here's me trying to install a specific version of httpstan and failing, with a up to date version of both gcc and pip:

$ pip install httpstan==4.6.0
ERROR: Could not find a version that satisfies the requirement httpstan==4.6.0 (from versions: 0.2.5, 0.3.0, 0.3.1, 0.4.0, 0.5.0, 0.6.0, 0.7.2, 0.7.3, 0.7.5, 0.7.6, 0.8.0, 0.9.0, 0.10.1)
ERROR: No matching distribution found for httpstan==4.6.0
$ g++ -v
Reading specs from /home/jose.ferreira/.micromamba/envs/wip1-2/bin/../lib/gcc/x86_64-conda-linux-gnu/11.2.0/specs
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/home/jose.ferreira/.micromamba/envs/wip1-2/bin/../libexec/gcc/x86_64-conda-linux-gnu/11.2.0/lto-wrapper
Target: x86_64-conda-linux-gnu
Configured with: ../configure --prefix=/home/conda/feedstock_root/build_artifacts/gcc_compilers_1634095553113/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho --with-slibdir=/home/conda/feedstock_root/build_artifacts/gcc_compilers_1634095553113/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib --libdir=/home/conda/feedstock_root/build_artifacts/gcc_compilers_1634095553113/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib --build=x86_64-conda-linux-gnu --host=x86_64-conda-linux-gnu --target=x86_64-conda-linux-gnu --enable-default-pie --enable-languages=c,c++,fortran,objc,obj-c++ --enable-__cxa_atexit --disable-libmudflap --enable-libgomp --disable-libssp --enable-libquadmath --enable-libquadmath-support --enable-libsanitizer --enable-lto --enable-threads=posix --enable-target-optspace --enable-plugin --enable-gold --disable-nls --disable-bootstrap --disable-multilib --enable-long-long --enable-default-pie --with-sysroot=/home/conda/feedstock_root/build_artifacts/gcc_compilers_1634095553113/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/x86_64-conda-linux-gnu/sysroot --with-build-sysroot=/home/conda/feedstock_root/build_artifacts/gcc_compilers_1634095553113/_build_env/x86_64-conda-linux-gnu/sysroot --with-gxx-include-dir=/home/conda/feedstock_root/build_artifacts/gcc_compilers_1634095553113/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/x86_64-conda-linux-gnu/include/c++/11.2.0
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.2.0 (GCC)
$ pip -V
pip 21.3 from /home/jose.ferreira/.micromamba/envs/wip1-2/lib/python3.9/site-packages/pip (python 3.9)
riddell-stan commented 2 years ago

(I mention pip because upgrading pip does indeed solve the problem on Ubuntu 20.04, as @michaelnlindsay's experience suggests.)

For others reading this, you can see the "No matching distribution found" for more than one reason. If you still see the message after upgrading pip, it's likely because the wheels on PyPI will not work with your distribution of Linux. For example, you'll see the message if you try to install the wheels on Alpine Linux and old versions of Debian.

Here are more details:

In late 2021, httpstan releases Linux wheels with the tag manylinux_2_24_x86_64. The precise meaning of this tag is explained in PEP 600. In essence, these wheels should work on x86-64 Linux systems which use glibc version 2.24.