Pycall paths

So I have a python module that I want to load with pycall, but I’m struggling to get it working. I have anaconda 3 python installed on my system, separately from julia, and that python installation has all the usual things (i.e., numpy,scipy, etc.). However, If I try:

@pyimport scipy.optimize as so

I get the error:

PyError (ccall(@pysym(:PyImport_ImportModule), PyPtr, (Cstring,), name)

The Python package scipy.optimize could not be found by pyimport. Usually this means
that you did not install scipy.optimize 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 scipy.optimize module, you can
use `pyimport_conda("scipy.optimize", PKG)`, where PKG is the Anaconda
package the contains the module scipy.optimize, 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.

) <type 'exceptions.ImportError'>
ImportError('No module named scipy.optimize',)

And once I get that straightened out, I want to load a module which is in my PYTHONPATH when i open a shell, but is not in the standard location.

have you set the python environment variable?
I think this can be done either in Windows or in Julia, but I am not quite sure
Try something like this (in your Julia code)

ENV["PYTHON"]="C:\\JuliaPro-0.5.1.1\\Python\\python.exe"

By default, PyCall on Mac and Windows installs using its own Conda distribution, so it is probably not using your Anaconda Python. (Look at PyCall.python to see what it was configured with.)

To configure PyCall to use your own Python, set ENV["PYTHON"] to the python you want and re-run Pkg.build("PyCall"). This only needs to be done once, and PyCall will remember which python (technically which libpython) you want.