JuliaPy / CondaPkg.jl

Add Conda dependencies to your Julia project
MIT License
124 stars 15 forks source link

CondaPkg constantly uninstalling, reinstalling all packages #109

Open habemus-papadum opened 1 year ago

habemus-papadum commented 1 year ago

Hi, On windows 11, Julia 1.9.3, CondaPkg v0.2.21, CondaPkg frequently uninstalls all packages and the reinstalls all of them when calling resolve -- this doesn't happen every single time, but maybe around 80% of the time, which is quite difficult. Is there are a way to better understand why resolve is causing this behavior?

Thanks

habemus-papadum commented 1 year ago

The issue seems to be triggered here: https://github.com/JuliaPy/CondaPkg.jl/blob/baa6132e2390faf41692c4f4a9fed445179ed10c/src/resolve.jl#L34

The C drive has different capitalization in the first entry, see below:

meta.load_path
["C:\\Users\\nehal\\src\\julia-fun\\warpsnwefts\\Project.toml", "C:\\Users\\nehal\\.julia\\environments\\v1.9\\Project.toml", "C:\\Users\\nehal\\.julia\\juliaup\\julia-1.9.3+0.x64.w64.mingw32\\share\\julia\\stdlib\\v1.9"]
load_path
["c:\\Users\\nehal\\src\\julia-fun\\warpsnwefts\\Project.toml", "C:\\Users\\nehal\\.julia\\environments\\v1.9\\Project.toml", "C:\\Users\\nehal\\.julia\\juliaup\\julia-1.9.3+0.x64.w64.mingw32\\share\\julia\\stdlib\\v1.9"]
habemus-papadum commented 1 year ago

I haven't gotten to the bottom, but my guess it is something to do with a difference in how vscode and the julia command line specify the project on startup

cjdoris commented 1 year ago

Well isn't that fun! You've got to love case-insensitive filesystems...

This particular issue should be a straightforward fix - just needs a more nuanced load_path comparison than ==.

However, I'm surprised it's actually reinstalling everything - resolve_can_skip_1 just provides a quick check. If the set of packages to install hasn't actually changed, then it should still take a fast route, namely it executes https://github.com/JuliaPy/CondaPkg.jl/blob/baa6132e2390faf41692c4f4a9fed445179ed10c/src/resolve.jl#L510-L532 but each inner if block is a no-op because the set of packages hasn't changed. Is this not the case?

habemus-papadum commented 1 year ago

That makes sense; the packages should have not changed. I will try to revisit this in a few days to isolate futher

RefatIsmail96 commented 1 month ago

Hi, I am facing a similar issue with CondaPkg removing the environment and creating it again, even when the dependencies did not change.

I am using Windows 11 as well and VS code. Same code ran over MAC does not result in the same issue. Were you able to find the problem here?