Best way to configure a project-dependent PyCall dependency?

First of all, sorry if this too much of a basic question, but I coudn’t find an answer despite multiple searches.

I’m trying to develop a glue package that exposes some Python functionalities to Julia. Simple stuff.

I assume there is a pre-existing conda environment and I’d like to add PyCall as a dependency for this project and point it to this environment.

Is there a simple way to do this without changing the behaviour of PyCall globally? So far, building PyCall by playing with environment variables will modify PyCall for all my projects.

Otherwise, are there alternative solutions to this problem?

I think PythonCall.jl might be a solution to your problem, because its handling of environments is more local (but I’m not 100% certain). These days it is often presented as a more mature alternative to PyCall.jl anyway, so worth looking into.

3 Likes

+1 for PythonCall.

The best option IMO is to use it with CondaPkg.jl for dependencies (see Guide · PythonCall & JuliaCall for details). This way is more useful if you need CI, deploys, etc.

Please don’t hesitate to ask here if you found issues.

3 Likes