z6c - personal blog about topics

Christian Müller – Letzte Änderung: 03.03.2015 13:26 Uhr

Fix „Reason: image not found“ – Python, OSX, Homebrew

STÉPHANE WIRTEL beschreibt einen schnellen und einfachen Weg, wie man Probleme mit Python im Virtualenv über Homebrew nach einem OS X Update beheben kann.

Fehler wie folgender

python
dyld: Library not loaded: @executable_path/../.Python
Referenced from: /env/myENV/bin/python
Reason: image not found
[1]    1076 trace trap  python

lassen sich dadurch beheben, daß man in den Ordner des Environments wechselt, dort die symbolic links entfernt, anschließend eine neue Virtualenv Installation drüberbügelt, bei der aber die Abhängigkeiten und per pip installierten Pakete bestehen bleiben.

Das ganze läuft dann so ab:

(Die Beispiele sind direkt von Stéphane’s Seite, Pfade zum Environment entsprechend anpassen)

$HOME/.virtualenvs (0) > source ~/.virtualenvs/pelican/bin/activate.sh

$HOME/.virtualenvs (0) > (pelican) pelican
dyld: Library not loaded: @executable_path/../.Python
  Referenced from: $HOME/.virtualenvs/pelican/bin/python
  Reason: image not found
fish: Job 1, 'pelican' terminated by signal SIGTRAP (Trace or breakpoint trap)

$HOME/.virtualenvs (0) > (pelican) deactivate

Dies diente nur der Bestätigung des Problems… Nun heißt es weiter:

In fact, there is a problem with the library, you need to regenerate the links of the Python interpreter. In this case, this is just to remove the existing links and re-execute the virtualenv command.

Eine Übersicht über alle symbolic links (find -type l):

$HOME/.virtualenvs (0) > find pelican/ -type l
pelican/.Python
pelican/bin/python
pelican/bin/python2
pelican/include/python2.7
pelican/lib/python2.7/_abcoll.py
pelican/lib/python2.7/_weakrefset.py
pelican/lib/python2.7/abc.py
pelican/lib/python2.7/codecs.py
pelican/lib/python2.7/config
pelican/lib/python2.7/copy_reg.py
pelican/lib/python2.7/encodings
pelican/lib/python2.7/fnmatch.py
pelican/lib/python2.7/genericpath.py
pelican/lib/python2.7/lib-dynload
pelican/lib/python2.7/linecache.py
pelican/lib/python2.7/locale.py
pelican/lib/python2.7/ntpath.py
pelican/lib/python2.7/os.py
pelican/lib/python2.7/posixpath.py
pelican/lib/python2.7/re.py
pelican/lib/python2.7/sre.py
pelican/lib/python2.7/sre_compile.py
pelican/lib/python2.7/sre_constants.py
pelican/lib/python2.7/sre_parse.py
pelican/lib/python2.7/stat.py
pelican/lib/python2.7/types.py
pelican/lib/python2.7/UserDict.py
pelican/lib/python2.7/warnings.py

Und dann werden sie ersetzt:

$HOME/.virtualenvs (0) > find pelican/ -type l -delete

$HOME/.virtualenvs (0) > virtualenv pelican
Overwriting pelican/lib/python2.7/site.py with new content
Overwriting pelican/lib/python2.7/orig-prefix.txt with new content
New python executable in pelican/bin/python2.7
Also creating executable in pelican/bin/python
Installing setuptools, pip...done.
Overwriting pelican/bin/activate_this.py with new content

Danach das ganze testen und gut is…

$HOME/.virtualenvs (0) > source ~/.virtualenvs/pelican/bin/activate.sh

$HOME/.virtualenvs > (pelican) pelican --version
3.5.dev

Merci, Stéphane!

Kommentare für diesen Artikel noch nicht freigeschaltet.

Bitte eine Email an kommentare@zentonic.org mit Betreff "Kommentare für Post 79"