Closed tkf closed 4 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.
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
?
conda doens't have activate_this.py
: https://github.com/conda/conda/issues/2411
I think there are two problems:
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.
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 :)
For running conda
, I think it is fine to modify the PATH.
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.
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
It looks like #170 fixed this issue. Closing...
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?