geocoder-php / Geocoder

The most featured Geocoder library written in PHP.
https://geocoder-php.org
MIT License
3.95k stars 519 forks source link

Error installing geocoder-php/nominatim-provider #1191

Open abishekrsrikaanth opened 1 year ago

abishekrsrikaanth commented 1 year ago

When adding the package geocoder-php/nominatim-provider using composer, I get the following error

  Problem 1
    - Root composer.json requires geocoder-php/nominatim-provider ^5.7 -> satisfiable by geocoder-php/nominatim-provider[5.7.0].
    - geocoder-php/nominatim-provider 5.7.0 requires geocoder-php/common-http ^4.1 -> found geocoder-php/common-http[4.1.0, ..., 4.5.0] but the package is fixed to 4.0.x-dev (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
ybert commented 1 year ago

Can you show your composer.json file with other packages ?

After adding the package in composer.json you can try composer update geocoder-php/nominatim-provider geocoder-php/common-http

abishekrsrikaanth commented 1 year ago

The issue seems to persist because some of the other providers still use v4.0 of "geocoder-php/common-http" but geocoder-php/nominatim-provider using v4.1 and so does geocoder-php/maptiler-provider. I am getting the same error for maptiler as well.

if you try to install the following you will see this error occuring

composer require  geocoder-php/arcgis-online-provider geocoder-php/here-provider geocoder-php/locationiq-provider geocoder-php/mapbox-provider  geocoder-php/open-cage-provider geocoder-php/nominatim-provider geocoder-php/maptiler-provider

Just wondering why all the providers aren't using the same and the latest version of geocoder-php/common-http.

ybert commented 1 year ago

I tried to install all these packages and I don't have any error.

I think you can try composer upadte geocoder-php/common-http geocoder-php/arcgis-online-provider geocoder-php/here-provider geocoder-php/locationiq-provider geocoder-php/mapbox-provider geocoder-php/open-cage-provider geocoder-php/nominatim-provider geocoder-php/maptiler-provider to fix it.

abishekrsrikaanth commented 1 year ago

@ybert what version of the nominatim and maptiler have you installed that allows installing all the above. because the depends command of composer clearly shows that all the other providers are currently set to ^4.0 and that is the reason the installation fails. The error message from composer is pretty clear. Just wondering how you are able to install it.

composer depends geocoder-php/common-http
geocoder-php/arcgis-online-provider 4.4.0 requires geocoder-php/common-http (^4.0)
geocoder-php/geo-plugin-provider    4.3.0 requires geocoder-php/common-http (^4.0)
geocoder-php/google-maps-provider   4.7.1 requires geocoder-php/common-http (^4.0)
geocoder-php/here-provider          0.7.0 requires geocoder-php/common-http (^4.0)
geocoder-php/locationiq-provider    1.4.0 requires geocoder-php/common-http (^4.0)
geocoder-php/mapbox-provider        1.4.0 requires geocoder-php/common-http (^4.0)
geocoder-php/mapquest-provider      4.3.0 requires geocoder-php/common-http (^4.0)
geocoder-php/open-cage-provider     4.6.0 requires geocoder-php/common-http (^4.0)
composer require geocoder-php/nominatim-provider
Using version ^5.7 for geocoder-php/nominatim-provider
./composer.json has been updated
Running composer update geocoder-php/nominatim-provider
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires geocoder-php/nominatim-provider ^5.7 -> satisfiable by geocoder-php/nominatim-provider[5.7.0].
    - geocoder-php/nominatim-provider 5.7.0 requires geocoder-php/common-http ^4.1 -> found geocoder-php/common-http[4.1.0, ..., 4.5.0] but the package is fixed to 4.0.x-dev (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
composer require geocoder-php/maptiler-provider
Using version ^1.1 for geocoder-php/maptiler-provider
./composer.json has been updated
Running composer update geocoder-php/maptiler-provider
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires geocoder-php/maptiler-provider ^1.1 -> satisfiable by geocoder-php/maptiler-provider[1.1.0].
    - geocoder-php/maptiler-provider 1.1.0 requires geocoder-php/common-http ^4.1 -> found geocoder-php/common-http[4.1.0, ..., 4.5.0] but the package is fixed to 4.0.x-dev (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

@jbelien could you please confirm the same on your end that you are able to install them all together

ybert commented 1 year ago

In fact ^4.0 means 4.* so it should install 4.1 if available.

Did you try the composer update command with geocoder-php/common-http in it as shown in my last comment ? Composer suggested you to update it : geocoder-php/maptiler-provider 1.1.0 requires geocoder-php/common-http ^4.1 -> found geocoder-php/common-http[4.1.0, ..., 4.5.0] but the package is fixed to 4.0.x-dev (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

abishekrsrikaanth commented 1 year ago

According to semantic versioning, ^4.0 and ^4.* means completely different.

^4.0 accepts all tags and releases under 4.0.1, 4.0.2, ...., 4.0.n but 4.* means 4.*.* and that is actually what the issue is.

Right now nominatim and maptiler are set to 4.1 on their composer files for geocoder-php/common-http and the rest use ^4.0, so there definitely is a conflict and you will not be able to add them together.

I have already tried running composer update geocoder-php/common-http

ybert commented 1 year ago

With providers requiring geocoder-php/common-http ^4.0 and others requiring ^4.1 , I get the 4.5..0 installed.

Can you provide your composer.json file ? Maybe you have other packages that requires strict version or maybe your project have a direct dependency ?

abishekrsrikaanth commented 1 year ago

I don't have a direct dependency or related dependency. I already posted the output for composer depends above. It only shows geocoder projects. I am adding the output below again here

composer depends geocoder-php/common-http
geocoder-php/arcgis-online-provider 4.4.0 requires geocoder-php/common-http (^4.0)
geocoder-php/geo-plugin-provider    4.3.0 requires geocoder-php/common-http (^4.0)
geocoder-php/google-maps-provider   4.7.1 requires geocoder-php/common-http (^4.0)
geocoder-php/here-provider          0.7.0 requires geocoder-php/common-http (^4.0)
geocoder-php/locationiq-provider    1.4.0 requires geocoder-php/common-http (^4.0)
geocoder-php/mapbox-provider        1.4.0 requires geocoder-php/common-http (^4.0)
geocoder-php/mapquest-provider      4.3.0 requires geocoder-php/common-http (^4.0)
geocoder-php/open-cage-provider     4.6.0 requires geocoder-php/common-http (^4.0)