PyCall.jl icon indicating copy to clipboard operation
PyCall.jl copied to clipboard

check whether numpy is installed before running Conda.add during build

Open alhirzel opened this issue 4 years ago • 5 comments

Currently, there is a call to Conda.add("numpy"):

https://github.com/JuliaPy/PyCall.jl/blob/3c66d9ea6d6c2166e11dece15b12335c24648e59/deps/build.jl#L78-L80

This call should be redundant per README:

https://github.com/JuliaPy/PyCall.jl/blob/3c66d9ea6d6c2166e11dece15b12335c24648e59/README.md#L253

I suggest this call be removed, eliminating the need to access the internet when using PyCall.jl. This is an important use case in some environments.

This has also come up in #742.

alhirzel avatar Oct 29 '21 19:10 alhirzel

It doesn't require the internet. You can build PyCall to use a local, pre-installed Python distribution by setting the PYTHON environment variable.

Moreover, this is about building — i.e. installing — PyCall. (It's possible to install Julia packages without Internet access, but quite annoying.) Even if it was built with the Conda Python, PyCall doesn't require Internet access to use it.

stevengj avatar Oct 29 '21 19:10 stevengj

Hey @stevengj, you're right--I shouldn't have said "to use" PyCall, I should have said to build it. Subsequent ]builds of PyCall will still hit the Conda.add. I think it may be better to check if numpy is installed rather than unconditionally installing it. This enables one to generate a deployment environment that can ]build in-place.

alhirzel avatar Oct 29 '21 20:10 alhirzel

I see. Yes, it seems straightforward to check whether conda list includes numpy before adding.

stevengj avatar Oct 29 '21 22:10 stevengj

Yes, i had fixed in the following way: have a try to do as @stevengj suggested, install numpy, then have a collision with package mkl at path ../.julia/3/pkgs/mkl*******, deleted that directory and retry download, then after had successfully downloaded numpy, built PyCall with using Pkg;Pkg.build("PyCall"))

Maximka-hue avatar Mar 03 '23 17:03 Maximka-hue

I encountered the problem of PyCall building error and track this post. Although I am not sure how it works behind the surface, I am also sharing my experiences here.

  • I encounter the problem after the installation of Conda.jl. The error message was that there was no file found at path ./.julia/3/pkgs/mkl*******.

  • And I opened the anaconda navagator and found there was an environment named "x86_64".

  • I somehow remember it was created by the Julia program, so installed the matplotlib and the numpy packages into this environment using anaconda navagator GUI.

  • After the previous installation, I am able to build PyPlot and PyCall in the Julia REPL.

amnesia42 avatar Aug 14 '23 13:08 amnesia42