# Build PyCall with error in installing miniconda

**URL:** <https://discourse.julialang.org/t/build-pycall-with-error-in-installing-miniconda/118790>\
**Category:** General Usage\
**Tags:** question, package\
**Created:** [August 30, 2024, 2:39am UTC](https://discourse.julialang.org/t/build-pycall-with-error-in-installing-miniconda/118790 "2024-08-30T02:39:41Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![lvyuemeng](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lvyuemeng/32/211685_2.png) [@lvyuemeng](https://discourse.julialang.org/u/lvyuemeng)\
**Post date:** [August 30, 2024, 2:39am UTC](https://discourse.julialang.org/t/build-pycall-with-error-in-installing-miniconda/118790/1 "2024-08-30T02:39:41Z")

</div>

When I built PyCall, I found that miniforge can’t be installed on the path with non-ascii chararcters which is my username. So I manually installed the miniforge and set the env. But in this case, julia can’t manage python and I have to install packages manually.  
Is there any way to avoid this?

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [August 30, 2024, 6:33am UTC](https://discourse.julialang.org/t/build-pycall-with-error-in-installing-miniconda/118790/2 "2024-08-30T06:33:40Z")

</div>

Not a solution to your exact problem but have you tried PythonCall.jl instead? It’s a more modern take on PyCall.jl which sometimes simplifies installation

---

<div class="post-metadata">

**Author:** ![lvyuemeng](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lvyuemeng/32/211685_2.png) [@lvyuemeng](https://discourse.julialang.org/u/lvyuemeng)\
**Post date:** [August 30, 2024, 12:18pm UTC](https://discourse.julialang.org/t/build-pycall-with-error-in-installing-miniconda/118790/3 "2024-08-30T12:18:22Z")

</div>

when I used CondaPkg to install packages, it showed the `critical libmamba` and failed to extract and open.

here the part of error report:

```julia
critical libmamba Failed to open 'C:\Users\%username%\.julia\scratchspaces\0b3b1443-0f03-428d-bdfb-f27f9c1191ea\root\pkgs\vc14_runtime-14.40.338'

```

---

<div class="post-metadata">

**Author:** ![lvyuemeng](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lvyuemeng/32/211685_2.png) [@lvyuemeng](https://discourse.julialang.org/u/lvyuemeng)\
**Post date:** [August 31, 2024, 1:31pm UTC](https://discourse.julialang.org/t/build-pycall-with-error-in-installing-miniconda/118790/4 "2024-08-31T13:31:05Z")

</div>

I thought the problem maybe same as before. non-ascii username may result this.

---

<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:** [August 31, 2024, 1:47pm UTC](https://discourse.julialang.org/t/build-pycall-with-error-in-installing-miniconda/118790/5 "2024-08-31T13:47:13Z")

</div>

> [@lvyuemeng](#):
>
> I found that miniforge can’t be installed on the path with non-ascii chararcters which is my username.

Don’t use a username with non-ascii characters. Alternatively, it might help to set the variable JULIA\_DEPOT\_PATH to a path without non-ascii characters.

```julia
export JULIA_DEPOT_PATH=/juliadepot

```

This obviously works only if you have the permissions to create a directory outside of your home directory in the first place.

---

<div class="post-metadata">

**Author:** ![lvyuemeng](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lvyuemeng/32/211685_2.png) [@lvyuemeng](https://discourse.julialang.org/u/lvyuemeng)\
**Post date:** [August 31, 2024, 2:44pm UTC](https://discourse.julialang.org/t/build-pycall-with-error-in-installing-miniconda/118790/6 "2024-08-31T14:44:42Z")

</div>

In windows, there doesn’t seem to be a clean way to change username. If it has, please tell me! So right now I can only choose the latter one.

---

<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:** [August 31, 2024, 3:28pm UTC](https://discourse.julialang.org/t/build-pycall-with-error-in-installing-miniconda/118790/7 "2024-08-31T15:28:58Z")

</div>

> [@lvyuemeng](#):
>
> In windows, there doesn’t seem to be a clean way to change username.

Not exactly true. How it can be done is explained here:

> **[How To Change User Name Windows 10](https://techcommunity.microsoft.com/t5/windows-10/how-to-change-user-name-windows-10/m-p/3630358)**
>
> If you're using Windows 10, you may want to change your user name for various reasons. Maybe your name has changed, or you want to personalize your..

---

<div class="post-metadata">

**Author:** ![lvyuemeng](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lvyuemeng/32/211685_2.png) [@lvyuemeng](https://discourse.julialang.org/u/lvyuemeng)\
**Post date:** [August 31, 2024, 3:36pm UTC](https://discourse.julialang.org/t/build-pycall-with-error-in-installing-miniconda/118790/8 "2024-08-31T15:36:29Z")

</div>

It just change the info about user(binding to microsoft), but it can’t change the username path etc.

---

<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:** [August 31, 2024, 3:44pm UTC](https://discourse.julialang.org/t/build-pycall-with-error-in-installing-miniconda/118790/9 "2024-08-31T15:44:36Z")

</div>

> **[How to Change the User Profile Folder Name in Windows 11](https://www.makeuseof.com/windows-11-change-user-profile-folder-name/)**
>
> If you're stuck with a crummy user profile folder name on Windows 11, there are ways to change it to your liking.

Are you using Windows 10 or Windows 11?

---

<div class="post-metadata">

**Author:** ![lvyuemeng](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lvyuemeng/32/211685_2.png) [@lvyuemeng](https://discourse.julialang.org/u/lvyuemeng)\
**Post date:** [September 1, 2024, 2:42am UTC](https://discourse.julialang.org/t/build-pycall-with-error-in-installing-miniconda/118790/10 "2024-09-01T02:42:01Z")

</div>

Windows11.

I followed the steps, it does work but flawed. I took a while to restore things like onedrive. There’s still other things aren’t mentioned, for example terminal fonts missing and some path problem.(I previously installed fonts for terminal and after that it’s missing)

---

<div class="post-metadata">

**Author:** ![lvyuemeng](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lvyuemeng/32/211685_2.png) [@lvyuemeng](https://discourse.julialang.org/u/lvyuemeng)\
**Post date:** [September 1, 2024, 5:02am UTC](https://discourse.julialang.org/t/build-pycall-with-error-in-installing-miniconda/118790/11 "2024-09-01T05:02:15Z")

</div>

I install PythonCall now, and it works fine.

If I had to choose, which one is better? (based on [gaddle](https://discourse.julialang.org/t/build-pycall-with-error-in-installing-miniconda/118790/2), PythonCall is better), but it doesn’t have any interface which means all methods should be memorized.

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [September 2, 2024, 2:16pm UTC](https://discourse.julialang.org/t/build-pycall-with-error-in-installing-miniconda/118790/12 "2024-09-02T14:16:13Z")

</div>

You mean you confirm PythonCall works with non-ASCII username?

Then it’s better, in almost every way including that. And ideally all software, including PyCall, shouldn’t be restricted to ASCII [username]. PyCall has (still) faster startup, the only advantage I recall over PythonCall’s:

```julia
julia> @time using PythonCall
  1.243336 seconds (381.06 k allocations: 28.079 MiB, 7.42% gc time, 55.30% compilation time)

```

Note, that’s in 1.10.5 and since it’s a one-time cost, I wouldn’t worry too much, and the time will hopefully come down in future versions of PythonCall, or future Julia’s but actually, in 1.11.0-rc3 (can other confirm slowdown, or might be be related to something other than version change?):

```julia
julia> @time using PythonCall
  5.406764 seconds (3.24 M allocations: 176.386 MiB, 7.58% gc time, 80.11% compilation time: 18% of which was recompilation)

```

While it can be mitigated with changing (to lower) optimization:

```julia
$ julia +1.11 -O0

julia> @time using PythonCall
  3.512657 seconds (3.24 M allocations: 176.386 MiB, 9.10% gc time, 69.22% compilation time: 19% of which was recompilation)

```

or even (you likely do not want to…):

```julia
$ julia +1.11 --compile=min

julia> @time using PythonCall
  1.527100 seconds (881.98 k allocations: 51.569 MiB, 9.37% gc time, 13.26% compilation time)

```

note in 1.10.5:

```julia
$ julia --compile=min
julia> @time using PythonCall
  0.809859 seconds (230.96 k allocations: 17.532 MiB, 13.11% compilation time)

```

---

<div class="post-metadata">

**Author:** ![lvyuemeng](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lvyuemeng/32/211685_2.png) [@lvyuemeng](https://discourse.julialang.org/u/lvyuemeng)\
**Post date:** [September 2, 2024, 2:22pm UTC](https://discourse.julialang.org/t/build-pycall-with-error-in-installing-miniconda/118790/13 "2024-09-02T14:22:44Z")

</div>

Sadly, I still change the username folder name to manage this(when I install miniforge3, it warns me that I can’t install with non-ascii path due to the incompatibility of certain packages, that’s the reason I post the question).

Thanks for providing info about time cost evaluation of PythonCall!

---

<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:** [September 2, 2024, 3:19pm UTC](https://discourse.julialang.org/t/build-pycall-with-error-in-installing-miniconda/118790/14 "2024-09-02T15:19:31Z")

</div>

Well, PyCall has a number of advantages for me:

- it uses one Python installation for all Julia projects, instead of one per project. That saves a lot of installation time (OK it can also cause problems if you have a mix of projects that need different Python versions.)
- it does automatic type conversions, which makes it easier to use (but it might be slower in some cases)
- some packages like [GitHub - JuliaControl/SymbolicControlSystems.jl: C-code generation and an interface between ControlSystems.jl and SymPy.jl](https://github.com/JuliaControl/SymbolicControlSystems.jl) rely on PyCall and do not work with PythonCall

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [September 2, 2024, 5:28pm UTC](https://discourse.julialang.org/t/build-pycall-with-error-in-installing-miniconda/118790/15 "2024-09-02T17:28:37Z")

</div>

> [@lvyuemeng](#):
>
> When I built PyCall

Are you building it to use it directly from your code, i.e. to call some Python [library] code, or for using an existing python-wrapping package? I.e. are “forced” to use PyCall, with no alternative package?

> [@ufechner7](#):
>
> some packages like [GitHub - JuliaControl/SymbolicControlSystems.jl: C-code generation and an interface between ControlSystems.jl and SymPy.jl](https://github.com/JuliaControl/SymbolicControlSystems.jl) rely on PyCall and do not work with PythonCall

Correct, though SymPy.jl, and more are sort of an exception. There’s also SymPyPythonCall.jl to do the same (and they share common code in a Core package). PythonPlot is another corresponding to PyPlot.

[That said, yes, JuliaControl/SymbolicControlSystems.jl depends on SymPy, not SymPyPythonCall, but likely could, maybe such a package already exists, or if not it should just switch?]

Even if you have a package using PyCall, you likely should be using PythonCall for your own code, or for other package dependencies [you’re making], since different dependencies can use either. See docs about using both together.

Yes, PyCall.jl has 257 direct (plus indirect) dependent python wrapping packages, currently according to juliahub, more than PythonCall.jl’s 69. But that is only because the latter is newer.

[Some packages are utilities, such as PyCallChainRules.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:** [September 2, 2024, 7:19pm UTC](https://discourse.julialang.org/t/build-pycall-with-error-in-installing-miniconda/118790/16 "2024-09-02T19:19:43Z")

</div>

> [@Palli](#):
>
> but likely could, maybe such a package already exists, or if not it should just switch?

I tried to rewrite it for using PythonCall and failed. Which does not mean it is not possible, it just means it is more than a few days of work.

---

<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:** [September 2, 2024, 7:24pm UTC](https://discourse.julialang.org/t/build-pycall-with-error-in-installing-miniconda/118790/17 "2024-09-02T19:24:56Z")

</div>

> [@Palli](#):
>
> Even if you have a package using PyCall, you likely should be using PythonCall for your own code, or for other package dependencies [you’re making], since different dependencies can use either. See docs about using both together.

Using Python in the context of a Julia package is a pain. Using both PyCall and PythonCall is twice the pain. I would advice against it.

Just as an example the section of a bash script that I use to install Python and Matplotlib if required:

```julia
PYTHON_PATH=$(which python3)
if [-x "$PYTHON_PATH"]; then
    echo "Python is found at $PYTHON_PATH"
    if $PYTHON_PATH -c "import matplotlib" &> /dev/null; then
        echo "Matplotlib found. Using existing installation."
        export PYTHON=$PYTHON_PATH
    else
        echo "Matplotlib is not found."
        read -p "Do you want to install matplotlib with Conda? (y/n): " choice
        case "$choice" in 
          y|Y ) 
            export PYTHON=""
            ;;
          n|N ) 
            echo "Exiting without installing matplotlib."
            exit 1
            ;;
          * ) 
            echo "Invalid choice. Exiting."
            exit 1
            ;;
        esac
    fi
else
    echo "Python is not found."
    exit 1
fi

julia --startup-file=no -e "using Pkg; Pkg.add(\"TestEnv\")"

if [[$update == true]]; then
    echo "Updating packages..."
    if test -f "Manifest.toml"; then
        mv Manifest.toml Manifest.toml.bak
    fi
    julia --startup-file=no --pkgimages=no --project -e "using TestEnv; TestEnv.activate(); using Pkg; Pkg.add(\"PyCall\"); Pkg.build(\"PyCall\")"
    if [[$PYTHON == ""]]; then
        julia --startup-file=no --pkgimages=no --project -e "using TestEnv; TestEnv.activate(); using Pkg; Pkg.add(\"Conda\"); using Conda; Conda.add(\"matplotlib\"); using ControlPlots"
    fi
    julia --startup-file=no --pkgimages=no --project -e "using Pkg; Pkg.update()"
fi

```

By the way, this code works very well. No more complaints that installing PyPlot (well, I use ControlPlots, but that currently relies on PyPlot) fails since I have this script.

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [September 3, 2024, 1:20pm UTC](https://discourse.julialang.org/t/build-pycall-with-error-in-installing-miniconda/118790/18 "2024-09-03T13:20:47Z")

</div>

FYI: PythonCall isn’t ~~likely inherently slower~~ on 1.11, only its dependency [16x slowdown for CondaPkg v0.2.23 on 1.11.0-rc3, and therefore JuliaCall much slower to start · Issue #145 · JuliaPy/CondaPkg.jl · GitHub](https://github.com/JuliaPy/CondaPkg.jl/issues/145)

and it’s in part because Pkg is no longer in the sysimage, so possibly worth it to lazily load it.

EDIT: These are slower:

```julia
               ┌ 1839.1 ms PythonCall.C. __init__ () 90.91% compilation time # why this slow, though not much slower?
               ├ 0.0 ms PythonCall.GC. __init__ () 
               ├ 771.2 ms PythonCall.Core. __init__ () 96.96% compilation time (85% recompilation) # why this 23x slower?

```

Can someone help with the “recompilation” (that only happens on 1.11)? \>The above “90.91% compilation time” is slightly worse on 1.11, but happens on both it and 1.10. This is mentioned in the above issue (in wrong repository).

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [September 3, 2024, 5:14pm UTC](https://discourse.julialang.org/t/build-pycall-with-error-in-installing-miniconda/118790/19 "2024-09-03T17:14:36Z")

</div>

> [@ufechner7](#):
>
> Using Python in the context of a Julia package is a pain. Using both PyCall and PythonCall is twice the pain. I would advice against it.

Are you sure? You had to take care of Python dependencies yourself with PyCall, but you can let PythonCall, actually CondaPkg, install them (including python itself), e.g. matplotlib for you.

It seems you need no bash script, only before for PyCall.

> [@ufechner7](#):
>
> No more complaints that installing PyPlot (well, I use ControlPlots, but that currently relies on PyPlot)

I would use PythonCall, PyPlot’s replacement, but yes, ControlPlots relies on it.

EDIT EDIT: ~~ControlPlot~~ relies on Plots.jl, GR by default (here I mixed up with the other Control package, that does have plotting…, and the rest is true), so I suppose it could use PythonPlot already, even though docs do not mention it yet: [ControlSystems.jl/docs/src/man/introduction.md at efac62fe6c1e917e10b1acda7e288e847b1d4c5a · JuliaControl/ControlSystems.jl · GitHub](https://github.com/JuliaControl/ControlSystems.jl/blob/efac62fe6c1e917e10b1acda7e288e847b1d4c5a/docs/src/man/introduction.md?plain=1#L68)

Should PyPlot (and/or Plots) be changed to rather rely on PythonCall, so that dependents like ControlPlots just work? Alternatively ControlPlots could change to use PythonPlot.

[Using PythonCall, and PyCall is supported, explained in docs of former package. And I mentioned in an open PyCall issue yesterday, on them not working together, and then it was closed, so I assume I’m not wrong about them actually working together. Did you rely on old info?]

Can someone help with “recompilation”? I edited, added to my above post.

---

<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:** [September 3, 2024, 7:03pm UTC](https://discourse.julialang.org/t/build-pycall-with-error-in-installing-miniconda/118790/20 "2024-09-03T19:03:04Z")

</div>

> [@Palli](#):
>
> It seems you need no bash scrip

Well, I need a bash script to create the system image anyways. And it is quite sophisticated: [create\_sys\_image](https://github.com/ufechner7/KiteModels.jl/blob/main/bin/create_sys_image).

And I was unhappy with my experience when using PythonPlot: It was updating the Python dependencies every time I run my scripts, which is perhaps 10 or 20 times per day. Now this happens only if I compile a new system image, which happens perhaps once per week.

[Next page](https://discourse.julialang.org/t/build-pycall-with-error-in-installing-miniconda/118790.md?page=2)
