How to load Python packages in PythonCall? They've already been installed by Conda in REPL

In the Julia REPL, I just ran Conda.add("pandas") and it ran as Anaconda prompt usually ran, concluding with “All requested packages already installed.” However, the following code then gives me an error (in a Jupyter Notebook).

using PythonCall

Python: ModuleNotFoundError: No module named ‘pandas’

On the other hand, pyimport(“math”) works just fine. How do I get PythonCall to recognise installed packages?

@MaxM is using PythonCall, not PyCall.

PythonCall uses a different version of Python than the one installed by Conda.jl, by default. See the PythonCall manual’s “Configuration” section. In particular, it uses CondaPkg.jl, not Conda.jl, by default.

See the configuration manual above on how to make PythonCall use a different Python installation. For example, you should be able to make it use Conda.jl via something like

import Conda
ENV["JULIA_PYTHONCALL_EXE"] = joinpath(Conda.BINDIR, "python3")

using PythonCall

However, if you are using PythonCall I would generally recommend using CondaPkg.jl rather than Conda.jl, as the former is what PythonCall is designed for.