Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CondaPkg removes and recreates environment often when using Windows. #166

Open
RefatIsmail96 opened this issue Feb 20, 2025 · 4 comments · May be fixed by #167
Open

CondaPkg removes and recreates environment often when using Windows. #166

RefatIsmail96 opened this issue Feb 20, 2025 · 4 comments · May be fixed by #167
Assignees
Labels
bug Something isn't working

Comments

@RefatIsmail96
Copy link

This issue occurs because CondaPkg detects a change in the load path. Specifically, it tries to compare Base.load_path and meta.load_path in the function _resolve_can_skip_1(conda_env, load_path, meta_file). The comparison fails because Base.load_path contains an uncapitalized directory (e.g.,"c:\Users...") for the active project, while meta.load_path has a capitalized path (e.g., "C:\Users...").

The problem seems to stem from how Julia initializes the Base.ACTIVE_PROJECT variable. Specifically, the issue arises from the line unsafe_string(Base.JLOptions().project) in the function Base.init_active_project.

While this appears to be more of a Julia-related issue rather than a problem within CondaPkg, I wanted to bring it to the attention of CondaPkg users in case others encounter the same issue.

As a simple workaround, you can manually activate the project with the correct path before calling CondaPkg. For example:
For example: Pkg.activate("C:\Users...")

@cjdoris
Copy link
Collaborator

cjdoris commented Feb 20, 2025

Oh interesting. The thing is that CondaPkg is just calling Base.load_path() so why would the capitalisation be different from one session to the next?

Regardless, this is something we could fix by normalising all the paths before comparing.

@cjdoris cjdoris added the bug Something isn't working label Feb 20, 2025
@cjdoris cjdoris self-assigned this Feb 20, 2025
@cjdoris
Copy link
Collaborator

cjdoris commented Feb 20, 2025

Oh even better we can compare the load paths with samefile: https://docs.julialang.org/en/v1/base/file/#Base.Filesystem.samefile

@cjdoris cjdoris linked a pull request Feb 22, 2025 that will close this issue
@cjdoris
Copy link
Collaborator

cjdoris commented Feb 22, 2025

Could you see if #167 fixes the issue for you? You can install it like pkg> add CondaPkg#compare-load-path.

@jaakkor2
Copy link

pkg> add CondaPkg#compare-load-path fixes the environment re-install whenever using PythonCall on Windows in CondaPkg 0.2.25. Julia launched with julia +lts --startup-file=no --project=debug. CondaPkg 0.2.24 did not have this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants