Dreaded PyCall build error

this has come up several times in the forum. i have experienced it several times, and yet completely unsure why it happens. It definitely only happens on package upgrades (not necessarily julia version upgrades) and it seems to be a windows thing. Now i’ve upgraded julia, deleted the .julia directory thinking it was a stale config problem and I’m still getting this error:

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

│ CondaHTTPError: HTTP 000 CONNECTION FAILED for url https://repo.anaconda.com/pkgs/main/win-64/current_repodata.json

and then messages about checking to make sure it isn’t blocked. I checked, it isn’t blocked, I can pull up that exact link in my browser without any problem.

Any ideas ?

I thought I would update this since it does seem to come up every once in a while.

It fixed itself. Tried the next day and Pkg.build(“PyCall”) worked just fine.

???

As i said, i checked the link explicitly in my browser, and it was accessible, so it’s still quite mysterious how I was getting a connection failed error during the package build process.

Similar (persistent) problem here on Win10, Julia 1.6.0:

julia> Pkg.build("PyCall")
    Building Conda ─→ `C:\Users\jrafa\.julia\scratchspaces\44cfe95a-1eb2-52ea-b672-e2afdf69b78f\6231e40619c15148bcb80aa19d731e629877d762\build.log`
    Building PyCall → `C:\Users\jrafa\.julia\scratchspaces\44cfe95a-1eb2-52ea-b672-e2afdf69b78f\169bb8ea6b1b143c5cf57df6d34d022a7b60c6db\build.log`
ERROR: Error building `PyCall`:
Collecting package metadata (current_repodata.json): ...working... failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/win-64/current_repodata.json>
Elapsed: -

I can’t remember which version of Julia I was using , but I’m pretty sure it was 1.5.x.

It sure looks like this is a PyCall package problem and not a Julia problem.

Can you do what i did, i.e. try to open the link in you browser and see if you can see it ?

I just opened in my browser and it shows up just fine.

Yes, the page access via browser seems to be fine. In another post on this topic, there seems to be a reference to firewall issues that were fixed using the mobile phone network, but this did not work for me.
Thanks.

The error is occurring in Conda.jl while trying to install Anaconda Python, not in PyCall per se. (If you add Conda and run using Conda; Conda.update() you would presumably get the same error.) In particular, the Miniconda installer seems to be having network problems.

Possible workarounds: (1) Try using Miniforge instead of Anaconda by setting ENV["CONDA_JL_USE_MINIFORGE"] = "1" before building. (2) install your own Python, and tell PyCall about it by setting ENV["PYTHON"] to the path of python.exe before building.

3 Likes

Thanks very much !

As I said, for me the problem fixed itself, but I have seen it before so I’m interested in a long term solution.

Especially because when it happened this time it was terrible timing…

I forgot to ask.

On Linux using “your own python” is really easy.

However it’s a little more interesting in Windows.

I have python installed in cygwin. I have a funny feeling if i give that version of python it won’t work, i.e. I’m guessing that it would be better to go get python for windows and point julia to that version.

Does that sound right ?