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

refreshEnvironment does not return the latest details of the conda environment #20634

Closed
DonJayamanne opened this issue Feb 2, 2023 · 18 comments
Assignees
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug needs proposal Need to make some design decisions partner ask

Comments

@DonJayamanne
Copy link

DonJayamanne commented Feb 2, 2023

Based on discussions with @brettcannon
Such an API will be provided that allows Jupyter ext to install Python into an empty conda env

Here's what is happening

  • Jupyter installs python into the conda env
  • Jupyter ext uses the resolveEnviornment API to get the latest conda env info
  • Unfortunately the latest conda env info is not yet returned by the Python extension (Python Ext returns the old info which leads one to believe that Python is not installed into the conda env)
@DonJayamanne DonJayamanne added the feature-request Request for new features or functionality label Feb 2, 2023
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Feb 2, 2023
@brettcannon
Copy link
Member

Added to the iteration plan.

@brettcannon brettcannon added needs proposal Need to make some design decisions partner ask area-environments Features relating to handling interpreter environments and removed triage-needed Needs assignment to the proper sub-team labels Feb 3, 2023
@DonJayamanne
Copy link
Author

As part of this API call please can we ensure the Conda environment is updated
I.e. ensure the change event is triggered to update the conda env information, such as updating the Pytohn version, Uri (path to the executable etc)

Today I have a PR that installs Python into the conda environment from within the Jupyter extension (via custom code), however refreshing the Conda env takes more than 1 minute, hence that approach is not the best

i.e. i will need the Python Extension api to

  • Provide a way to install Python into a conda env
  • As well as update the conda env properties after the installation (so that environments contains the right information for this conda env)

@brettcannon
Copy link
Member

ensure the change event is triggered to update the conda env information, such as updating the Pytohn version, Uri (path to the executable etc)

Today I have a PR that installs Python into the conda environment from within the Jupyter extension (via custom code), however refreshing the Conda env takes more than 1 minute, hence that approach is not the best

We can trigger an update immediately after the install, but I don't know if it will necessarily lead to a faster outcome since conda chooses what Python version to install.

@DonJayamanne
Copy link
Author

faster outcome since conda chooses what Python version to install.

sorry, what I meant was the update of the environment information (environment info in api) would be faster if python extension updated the information for that specific conda env immediately
As opposed to Jupyter extension calling the refresh api (which takes more than a minute for me on my Mac)

@brettcannon
Copy link
Member

sorry, what I meant was the update of the environment information (environment info in api) would be faster if python extension updated the information for that specific conda env immediately

Ah, so you're asking to just make sure that a changed event fires with the updated information once conda can provide that info to us instead of you having to to a manual trigger?

@DonJayamanne
Copy link
Author

Yes thats correct, thanks

@brettcannon
Copy link
Member

We were talking about this API in stand-up today, and we were wondering if you are calling conda install ipykernel? If you are then does conda itself not automatically trigger the Python installation as a dependency for ipykernel since conda supports multiple programming languages? If that's the case then would it be better to let conda handle the installation of Python implicitly as part of your installation call so it can make sure that a version of Python that's compatible with ipykernel gets installed?

If conda doesn't trigger an installation of Python then we should file a bug on conda to fix this. And if you're not running any installation command then this idea doesn't work. 😅

@DonJayamanne
Copy link
Author

Will try that out and let you know

@DonJayamanne
Copy link
Author

DonJayamanne commented Feb 9, 2023

@brettcannon Yes that works, there is no need of an API to install Python into a conda env from the Python extension.
However I would would like a quick way to get the conda information updated.

Right now running the refresh api and waiting for the env change event to get fired takes around 60s, and that is way too slow. Thats after installing python into conda.

I can hack this as I know Python is installed, but that's just going around the issue and implementing a hack.
Can we have the Python extension refresh the conda info, if i request the env details for the conda env (either the same API or a new parameter on the same API).

I'm referring to the following

        /**
         * Returns details for the given environment, or `undefined` if the env is invalid.
         * @param environment : Full path to environment folder or python executable for the environment. Can also pass
         * the environment itself.
         */
        resolveEnvironment(
            environment: Environment | EnvironmentPath | string
        ): Promise<ResolvedEnvironment | undefined>;

@brettcannon brettcannon changed the title Provide an API to install Python into an empty conda env Provide an API to forcibly refresh a conda environment Feb 9, 2023
@brettcannon
Copy link
Member

Yes that works, there is no need of an API to install Python into a conda env from the Python extension.

Great!

Can we have the Python extension refresh the conda info, if i request the env details for the conda env (either the same API or a new parameter on the same API).

Seems reasonable. I have updated the title of the issue to reflect what I think your ask is.

@karrtikr karrtikr added this to the February 2023 milestone Feb 13, 2023
@karrtikr karrtikr self-assigned this Feb 13, 2023
@karrtikr
Copy link

karrtikr commented Feb 13, 2023

@DonJayamanne resolveEnvironment should return the latest details for the conda env, is that not the case? If it does return updated details, I suggest you use in to update the env list quickly.

Right now the refresh API does not take additional parameters (like refresh only conda envs) to keep it simple.

@karrtikr karrtikr added triage-needed Needs assignment to the proper sub-team info-needed Issue requires more information from poster labels Feb 13, 2023
@karrtikr karrtikr removed this from the February 2023 milestone Feb 13, 2023
@karrtikr karrtikr removed the needs proposal Need to make some design decisions label Feb 13, 2023
@karrtikr karrtikr removed their assignment Feb 13, 2023
@karthiknadig karthiknadig removed the triage-needed Needs assignment to the proper sub-team label Feb 13, 2023
@karrtikr karrtikr added the triage-needed Needs assignment to the proper sub-team label Feb 13, 2023
@karrtikr
Copy link

resolveEnvironment should return the latest details for the conda env, is that not the case?

Ah, that was when IDs of conda envs after install were different, nevermind.

@karrtikr karrtikr removed the info-needed Issue requires more information from poster label Feb 13, 2023
@karrtikr karrtikr changed the title Provide an API to forcibly refresh a conda environment Provide a private API to forcibly refresh a conda environment Feb 13, 2023
@karrtikr karrtikr added needs proposal Need to make some design decisions and removed triage-needed Needs assignment to the proper sub-team labels Feb 13, 2023
@DonJayamanne
Copy link
Author

DonJayamanne commented Feb 13, 2023

resolveEnvironment should return the latest details for the conda env, is that not the case? If it does return updated details, I suggest you use in to update the env list quickly.

No resolveEnvironment does not return the latest details.

If it does return updated details, I suggest you use in to update the env list quickly.

We have a similar issue where the removed event gets fired and the resolve env returns details of the env. meaning somthing is off with this method.
I would prefer to get this fixed or get a specific api instead of a work around.

Also as mentioned here, a work around doesn't provide the best UX (it is slow) #20634 (comment)

I think we should either close this issue and create a new one to indicate the fact that resolveEnvionrment does not return the latest details, or just update the title of this issue

@DonJayamanne DonJayamanne added bug Issue identified by VS Code Team member as probable bug and removed feature-request Request for new features or functionality labels Feb 13, 2023
@DonJayamanne DonJayamanne changed the title Provide a private API to forcibly refresh a conda environment refreshEnvironment does not return the latest details of the conda environment Feb 13, 2023
@karrtikr
Copy link

karrtikr commented Feb 13, 2023

No resolveEnvironment does not return the latest details.

Yes, I indicated in the follow up comment I guess you missed that. #20634 (comment)

@DonJayamanne
Copy link
Author

DonJayamanne commented Feb 13, 2023

@karrtikr should we just create a new issue? Or just hide the other comments and just leave the first issue comment and the last two comments open.
Else it might get a little confusing going forward, e.g. for someone like Brett or anyone looking at this issue (even you or me)

@brettcannon
Copy link
Member

should we just create a new issue? Or just hide the other comments and just leave the first issue comment and the last two comments open.
Else it might get a little confusing going forward, e.g. for someone like Brett or anyone looking at this issue (even you or me)

Did either of these things happen?

@DonJayamanne
Copy link
Author

DonJayamanne commented Feb 28, 2023

Since @karrtikr didn't reply, I assumed this was fine as is

@karrtikr
Copy link

Thanks for the reminder, created #20765.

@karrtikr karrtikr closed this as not planned Won't fix, can't repro, duplicate, stale Feb 28, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug needs proposal Need to make some design decisions partner ask
Projects
None yet
Development

No branches or pull requests

4 participants