I want to use Python's emcee in Julia, so after a little research I found PyCall, then according to their documentation I had to use
using PyCall
@pyimport emcee
But I got this error
ERROR: PyError (ccall(@pysym(:PyImport_ImportModule), PyPtr, (Cstring,), name)
The Python package emcee could not be found by pyimport. Usually this means
that you did not install emcee in the Python version being used by PyCall.
PyCall is currently configured to use the Julia-specific Python distribution
installed by the Conda.jl package. To install the emcee module, you can
use pyimport_conda("emcee", PKG), where PKG is the Anaconda
package the contains the module emcee, or alternatively you can use the
Conda package directly (via using Conda followed by Conda.add etcetera).
Alternatively, if you want to use a different Python distribution on your system, such as a system-wide Python (as opposed to the Julia-specific Python), you can re-configure PyCall with that Python. As explained in the PyCall documentation, set ENV["PYTHON"] to the path/name of the python executable you want to use, run Pkg.build("PyCall"), and re-launch Julia.
) ImportError('No module named emcee',)
So I found the directory where emcee is installed (/Users/Angel/anaconda/lib/python2.7) and I ran the command:
pyimport_conda("emcee","/Users/Angel/anaconda/lib/python2.7")
But I still get errors, this time
PackageNotFoundError: Packages missing in current channels:
- /users/angel/anaconda/lib/python2.7
We have searched for the packages in the following channels:
- https://repo.continuum.io/pkgs/main/osx-64
- https://repo.continuum.io/pkgs/main/noarch
- https://repo.continuum.io/pkgs/free/osx-64
- https://repo.continuum.io/pkgs/free/noarch
- https://repo.continuum.io/pkgs/r/osx-64
- https://repo.continuum.io/pkgs/r/noarch
- https://repo.continuum.io/pkgs/pro/osx-64
- https://repo.continuum.io/pkgs/pro/noarch
- https://conda.anaconda.org/anaconda-fusion/osx-64
- https://conda.anaconda.org/anaconda-fusion/noarch
So, what I'm doing wrong?
"/Users/Angel/anaconda/lib/python2.7"is not package name. You could trypyimport_conda("emcee","emcee", "astropy")- maybe it'll install emcee. If it doesn't help then you could try other way:ENV["PYTHON"] = "/Users/Angel/anaconda/lib/python2.7"; Pkg.build("PyCall")(and restart Julia). - Liso