/usr/bin/convert: No such file or directory error - FIXED!

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
CGRemakes

/usr/bin/convert: No such file or directory error - FIXED!

Post by CGRemakes »

I decided I would go ahead and ugrade my ImageMagick today. I did it first on an old backup of our web server to make sure it would do so without problems. No problems, worked flawlessly. So, I decided to do it on my actual web server. However, after installing, I now get an error "-bash: /usr/bin/convert: No such file or directory". What is causing it to try to look in /usr/bin for convert, instead of /usr/local/bin? Yes, copying the file to /usr/bin does "fix" the problem, but why is it behaving differently on a server that is virtually identical? Doing "which convert" returns "/usr/local/bin/convert". I'm a little less experienced with Linux than Windows, so I'm not sure how to change that. Thanks!

EDIT:

Not really super important, but doing a "which -a convert" returns both versions of the file (I did a copy, not a move). However, I would still prefer it looked in /usr/local/bin, not /usr/bin for the file (just for consistency reasons, if nothing else).

Another interesting thing, is it locates "mogrify" just fine, which is also stored in "/usr/local/bin". Strange! Also, "/usr/local/bin" is in my $PATH variable.
Last edited by CGRemakes on 2010-02-19T08:11:42-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -bash: /usr/bin/convert: No such file or directory error

Post by fmw42 »

Perhaps you had multiple versions of IM on your server. You might consider removing all versions of IM and then reinstalling the latest version.

I am not a unix expert, so perhaps one of the IM experts can clarify further.
CGRemakes

Re: -bash: /usr/bin/convert: No such file or directory error

Post by CGRemakes »

fmw42 wrote:Perhaps you had multiple versions of IM on your server. You might consider removing all versions of IM and then reinstalling the latest version.

I am not a unix expert, so perhaps one of the IM experts can clarify further.
Yeah, that was part of the upgrade. I completely uninstalled IM, then reinstalled the new version.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -bash: /usr/bin/convert: No such file or directory error

Post by fmw42 »

Did you install from binary or source? If from source was it manually or with some tool or RPM. Perhaps the tool or RPM put it wrongly in /usr/bin. If you install from binary or manually from source, it should go to the right location, /usr/local/bin.
CGRemakes

Re: -bash: /usr/bin/convert: No such file or directory error

Post by CGRemakes »

fmw42 wrote:Did you install from binary or source? If from source was it manually or with some tool or RPM. Perhaps the tool or RPM put it wrongly in /usr/bin. If you install from binary or manually from source, it should go to the right location, /usr/local/bin.
I did it from the source. I followed these steps (with the exception of the parts that apply to RoR):

https://support.railsmachine.com/index. ... age&id=133

As I mentioned, I did it also on a previous backup of the same server. It was from a few weeks ago, but nothing other than PHP/MySQL files should be different. I haven't changed any configurations.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -bash: /usr/bin/convert: No such file or directory error

Post by fmw42 »

snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: -bash: /usr/bin/convert: No such file or directory error

Post by snibgo »

If I understand you correctly:

1. Executing "$ convert" runs /usr/bin/convert.

2. "which convert" shows /usr/local/bin/convert.

If that's true, something is badly wrong (with your Unix, not Imagemagick).
snibgo's IM pages: im.snibgo.com
CGRemakes

Re: -bash: /usr/bin/convert: No such file or directory error

Post by CGRemakes »

snibgo wrote:If I understand you correctly:

1. Executing "$ convert" runs /usr/bin/convert.

2. "which convert" shows /usr/local/bin/convert.

If that's true, something is badly wrong (with your Unix, not Imagemagick).
It lists both /usr/local/bin/convert, as well as /usr/local/convert using the -a switch for which. Both files do legitimately exist. Why it defaults to look in /usr/bin, and ignores /usr/local/bin when running convert, I don't know. What is it that tells Unix/Linux to look here (other than the PATH). Both are in the path, so I'm not sure what's up.

EDIT:

Nevermind, after rebooting, it's a happy camper. Should have tried it earlier, but oh well. :D
ghindows
Posts: 1
Joined: 2014-10-30T01:48:49-07:00
Authentication code: 6789

Re: /usr/bin/convert: No such file or directory error - FIXE

Post by ghindows »

In shell scripts, when using full path for convert /usr/local/bin/convert replace with `which -a convert | head -n1` this get first location for this.
For example :

Code: Select all

/usr/local/bin/convert $filename  -resize 340x255 -background black  -gravity center -extent 340x255  -format jpg -quality 85 $filename2
replace with :

Code: Select all

`which -a convert | head -n1` $filename  -resize 340x255 -background black  -gravity center -extent 340x255  -format jpg -quality 85 $filename2
Post Reply