Error building SymPy and PyCall when username has a space

Hi
I’m trying to use SymPy and PyCall,but there is an error of a bad installation to both of them.When I use the the command Pkg.build ,it says that there is an error of precompilation as Miniconda doesn’t support the directories with a space.I’m using my microsoft user,that is Name Surname and that’s the reason why Miniconda doesn’t work.How can i solve it?
julia> Pkg.build(“PyCall”)
Building Conda ─→ C:\Users\Name Surname\.julia\scratchspaces\44cfe95a-1eb2-52ea-b672-e2afdf69b78f\51cab8e982c5b598eea9c8ceaced4b58d9dd37c9\build.log
Building PyCall → C:\Users\Name Surname\.julia\scratchspaces\44cfe95a-1eb2-52ea-b672-e2afdf69b78f\1cb97fa63a3629c6d892af4f76fcc4ad8191837c\build.log
ERROR: Error building PyCall:
┌ Info: Using the Python distribution in the Conda package by default.
└ To use a different Python version, set ENV[“PYTHON”]=“pythoncommand” and re-run Pkg.build(“PyCall”).
ERROR: LoadError: Conda.jl cannot be installed to its default location C:\Usuarios\Name Surname\Miniconda3
as Miniconda does not support the installation to a directory with a space or a
non-ASCII character on Windows. The work-around is to install Miniconda to a
user-writable directory by setting the CONDA_JL_HOME environment variable. For
example on Windows:

ENV[“CONDA_JL_HOME”] = raw"C:\Conda-Julia\3"
using Pkg
Pkg.build(“Conda”)

The Julia session need to be restarted. More information is available at
GitHub - JuliaPy/Conda.jl: Conda managing Julia binary dependencies.

Stacktrace:
[1] error(s::String)
@ Base .\error.jl:35
[2] _install_conda(env::String, force::Bool)
@ Conda C:\Users\Name Surname.julia\packages\Conda\sDjAP\src\Conda.jl:274
[3] _install_conda(env::String)
@ Conda C:\Users\Name Surname.julia\packages\Conda\sDjAP\src\Conda.jl:270
[4] runconda(args::Cmd, env::String)
@ Conda C:\Users\Name Surname.julia\packages\Conda\sDjAP\src\Conda.jl:180
[5] add(pkg::String, env::String; channel::String, satisfied_skip_solve::Bool, args::Cmd)
@ Conda C:\Users\Name Surname.julia\packages\Conda\sDjAP\src\Conda.jl:343
[6] add
@ C:\Users\Name Surname.julia\packages\Conda\sDjAP\src\Conda.jl:326 [inlined]
[7] top-level scope
@ C:\Users\Name Surname.julia\packages\PyCall\KLzIO\deps\build.jl:79
[8] include(fname::String)
@ Base.MainInclude .\client.jl:478
[9] top-level scope
@ none:5
in expression starting at C:\Users\Name Surname.julia\packages\PyCall\KLzIO\deps\build.jl:43
Stacktrace:
[1] pkgerror(msg::String)
@ Pkg.Types C:\Users\Name Surname\AppData\Local\Programs\Julia-1.9.4\share\julia\stdlib\v1.9\Pkg\src\Types.jl:69
[2] (::Pkg.Operations.var"#67#74"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String})()
@ Pkg.Operations C:\Users\Name Surname\AppData\Local\Programs\Julia-1.9.4\share\julia\stdlib\v1.9\Pkg\src\Operations.jl:1158
[3] withenv(::Pkg.Operations.var"#67#74"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String}, ::Pair{String, String}, ::Vararg{Pair{String}})
@ Base .\env.jl:197
[4] (::Pkg.Operations.var"#117#122"{String, Bool, Bool, Bool, Pkg.Operations.var"#67#74"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String}, Pkg.Types.PackageSpec})()
@ Pkg.Operations C:\Users\Name Surname\AppData\Local\Programs\Julia-1.9.4\share\julia\stdlib\v1.9\Pkg\src\Operations.jl:1825
[5] with_temp_env(fn::Pkg.Operations.var"#117#122"{String, Bool, Bool, Bool, Pkg.Operations.var"#67#74"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String}, Pkg.Types.PackageSpec}, temp_env::String)
@ Pkg.Operations C:\Users\Name Surname\AppData\Local\Programs\Julia-1.9.4\share\julia\stdlib\v1.9\Pkg\src\Operations.jl:1706
[6] (::Pkg.Operations.var"#115#120"{Dict{String, Any}, Bool, Bool, Bool, Pkg.Operations.var"#67#74"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String}, Pkg.Types.Context, Pkg.Types.PackageSpec, String, Pkg.Types.Project, String})(tmp::String)
@ Pkg.Operations C:\Users\Name Surname\AppData\Local\Programs\Julia-1.9.4\share\julia\stdlib\v1.9\Pkg\src\Operations.jl:1795
[7] mktempdir(fn::Pkg.Operations.var"#115#120"{Dict{String, Any}, Bool, Bool, Bool, Pkg.Operations.var"#67#74"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String}, Pkg.Types.Context, Pkg.Types.PackageSpec, String, Pkg.Types.Project, String}, parent::String; prefix::String)
@ Base.Filesystem .\file.jl:762
[8] mktempdir(fn::Function, parent::String)
@ Base.Filesystem .\file.jl:758
[9] mktempdir
@ .\file.jl:758 [inlined]
[10] sandbox(fn::Function, ctx::Pkg.Types.Context, target::Pkg.Types.PackageSpec, target_path::String, sandbox_path::String, sandbox_project_override::Pkg.Types.Project; preferences::Dict{String, Any}, force_latest_compatible_version::Bool, allow_earlier_backwards_compatible_versions::Bool, allow_reresolve::Bool)
@ Pkg.Operations C:\Users\Name Surname\AppData\Local\Programs\Julia-1.9.4\share\julia\stdlib\v1.9\Pkg\src\Operations.jl:1753
[11] build_versions(ctx::Pkg.Types.Context, uuids::Set{Base.UUID}; verbose::Bool)
@ Pkg.Operations C:\Users\Name Surname\AppData\Local\Programs\Julia-1.9.4\share\julia\stdlib\v1.9\Pkg\src\Operations.jl:1139
[12] build_versions
@ C:\Users\Name Surname\AppData\Local\Programs\Julia-1.9.4\share\julia\stdlib\v1.9\Pkg\src\Operations.jl:1054 [inlined]
[13] build(ctx::Pkg.Types.Context, uuids::Set{Base.UUID}, verbose::Bool)
@ Pkg.Operations C:\Users\Name Surname\AppData\Local\Programs\Julia-1.9.4\share\julia\stdlib\v1.9\Pkg\src\Operations.jl:996
[14] build(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; verbose::Bool, kwargs::Base.Pairs{Symbol, Base.TTY, Tuple{Symbol}, NamedTuple{(:io,), Tuple{Base.TTY}}})
@ Pkg.API C:\Users\Name Surname\AppData\Local\Programs\Julia-1.9.4\share\julia\stdlib\v1.9\Pkg\src\API.jl:1053
[15] build(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Pkg.API C:\Users\Name Surname\AppData\Local\Programs\Julia-1.9.4\share\julia\stdlib\v1.9\Pkg\src\API.jl:156
[16] build(pkgs::Vector{Pkg.Types.PackageSpec})
@ Pkg.API C:\Users\Name Surname\AppData\Local\Programs\Julia-1.9.4\share\julia\stdlib\v1.9\Pkg\src\API.jl:145
[17] build#85
@ C:\Users\Name Surname\AppData\Local\Programs\Julia-1.9.4\share\julia\stdlib\v1.9\Pkg\src\API.jl:144 [inlined]
[18] build
@ C:\Users\Name Surname\AppData\Local\Programs\Julia-1.9.4\share\julia\stdlib\v1.9\Pkg\src\API.jl:144 [inlined]
[19] build#84
@ C:\Users\Name Surname\AppData\Local\Programs\Julia-1.9.4\share\julia\stdlib\v1.9\Pkg\src\API.jl:143 [inlined]
[20] build(pkg::String)
@ Pkg.API C:\Users\Name Surname\AppData\Local\Programs\Julia-1.9.4\share\julia\stdlib\v1.9\Pkg\src\API.jl:143
[21] top-level scope
@ REPL[5]:1

1 Like

Try to set JULIA_DEPOT_PATH to a directory with a proper name that exists and where you have write permissions. See: Environment Variables · The Julia Language

1 Like

This is a known limitation of Miniconda (installation failled with accent in user name · Issue #199 · JuliaPy/Conda.jl · GitHub) that we can’t do much about.

You can install your own Python distribution into a different directory and tell PyCall about it when you build PyCall via ENV["PYTHON"], or you can continue to use Conda.jl but tell it to install into a different directory by setting ENV["CONDA_JL_HOME"] before building.

3 Likes

I mean, you post contains the answer:

1 Like

Is it better with:

I believe it’s a drop-in replacement. You should in most cases use PythonCall, it’s very similar but not a drop-in replacement. It has a better API. It doesn’t use Conda per se, it uses micromamba, if I recall, a conda clone. You have access to all the same conda packages (and pip I understand too) and it helps install dependencies for you.

You don’t need to know that for that packages depending on it, but it’s good to know, and also for all wrapping or just using Python packages.

At least I’m curious if it handles spaces.

This is supposed to be true with the latest version of SymPy.jl, as they now mostly share the same underlying codebase. Any big discrepancies would be of interest. Though one place where there may be issues would be running SymPyPythonCall within an IJulia session, as in my limited experience PyCall and PythonCall don’t like to be run in the same session.

That should work too, see docs, and there, also preceding comments about not working):

1 Like