4

Running this composer require intervention/image throws this error:

Using version ^2.3 for intervention/image
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Conclusion: don't install intervention/image 2.3.1
- Conclusion: don't install intervention/image 2.3.2
- Installation request for intervention/image ^2.3 -> satisfiable by intervention/image[2.3.0, 2.3.1, 2.3.2].
- intervention/image 2.3.0 requires guzzlehttp/psr7 ~1.1 -> satisfiable by guzzlehttp/psr7[1.1.0, 1.2.0].
- guzzlehttp/psr7 1.1.0 requires psr/http-message ~1.0 -> satisfiable by psr/http-message[1.0].
- guzzlehttp/psr7 1.2.0 requires psr/http-message ~1.0 -> satisfiable by psr/http-message[1.0].
- Conclusion: don't install psr/http-message 1.0


Installation failed, reverting ./composer.json to its original content.

So it's caused by Guzzle (I'm using "guzzlehttp/guzzle": "~5.3"). But I can't (or don't want) to update guzzle to 6.0 because it's not backward compatible, so I have to move a lot of code. Can I do something, like a trick, or do I have to update guzzlehttp/guzzle or intervention/image?

rap-2-h
  • 30,204
  • 37
  • 167
  • 263
  • Does your dependency use Guzzle on top of your main app? If they are specifying two different version of Guzzle you can run into this issue. – Zarathuztra Sep 07 '15 at 14:56

3 Answers3

5

Using the alias method has a serious drawback: It won't work!

I doubt your usage of Guzzle 5 is the reason for your message, but for more investigation I'd need the content of your composer.json, and likely your composer.lock file as well.

The dependencies being added here are not too complicated. intervention/image depends on guzzlehttp/psr7 ~1.1, which depends on psr/http-message ~1.0. The Guzzle package is a brand new one which hasn't been used with previous versions of Guzzle 5.x, and the PSR package should also not conflict with anything - but this is exactly what Composer detects. However, decrypting the error messages of the SAT solver in Composer is not easy. The solver can easily create you a solution that works for all requirements, but pinpointing failure is very hard. Composer would do it for you if it was possible.

There is a tool that can help humans debug such a situation: https://packagist.org/packages/clue/graph-composer

It's a command line tool that is best installed with composer global require clue/graph-composer, and it also needs "graphviz" installed. Using it on your existing project will reveal all the package dependencies that are currently existing, and might give you a clue what might be wrong.

Sven
  • 69,403
  • 10
  • 107
  • 109
  • Thank you! This response really helps, it's clear and precise. Anyway I switched to a previous version of intervention/image, it's not important to have the latest version in my project. Many thanks! – rap-2-h Sep 09 '15 at 07:27
  • @Sven Thanks for pointing out "clue/graph-composer". Its a nice tool for visualization of Composer dependencies. Do you know of tools doing the same, but without the heavy "graphviz" dependency? – Jens A. Koch Sep 10 '15 at 09:49
  • I think there's no current product being able to draw graphs the way Graphviz does - at least not in the open source domain. A lot of knowledge about how to draw things went into that software, so it's probably not that easy to have a replacement. On the other hand, I had no serious problems installing it on several platforms (i.e. Linux and Windows) and make it available to the graph-composer package. – Sven Sep 13 '15 at 13:44
  • 2
    Wouldn't it be hilarious if there were dependency conflicts when installing graph-composer or graphviz?... – ADJenks Feb 03 '17 at 20:32
1

You might use an alias to trick Composer into thinking that v5.3.0 of guzzle is actually v6.0.

Defining "guzzlehttp/guzzle": "~5.3 as 6.0" will not work, because that's just an invalid string. You have to be specific about the version and insert 5.3.0, like so:

composer.json

{
    "require": {
        "intervention/image": "^2.3",
        "guzzlehttp/guzzle": "5.3.0 as 6.0"
    }
}

You could also update your code to work with guzzlehttp/guzzle v6, but that's probably more work than changing few chars in composer.json. ,)


It's a trick but it won't work. You can have a look at @Sven answer.

Its pretty obvious that you didn't test what i posted. Aliasing a version is one way to get it done. Its not the holy grail of fixing all dependency issues. Its a simple method to resolve a version clash.

[50.2MB/9.02s]   - Installing react/promise (v2.2.1)
[50.6MB/9.07s] Reading C:/Users/koch/AppData/Local/Composer/files/react/promise/3b6fca09c7d56321057fa8867c8dbe1abf648627.zip from cache
[50.6MB/9.08s]     Loading from cache
[50.6MB/9.08s]     Extracting archive
[50.7MB/9.47s]
[50.7MB/9.48s]     REASON: guzzlehttp/ringphp 1.1.0 requires react/promise ~2.0 -> satisfiable by react/promise[v2.0.0, v2.1.0, v2.2.0, v2.2.1].
[50.7MB/9.48s]
[50.7MB/9.49s]   - Installing guzzlehttp/streams (3.0.0)
[50.7MB/9.53s] Reading C:/Users/koch/AppData/Local/Composer/files/guzzlehttp/streams/47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5.zip from cache
[50.7MB/9.54s]     Loading from cache
[50.7MB/9.54s]     Extracting archive
[50.7MB/9.92s]
[50.7MB/9.93s]     REASON: guzzlehttp/ringphp 1.1.0 requires guzzlehttp/streams ~3.0 -> satisfiable by guzzlehttp/streams[3.0.0].
[50.7MB/9.93s]
[50.7MB/9.94s]   - Installing guzzlehttp/ringphp (1.1.0)
[50.7MB/10.01s] Reading C:/Users/koch/AppData/Local/Composer/files/guzzlehttp/ringphp/dbbb91d7f6c191e5e405e900e3102ac7f261bc0b.zip from cache
[50.7MB/10.02s]     Loading from cache
[50.7MB/10.02s]     Extracting archive
[50.7MB/10.41s]
[50.7MB/10.41s]     REASON: guzzlehttp/guzzle 5.3.0 requires guzzlehttp/ringphp ^1.1 -> satisfiable by guzzlehttp/ringphp[1.1.0].
[50.7MB/10.41s]
[50.7MB/10.43s]   - Installing guzzlehttp/guzzle (5.3.0)
[50.7MB/10.49s] Reading C:/Users/koch/AppData/Local/Composer/files/guzzlehttp/guzzle/f3c8c22471cb55475105c14769644a49c3262b93.zip from cache
[50.7MB/10.51s]     Loading from cache
[50.7MB/10.51s]     Extracting archive
[50.7MB/11.66s]
[50.7MB/11.66s]     REASON: Required by root: Install command rule (install guzzlehttp/guzzle 5.3.0)
[50.7MB/11.66s]
[50.7MB/11.69s]   - Installing psr/http-message (1.0)
[50.7MB/11.77s] Reading C:/Users/koch/AppData/Local/Composer/files/psr/http-message/85d63699f0dbedb190bbd4b0d2b9dc707ea4c298.zip from cache
[50.7MB/11.78s]     Loading from cache
[50.7MB/11.78s]     Extracting archive
[50.7MB/11.91s]
[50.7MB/11.91s]     REASON: guzzlehttp/psr7 1.2.0 requires psr/http-message ~1.0 -> satisfiable by psr/http-message[1.0].
[50.7MB/11.91s]
[50.7MB/11.94s]   - Installing guzzlehttp/psr7 (1.2.0)
[50.7MB/11.98s] Reading C:/Users/koch/AppData/Local/Composer/files/guzzlehttp/psr7/4ef919b0cf3b1989523138b60163bbcb7ba1ff7e.zip from cache
[50.7MB/11.98s]     Loading from cache
[50.7MB/11.98s]     Extracting archive
[50.7MB/12.61s]
[50.7MB/12.61s]     REASON: intervention/image 2.3.2 requires guzzlehttp/psr7 ~1.1 -> satisfiable by guzzlehttp/psr7[1.1.0, 1.2.0].
[50.7MB/12.61s]
[50.7MB/12.64s]   - Installing intervention/image (2.3.2)
[50.7MB/12.73s] Reading C:/Users/koch/AppData/Local/Composer/files/intervention/image/1124ff3c6298f0dcf9edf9156623904d7a5c3428.zip from cache
[50.7MB/12.74s]     Loading from cache
[50.7MB/12.74s]     Extracting archive
[50.7MB/14.72s]
[50.7MB/14.72s]     REASON: Required by root: Install command rule (install intervention/image 2.3.0|install intervention/image 2.3.1|install intervention/image 2.3.2)
[50.7MB/14.72s]
[50.3MB/15.09s] intervention/image suggests installing ext-gd (to use GD library based image processing.)
[50.3MB/15.10s] intervention/image suggests installing ext-imagick (to use Imagick based image processing.)
[50.3MB/15.11s] intervention/image suggests installing intervention/imagecache (Caching extension for the Intervention Image library)
[50.4MB/15.17s] Writing lock file
Jens A. Koch
  • 39,862
  • 13
  • 113
  • 141
  • It's a trick but it won't work. You can have a look at @Sven answer – rap-2-h Sep 10 '15 at 06:32
  • It seems you didn't test it :) Let's base this composer.json on facts... i added the install log. Anyway..glad you solved the problem :) – Jens A. Koch Sep 10 '15 at 09:46
  • You're right :), I did not tested. Now I've just tested, same problem, it does not work. Maybe on a fresh project, but using composer update I've got exactly the same error with same text (I've just copy/pasted your code and run composer update). Did you do something else? (or maybe there is something I don't understand) – rap-2-h Sep 10 '15 at 10:03
  • I can't reproduce your issue. I used `composer clearcache` followed by `composer install -vvv --profile` with the composer snippet from above. It resolves and installs all packages. – Jens A. Koch Sep 10 '15 at 10:23
0

Yes. You can try to use aliases. It might be something like this:

"guzzlehttp/guzzle": "~5.3 as 6.0"

Community
  • 1
  • 1
Sergey Chizhik
  • 617
  • 11
  • 22