JuliaPy / Conda.jl

Conda managing Julia binary dependencies
Other
173 stars 57 forks source link

[Waiting for upstream] Revert pinning Miniconda3-4.5.4 (Python 3.6) on Windows #125

Closed tkf closed 4 years ago

tkf commented 5 years ago

This if block I introduced in #124 should be removed once conda can install Python 3.7 packages on Windows properly from Anaconda's default channel:

https://github.com/JuliaPy/Conda.jl/blob/7094e2aad2aac5e21eb6db66ebab91c99bad3498/src/Conda.jl#L131-L137

Also, this line should be changed to Conda.add("python", env):

https://github.com/JuliaPy/Conda.jl/blob/7094e2aad2aac5e21eb6db66ebab91c99bad3498/test/runtests.jl#L17

@tkelman Do you know where is the upstream issue we should watch? Is it https://github.com/conda/conda/issues/7789?

tkelman commented 5 years ago

This isn't an upstream bug any more, it's a behavior change that they're no longer adding to path. Conda.jl needs to activate environments before trying to use things from them.

tkf commented 5 years ago

Is it possible to activate an environment within a process already running? I think PyCall.jl needs to do that (https://github.com/JuliaPy/PyCall.jl/pull/556#issuecomment-421514385). Is there equivalent of activate_this.py (of virtualenv) in conda?

tkf commented 5 years ago

conda doens't have activate_this.py: https://github.com/conda/conda/issues/2411

tkf commented 5 years ago

I think there are two problems:

  1. conda install ... etc. does not work without activation. This would be easy to solve once conda run returns (https://github.com/conda/conda/pull/7320; presumably, we can just do conda run conda install ...). Unfortunately, it seems Windows support was not added by https://github.com/conda/conda/pull/7320.

  2. PyCall.jl can't import Python packages depending on shared libraries. This probably means we have to modify $PATH at PyCall.__init__()...? Does it even work?

I don't have Windows machine to easily explore the solutions for them so probably I shouldn't have started poking around this problem :)

stevengj commented 5 years ago
  1. For running conda, I think it is fine to modify the PATH.

  2. This is only a problem on Windows, right? PyCall configured with Conda.jl (PyCall.conda == true) could call SetDllDirectory or AddDllDirectory on Windows to modify the DLL search path at runtime.

tkf commented 5 years ago

This is only a problem on Windows, right?

Yes, I think so. For *nix, looking at conda shell.posix activate ... output, it only modifies PATH (not LD_LIBRARY_PATH etc.). So using AddDllDirectory in Windows sounds like a good solution.

I just looked at how conda activate command is implemented. I think we just need to add those paths:

            yield prefix.rstrip("\\")
            yield join(prefix, 'Library', 'mingw-w64', 'bin')
            yield join(prefix, 'Library', 'usr', 'bin')
            yield join(prefix, 'Library', 'bin')
            yield join(prefix, 'Scripts')
            yield join(prefix, 'bin')

--- https://github.com/conda/conda/blob/4.6.0b0/conda/activate.py#L399-L404

tkf commented 4 years ago

It looks like #170 fixed this issue. Closing...