# Multiple Conda Environments + PyCall.jl?

**URL:** <https://discourse.julialang.org/t/multiple-conda-environments-pycall-jl/61754>\
**Category:** General Usage\
**Tags:** question, pycall, python, pythoncall\
**Created:** [May 25, 2021, 12:12am UTC](https://discourse.julialang.org/t/multiple-conda-environments-pycall-jl/61754 "2021-05-25T00:12:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![LodewijkBrand](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lodewijkbrand/32/21612_2.png) [@LodewijkBrand](https://discourse.julialang.org/u/LodewijkBrand)\
**Post date:** [May 25, 2021, 12:12am UTC](https://discourse.julialang.org/t/multiple-conda-environments-pycall-jl/61754/1 "2021-05-25T00:12:04Z")

</div>

I have been using PyCall.jl to wrap some algorithms written in Python to compare against a series of algorithms I’ve written in Julia.

I’ve started adding additional algorithms one of which is implemented ~4 years ago and is currently only available in Python 2. Instead of porting the code over to Python 3 I am calling methods from this code by using a PyCall environment built against a conda environment using Python 2: [GitHub - JuliaPy/PyCall.jl: Package to call Python functions from the Julia language](https://github.com/JuliaPy/PyCall.jl#specifying-the-python-version). Then, when I want to run other algorithms that are currently written in Python 3 I need to re-`Pkg.build("PyCall")` after pointing to my standard my standard Python 3 conda environment for that code.

I was wondering if there a better/more-robust solution?

---

<div class="post-metadata">

**Author:** ![Bruce\_Jung](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bruce_jung/32/28232_2.png) [@Bruce\_Jung](https://discourse.julialang.org/u/Bruce_Jung)\
**Post date:** [August 16, 2021, 3:25pm UTC](https://discourse.julialang.org/t/multiple-conda-environments-pycall-jl/61754/2 "2021-08-16T15:25:09Z")

</div>

I’m also looking for a way without running Pkg.build(“PyCall”) to dynamically change the python environment during julia’s runtime.  
If I find something, I’ll share it with you.

---

<div class="post-metadata">

**Author:** ![cjdoris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cjdoris/32/213133_2.png) [@cjdoris](https://discourse.julialang.org/u/cjdoris)\
**Post date:** [August 16, 2021, 4:36pm UTC](https://discourse.julialang.org/t/multiple-conda-environments-pycall-jl/61754/3 "2021-08-16T16:36:06Z")

</div>

FYI my package [PythonCall.jl](https://github.com/cjdoris/PythonCall.jl) allows you to use different Python installations without rebuilding but still only one installation per Julia session.

If you need to interface with old Python 2 code you’re probably best off running it in a subprocess.
