# Making PyCall and PythonCall work in the same project environment

**URL:** <https://discourse.julialang.org/t/making-pycall-and-pythoncall-work-in-the-same-project-environment/113733>\
**Category:** New to Julia\
**Created:** [May 2, 2024, 12:20pm UTC](https://discourse.julialang.org/t/making-pycall-and-pythoncall-work-in-the-same-project-environment/113733 "2024-05-02T12:20:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joh11](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joh11/32/23140_2.png) [@Joh11](https://discourse.julialang.org/u/Joh11)\
**Post date:** [May 2, 2024, 12:20pm UTC](https://discourse.julialang.org/t/making-pycall-and-pythoncall-work-in-the-same-project-environment/113733/1 "2024-05-02T12:20:34Z")

</div>

Hi all,

I need to make PyCall and PythonCall work in the same script, because I am using both PyPlot, and AtomsIOPython which depend on PyCall and PythonCall, respectively.

I followed the tips on the PythonCall [page](https://juliapy.github.io/PythonCall.jl/stable/pycall/) to force PyCall to use the same interpreter as PythonCall, that is:

```julia
using PythonCall
ENV["PYTHON"] = PythonCall.python_executable_path()
] build PyCall

```

Now, I am trying to be cleaner in my management of dependencies, so instead of using the default environment, I am using a local one, with:

```julia
] activate .

```

I need to redo the same thing, but in this case, the PythonCall Python interpreter will be located in the my local project directory: `"<local-project>/.CondaPkg/env/bin/python"`.

I am still learning how do environments and packages are working in Julia. But as far as I’ve understood, since the packages are shared across different environments, if I rebuild PyCall with this interpreter, then it will be used everytime, and not just in my local environment.

So my question is:

- is it the case ? Did I understand correctly ?
- what is the idiomatic way of dealing with this ? In some way, I need to “vendor” PyCall locally in my environment, but I do not know how to do it.
- and side question, what would be the good practice to adopt with VCS ? I feel like I would not want to track with git the whole `.CondaPkg` directory because it contains binary files, but also I would like someone to reproduce my setup just by cloning the repo.

Thanks !

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [May 2, 2024, 12:23pm UTC](https://discourse.julialang.org/t/making-pycall-and-pythoncall-work-in-the-same-project-environment/113733/2 "2024-05-02T12:23:46Z")

</div>

> [@Joh11](#):
>
> I need to make PyCall and PythonCall work in the same script, because I am using both PyPlot, and AtomsIOPython which depend on PyCall and PythonCall, respectively.

Just use PythonPlot.jl instead of PyPlot.jl

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [May 2, 2024, 7:48pm UTC](https://discourse.julialang.org/t/making-pycall-and-pythoncall-work-in-the-same-project-environment/113733/3 "2024-05-02T19:48:13Z")

</div>

> [@Joh11](#):
>
> and side question, what would be the good practice to adopt with VCS ? I feel like I would not want to track with git the whole `.CondaPkg` directory because it contains binary files, but also I would like someone to reproduce my setup just by cloning the repo.

Add `.CondaPkg` to `.gitignore`…

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [May 2, 2024, 7:52pm UTC](https://discourse.julialang.org/t/making-pycall-and-pythoncall-work-in-the-same-project-environment/113733/4 "2024-05-02T19:52:44Z")

</div>

> [@Joh11](#):
>
> what is the idiomatic way of dealing with this ? In some way, I need to “vendor” PyCall locally in my environment, but I do not know how to do it.

PyCall uses either the Python version installed on your OS outside of Julia, or a version specific to Julia projects, but shared by all of them.

If these two options are not sufficient for you you must use PythonCall…
