-
Notifications
You must be signed in to change notification settings - Fork 216
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
Allow custom shared projects for julia_project
#197
Conversation
test/test_env.py
Outdated
Main = julia_helpers.init_julia(julia_project=test_env_name) | ||
Main.eval("using SymbolicRegression") | ||
# TODO: Test that we are actually in the correct env. | ||
# TODO: Delete the env at the end. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if there is any way to do this? I suppose I need to create a temp env instead (but that's a different question).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could pushfirst!
a temp directory into DEPOT_PATH
. Then the shared environment would be created in the temp directory. Then you can pop!
the tempdir off DEPOT_PATH
and recursively delete it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the DEPOT_PATH
changes, and you activate a new environment, will it correctly update? It seems like it is not switching to the new setting for some reason (see error)
Traceback (most recent call last):
File "/Users/mcranmer/Documents/PySR/test/test_env.py", line 24, in test_custom_shared_env
self.assertEqual(cur_project_dir, potential_shared_project_dirs)
AssertionError: '/Users/mcranmer/.julia/environments' != '/var/folders/1h/xyppkvx52cl6w3_h8bw_gdqh0000gr/T/tmp8dknp59s/environments'
i.e., the current project is still in /Users/mcranmer/.julia/environments
rather than the new depot
Merge conda-forge/pysr-feedstock#51 to unpin openlibm then the test here will pass |
Ah, I think I see an issue (at least, for testing this). Right now the Lines 86 to 88 in b6ac303
So I think what we should actually do is call |
Correct. The only reason I used the environment variable earlier was to select the environment where we expect PyCall to be, which may not be the default environment. |
Okay so now the from pysr.julia_helpers import init_julia, install
Main = init_julia()
Main.eval('pushfirst!(DEPOT_PATH, "/tmp/1")')
Main = init_julia("@test2") This correctly goes to the install("@test2") this sets to the normal
Is this something in PyJulia maybe? |
In this case it seems you have not manipulated Note that the |
Thanks - the weird thing is that those commands are from the same Python session. So the DEPOT_PATH should stick around through the |
Is this happening on all versions of Julia or just particular ones, perhaps less than Julia 1.7.0? I'm thinking about the |
Okay I think that got it. It wasn't the subprocess - it was the |
…Cranmer/PySR into custom-julia-project
Cool:
Not sure what the conda errors are though. |
Ah, the conda errors were just because the |
This looks like an improvement to me. I still think we should figure out how to generalize this to non-shared environments at some point. |
This will fix #196. If you specify an
@
in yourjulia_project
string, likejulia_project="@my_project"
, then this will be designated a shared project (just as if you had specified]activate @my_project
in the Julia REPL.cc @mkitti