Cannot build PyPlot

Hello everyone, i just started programming julia and encountered a problem.
When I added the PyPlot package and tried to build it:

build PyPlot

It gave those error messages:

Error building `PyCall`, showing the last 100 of log:
`$ C:\Users\Administrator\.julia\conda\3\Scripts\conda-script.py install -y numpy`

An unexpected error has occurred. Conda has prepared the above report.

Upload did not complete.
┌ 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").
[ Info: Running `conda install -y numpy` in root environment
ERROR: LoadError: failed process: Process

Stacktrace:
 [1] pipeline_error
   @ .\process.jl:565 [inlined]
 [2] run(::Cmd; wait::Bool)
   @ Base .\process.jl:480
 [3] run
   @ .\process.jl:477 [inlined]
 [4] runconda(args::Cmd, env::String)
   @ Conda C:\Users\Administrator\.julia\packages\Conda\x2UxR\src\Conda.jl:128
 [5] add(pkg::String, env::String; channel::String)
   @ Conda C:\Users\Administrator\.julia\packages\Conda\x2UxR\src\Conda.jl:222
 [6] add (repeats 2 times)
   @ C:\Users\Administrator\.julia\packages\Conda\x2UxR\src\Conda.jl:220 [inlined]
 [7] top-level scope
   @ C:\Users\Administrator\.julia\packages\PyCall\ygXW2\deps\build.jl:79
 [8] include(fname::String)
   @ Base.MainInclude .\client.jl:476
 [9] top-level scope
   @ none:5
in expression starting at C:\Users\Administrator\.julia\packages\PyCall\ygXW2\deps\build.jl:43

I"be glad if anyone could share thoughts with me.

I wanted to help you since you’re a new user, but waited to see if others knew this. I don’t know, but I do know a good workaround.

PyPlot.jl isn’t the best plotting package (only the first for Julia I believe).

Makie.jl is likely the best (pure Julia package and can have instant startup, though you might still need a sysimage for that), and the future. Before that there’s a Plots.jl, that abstracts over different backends, e.g. PyPlot.jl, so even if you what to use PyPlot (aka matplotlib), then consider that one.

Despite the name PyPlot isn’t written in Python [EDIT: I see it’s actually “Python 90.7%, C++ 6.5%, […] C 0.2%” the heavy lifting likely done by C/C++ as with all “Python packages”), it’s only a wrapper for Python’s matplotlib (a clone of MATLAB’s plotting). GR.jl (written in C) is the default backend for Plots.jl and I believe it’s better.

If you really want to use matplotlib (or any other Python package) without abstraction, then consider PythonCall.jl (its docs show use of MatPlotLib and another Python plotting alternative seaborn), rather than PyCall.jl (which PyPlot.jl relies on).

I suppose this is a standard error in Conda, still a bit confusing, why would you (indirectly, i.e. Conda) upload, not something you requested:

Sorry for my late reply, I’ve been working on other subjects these days.
I appreciate your kind help. Just like you recommended, I finally gave up trying to use Pyplot and chose other packages.
Here is the full error log:

Collecting package metadata (current_repodata.json): ...working... failed

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\conda\exceptions.py", line 1079, in __call__
        return func(*args, **kwargs)
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\conda\cli\main.py", line 84, in _main
        exit_code = do_call(args, p)
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\conda\cli\conda_argparse.py", line 83, in do_call
        return getattr(module, func_name)(args, parser)
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\conda\cli\main_install.py", line 20, in execute
        install(args, parser, 'install')
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\conda\cli\install.py", line 261, in install
        unlink_link_transaction = solver.solve_for_transaction(
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\conda\core\solve.py", line 114, in solve_for_transaction
        unlink_precs, link_precs = self.solve_for_diff(update_modifier, deps_modifier,
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\conda\core\solve.py", line 157, in solve_for_diff
        final_precs = self.solve_final_state(update_modifier, deps_modifier, prune, ignore_pinned,
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\conda\core\solve.py", line 262, in solve_final_state
        ssc = self._collect_all_metadata(ssc)
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\conda\common\io.py", line 88, in decorated
        return f(*args, **kwds)
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\conda\core\solve.py", line 425, in _collect_all_metadata
        index, r = self._prepare(prepared_specs)
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\conda\core\solve.py", line 1020, in _prepare
        reduced_index = get_reduced_index(self.prefix, self.channels,
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\conda\core\index.py", line 288, in get_reduced_index
        new_records = SubdirData.query_all(spec, channels=channels, subdirs=subdirs,
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\conda\core\subdir_data.py", line 140, in query_all
        result = tuple(concat(executor.map(subdir_query, channel_urls)))
      File "C:\Users\Administrator\.julia\conda\3\lib\concurrent\futures\_base.py", line 608, in result_iterator
        yield fs.pop().result()
      File "C:\Users\Administrator\.julia\conda\3\lib\concurrent\futures\_base.py", line 445, in result
        return self.__get_result()
      File "C:\Users\Administrator\.julia\conda\3\lib\concurrent\futures\_base.py", line 390, in __get_result
        raise self._exception
      File "C:\Users\Administrator\.julia\conda\3\lib\concurrent\futures\thread.py", line 52, in run
        result = self.fn(*self.args, **self.kwargs)
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\conda\core\subdir_data.py", line 132, in <lambda>
        subdir_query = lambda url: tuple(SubdirData(Channel(url), repodata_fn=repodata_fn).query(
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\conda\core\subdir_data.py", line 145, in query
        self.load()
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\conda\core\subdir_data.py", line 210, in load
        _internal_state = self._load()
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\conda\core\subdir_data.py", line 375, in _load
        raw_repodata_str = fetch_repodata_remote_request(
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\conda\core\subdir_data.py", line 701, in fetch_repodata_remote_request
        resp = session.get(join_url(url, filename), headers=headers, proxies=session.proxies,
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\requests\sessions.py", line 555, in get
        return self.request('GET', url, **kwargs)
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\requests\sessions.py", line 542, in request
        resp = self.send(prep, **send_kwargs)
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\requests\sessions.py", line 655, in send
        r = adapter.send(request, **kwargs)
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\requests\adapters.py", line 439, in send
        resp = conn.urlopen(
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\urllib3\connectionpool.py", line 696, in urlopen
        self._prepare_proxy(conn)
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\urllib3\connectionpool.py", line 964, in _prepare_proxy
        conn.connect()
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\urllib3\connection.py", line 359, in connect
        conn = self._connect_tls_proxy(hostname, conn)
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\urllib3\connection.py", line 500, in _connect_tls_proxy
        return ssl_wrap_socket(
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\urllib3\util\ssl_.py", line 453, in ssl_wrap_socket
        ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
      File "C:\Users\Administrator\.julia\conda\3\lib\site-packages\urllib3\util\ssl_.py", line 495, in _ssl_wrap_socket_impl
        return ssl_context.wrap_socket(sock)
      File "C:\Users\Administrator\.julia\conda\3\lib\ssl.py", line 500, in wrap_socket
        return self.sslsocket_class._create(
      File "C:\Users\Administrator\.julia\conda\3\lib\ssl.py", line 997, in _create
        raise ValueError("check_hostname requires server_hostname")
    ValueError: check_hostname requires server_hostname

`$ C:\Users\Administrator\.julia\conda\3\Scripts\conda-script.py install -y numpy`

  environment variables:
                 CIO_TEST=<not set>
                  CONDARC=C:\Users\Administrator\.julia\conda\3\condarc-julia.yml
             CONDA_PREFIX=C:\Users\Administrator\.julia\conda\3
               CONDA_ROOT=C:\Users\Administrator\.julia\conda\3
           CURL_CA_BUNDLE=<not set>
                 HOMEPATH=\Users\Administrator
          JULIA_LOAD_PATH=@;C:\Users\ADMINI~1\AppData\Local\Temp\jl_w1oUWG
                     PATH=C:\Users\Administrator\.julia\conda\3\Library\bin;d:\cvf\Tools;d:\cvf\
                          Msdev98\BIN;d:\cvf\BIN;C:\windows\system32;C:\windows;C:\windows\Syste
                          m32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System
                          32\OpenSSH\;C:\Program Files (x86)\NVIDIA
                          Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA Nv
                          DLISR;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDO
                          WS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;c:\Pr
                          ogram Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program
                          Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft
                          SQL Server\100\DTS\Binn\;C:\Program
                          Files\MATLAB\R2017a\runtime\win64;C:\Program
                          Files\MATLAB\R2017a\bin;D:\LATEX\texlive\2019\bin\win32;C:\Program
                          Files\MATLAB\R2019b\runtime\win64;C:\Program Files\MATLAB\R2019b\bin;C
                          :\texlive\2019\bin\win32;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\Sys
                          tem32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\Syst
                          em32\OpenSSH\;C:\Program Files (x86)\Wolfram
                          Research\WolframScript\;D:\fortran\mingw64\bin;C:\Program Files\dotnet
                          \;D:\ultraedit;C:\Users\Administrator\anaconda3;C:\Users\Administrator
                          \anaconda3\Library\mingw-w64\bin;C:\Users\Administrator\anaconda3\Libr
                          ary\usr\bin;C:\Users\Administrator\anaconda3\Library\bin;C:\Users\Admi
                          nistrator\anaconda3\Scripts;C:\Users\Administrator\AppData\Local\Micro
                          soft\WindowsApps;E:\code\PyCharm Community Edition
                          2021.2\bin;;D:\fortran\mingw64\bin;;E:\code\PyCharm
                          2021.2\bin;;D:\Julia\Julia-1.8.1\bin
             PSMODULEPATH=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\Windows
                          PowerShell\v1.0\Modules
         PYTHONIOENCODING=UTF-8
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>
    VBOX_MSI_INSTALL_PATH=E:\virtualbox\

     active environment : base
    active env location : C:\Users\Administrator\.julia\conda\3
       user config file : C:\Users\Administrator\.condarc
 populated config files : C:\Users\Administrator\.condarc
          conda version : 4.10.3
    conda-build version : not installed
         python version : 3.9.5.final.0
       virtual packages : __cuda=11.7=0
                          __win=0=0
                          __archspec=1=x86_64
       base environment : C:\Users\Administrator\.julia\conda\3  (writable)
      conda av data dir : C:\Users\Administrator\.julia\conda\3\etc\conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Users\Administrator\.julia\conda\3\pkgs
                          C:\Users\Administrator\.conda\pkgs
                          C:\Users\Administrator\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\Administrator\.julia\conda\3\envs
                          C:\Users\Administrator\.conda\envs
                          C:\Users\Administrator\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.10.3 requests/2.25.1 CPython/3.9.5 Windows/10 Windows/10.0.19044
          administrator : False
             netrc file : None
           offline mode : False


An unexpected error has occurred. Conda has prepared the above report.

Upload did not complete.
┌ 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").
[ Info: Running `conda install -y numpy` in root environment
ERROR: LoadError: failed process: Process(setenv(`'C:\Users\Administrator\.julia\conda\3\Scripts\conda.exe' install -y numpy`,["PATH=C:\\Users\\Administrator\\.julia\\conda\\3\\Library\\bin;d:\\cvf\\Tools;d:\\cvf\\Msdev98\\BIN;d:\\cvf\\BIN;C:\\windows\\system32;C:\\windows;C:\\windows\\System32\\Wbem;C:\\windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\windows\\System32\\OpenSSH\\;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files\\NVIDIA Corporation\\NVIDIA NvDLISR;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;c:\\Program Files (x86)\\Microsoft SQL Server\\100\\Tools\\Binn\\;c:\\Program Files\\Microsoft SQL Server\\100\\Tools\\Binn\\;c:\\Program Files\\Microsoft SQL Server\\100\\DTS\\Binn\\;C:\\Program Files\\MATLAB\\R2017a\\runtime\\win64;C:\\Program Files\\MATLAB\\R2017a\\bin;D:\\LATEX\\texlive\\2019\\bin\\win32;C:\\Program Files\\MATLAB\\R2019b\\runtime\\win64;C:\\Program Files\\MATLAB\\R2019b\\bin;C:\\texlive\\2019\\bin\\win32;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files (x86)\\Wolfram Research\\WolframScript\\;D:\\fortran\\mingw64\\bin;C:\\Program Files\\dotnet\\;D:\\ultraedit;C:\\Users\\Administrator\\anaconda3;C:\\Users\\Administrator\\anaconda3\\Library\\mingw-w64\\bin;C:\\Users\\Administrator\\anaconda3\\Library\\usr\\bin;C:\\Users\\Administrator\\anaconda3\\Library\\bin;C:\\Users\\Administrator\\anaconda3\\Scripts;C:\\Users\\Administrator\\AppData\\Local\\Microsoft\\WindowsApps;E:\\code\\PyCharm Community Edition 2021.2\\bin;;D:\\fortran\\mingw64\\bin;;E:\\code\\PyCharm 2021.2\\bin;;D:\\Julia\\Julia-1.8.1\\bin", "USERDOMAIN_ROAMINGPROFILE=LAPTOP-ERBIAT4N", "CPU=i386", "HOMEPATH=\\Users\\Administrator", "PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC", "SESSIONNAME=Console", "SYSTEMROOT=C:\\WINDOWS", "APPDATA=C:\\Users\\Administrator\\AppData\\Roaming", "PSMODULEPATH=C:\\Program Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules", "AV_APPDATA=C:\\Users\\ADMINI~1\\AppData\\Roaming"  …  "LOGONSERVER=\\\\LAPTOP-ERBIAT4N", "REGIONCODE=APJ", "DRIVERDATA=C:\\Windows\\System32\\Drivers\\DriverData", "CONDA_PREFIX=C:\\Users\\Administrator\\.julia\\conda\\3", "JULIA_LOAD_PATH=@;C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\jl_w1oUWG", "ASL.LOG=Destination=file", "SYSTEMDRIVE=C:", "VNI_F90_MSG=d:\\cvf\\IMSL\\MESSAGE", "PYCHARM COMMUNITY EDITION=E:\\code\\PyCharm Community Edition 2021.2\\bin;", "PROCESSOR_ARCHITECTURE=AMD64"]), ProcessExited(1)) [1]

Stacktrace:
 [1] pipeline_error
   @ .\process.jl:565 [inlined]
 [2] run(::Cmd; wait::Bool)
   @ Base .\process.jl:480
 [3] run
   @ .\process.jl:477 [inlined]
 [4] runconda(args::Cmd, env::String)
   @ Conda C:\Users\Administrator\.julia\packages\Conda\x2UxR\src\Conda.jl:128
 [5] add(pkg::String, env::String; channel::String)
   @ Conda C:\Users\Administrator\.julia\packages\Conda\x2UxR\src\Conda.jl:222
 [6] add (repeats 2 times)
   @ C:\Users\Administrator\.julia\packages\Conda\x2UxR\src\Conda.jl:220 [inlined]
 [7] top-level scope
   @ C:\Users\Administrator\.julia\packages\PyCall\ygXW2\deps\build.jl:79
 [8] include(fname::String)
   @ Base.MainInclude .\client.jl:476
 [9] top-level scope
   @ none:5
in expression starting at C:\Users\Administrator\.julia\packages\PyCall\ygXW2\deps\build.jl:43

In case anyone will still be interested.