3

There's some weirdness with Enthought's Canopy and Julia with the implementation of PyCall (I guess this has to do with Canopy not updating distutils.sysconfig ??).

There is some discussion on this that fixes the problem by pointing PyCall to the correct shared library.

How do I make this permanent (How do I change distutils.sysconfig)?

Some output:

julia> using PyPlot
ERROR: could not load module python: dlopen(python.dylib, 9): image not found
 in pyinitialize at /Users/bdhammel/.julia/PyCall/src/PyCall.jl:422
 in pyimport at /Users/bdhammel/.julia/PyCall/src/PyCall.jl:105
 in include at boot.jl:238
 in include_from_node1 at loading.jl:114
 in reload_path at loading.jl:140
 in _require at loading.jl:58
 in require at loading.jl:43
at /Users/bdhammel/.julia/PyPlot/src/PyPlot.jl:32

julia> using PyCall

julia> pyinitialize("/Users/bdhammel/Library/Enthought/Canopy_64bit/System/lib/libpython2.7.dylib")
/Users/bdhammel/Library/Enthought/Canopy_64bit/System/lib/libpython2.7.dylib: /Users/bdhammel/Library/Enthought/Canopy_64bit/System/lib/libpython2.7.dylib: cannot execute binary file

julia> using PyPlot
Warning: Possible conflict in library symbol dtrtri_
Warning: Possible conflict in library symbol dgetri_
Warning: Possible conflict in library symbol dgetrf_

julia> plot([1,2])
1-element Array{Any,1}:
 PyObject <matplotlib.lines.Line2D object at 0x115b95090>

and it plots the line

I'd like to set this up to work, without having to do the pyinitialize bit.

From the linked discussion:
PyCall runs the python executable and executes:

import distutils.sysconfig
print(distutils.sysconfig.get_config_var('LDLIBRARY'))
print(distutils.sysconfig.get_config_var('PYTHONFRAMEWORKPREFIX'))

Where are these Paths stored, and what should I change?

Output in python for those commands:

In [1]: import distutils

In [2]: print(distutils.sysconfig.get_config_var('LDLIBRARY'))
Python.framework/Versions/2.0.0.dev-f1c6cfc/Python

In [3]: print(distutils.sysconfig.get_config_var('PYTHONFRAMEWORKPREFIX'))
/Library/Frameworks

In [4]: distutils.__file__
Out[4]: '/Applications/Canopy.app/appdata/canopy-1.0.3.1262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/__init__.pyc'

Lastly: Do I need to be worried about the cannot execute binary file or Possible conflict ... parts?

Ben
  • 6,986
  • 6
  • 44
  • 71

1 Answers1

1

See PyCall issue #42, which is the right place for this discussion. Matters have improved somewhat, but there are still some runtime path issues on Windows with Canopy/EPD, and for now I would recommend using Anaconda Python instead.