flathub / com.vscodium.codium

https://flathub.org/apps/details/com.vscodium.codium
95 stars 21 forks source link

Python environments issue #373

Open Altonss opened 5 days ago

Altonss commented 5 days ago

I have an issue with my Python path: the only thing I see is : image

No local conda environment is showing up at all. If I want to create a conda environement from within vscodium I get this error : Install `conda` to create conda environments. conda is installed on my system!

Originally posted by @Altonss in https://github.com/flathub/com.vscodium.codium/issues/26#issuecomment-2423742386

noonsleeper commented 4 days ago

Hi @Altonss, how conda works? This works similar to pyenv?

I have the default permission for com.vscodium.codium and this on my zshrc and bashrc files

### Load pyenv automatically
PYENV_ROOT="${HOME}/.pyenv"
export PYENV_ROOT
command -v pyenv >/dev/null || export PATH="${PYENV_ROOT}/bin:${PATH}"
eval "$(pyenv init -)"

### Load pyenv-virtualenv automatically
eval "$(pyenv virtualenv-init -)"

This allows me to work with my virtualenvs on flatpak's vscodium, is there something like that for conda? Are the conda binaries and environments on your home directory?

Altonss commented 4 days ago

I don't know about pyenv, but when creating a conda environment (with conda create -n testenv), it is located here:

environment location: /home/user/.conda/envs/testenv .

This works all fine in the terminal (with my system bash). But VSCodium has a special integration of those environments at several locations, and with conda none seem to work:

This is maybe more an issue with conda (as Venv seems to work).

Altonss commented 4 days ago

This issue on the VSCode flatpak seems similar: https://github.com/flathub/com.visualstudio.code/issues/396

noonsleeper commented 4 days ago

Well for me looks more it's that vscodium is not able to found where is located the conda binary, maybe because it is system-wide see. Flatpak, even if the permissions say that has access to the host filesystem, it is still on a sandbox that does not allow accessing the common binary path of the system.

Can you run command -v conda? If this is the case, installing conda binary on your home like pyenv does will workaround your problem

Altonss commented 4 days ago

command -v conda

This just returns conda.

Altonss commented 3 days ago

Installing conda inside of the flatpak by default might actually be a good solution, for an out of the box solution for VSCodium to work well. Something like this should be easy to implement: https://github.com/flathub/com.jetbrains.PyCharm-Community/pull/326

daiyam commented 3 days ago

I disagree to have conda builtin in VSCodium.

You should use a flatpak extension or override --env=VARIABLE_NAME=VARIABLE_VALUE to pass the env variables needed for conda.

Altonss commented 3 days ago

I disagree to have conda builtin in VSCodium.

You should use a flatpak extension or override --env=VARIABLE_NAME=VARIABLE_VALUE to pass the env variables needed for conda.

What would be the reason for not wanting a builtin conda installation? AFAIK the same is currently done with python executable, being builtin in VSCodium...

daiyam commented 3 days ago

VSCodium is a general purpose IDE, so we can't cater it to a specific language. If we integrate conda then we will have to do the same for dependencies of other languages.

Flatpak is sandboxed so you need to provide to the app the necessary access to your system conda (with extensions or env overrides).

noonsleeper commented 3 days ago

AFAIK the same is currently done with python executable, being builtin in VSCodium...

Python is built-in in org.freedesktop.Sdk (the base container used to build com.vscodium.codium) like any other tools like git, I do not integrate directly, also I share the @daiyam's vision here, is a general purpose IDE.

Said that, I think if you create an extension on namespace com.visualstudio.code.tool like https://github.com/flathub/com.visualstudio.code.tool.podman will be more beneficial for all since can be use not only for codium, but code and code-oss, all the logic to load that extensions is already in place on the vscodium manifest https://github.com/flathub/com.vscodium.codium/blob/27d1b63964845a7c772e987dba9fc74d7c593ca8/com.vscodium.codium.yaml#L28-L34

Altonss commented 3 days ago

Python is built-in in org.freedesktop.Sdk (the base container used to build com.vscodium.codium) like any other tools like git, I do not integrate directly, also I share the @daiyam's vision here, is a general purpose IDE.

I agree, but whatever the technical justification, the fact is that the user experience for a developer is broken by default (at least for very common python projects).

If the only acceptable solution to this, is an extension, how would be the user experience? Is it a simple install from flathub and it works?

How about guiding the user, when he encounters the error message I mentioned,

  • Installcondato create conda environments.

would it be possible to explain/link to the solution or would this require a too complex patch?

noonsleeper commented 3 days ago

I agree, but whatever the technical justification, the fact is that the user experience for a developer is broken by default (at least for very common python projects).

I think "broken by default" is not the best statement, the isolation of the environment is intended here, not only for this package but with any flatpak package, then if the developers of a tool or any user want the features that flatpak provide they need to fix the tool or do a workaround to be compliant with flatpak sandbox, if you think that is not for you, you can find the regular packages for your distribution here

If the only acceptable solution to this, is an extension, how would be the user experience? Is it a simple install from flathub and it works?

when someone add something like this, https://github.com/flathub/com.vscodium.codium/blob/27d1b63964845a7c772e987dba9fc74d7c593ca8/com.vscodium.codium.yaml#L28-L34 then if you download the tool like

flatpak install flathub com.visualstudio.code.tool.podman

After restart codium this tool is available inside the codium's sandbox without any other user intervention.

How about guiding the user, when he encounters the error message I mentioned,

  • Installcondato create conda environments.

would it be possible to explain/link to the solution or would this require a too complex patch?

This kind of guiding are already in the FAQ, then will be needed to add a solution to this particular in the same way on README.md as well

Altonss commented 3 days ago

I think "broken by default" is not the best statement, the isolation of the environment is intended here, not only for this package but with any flatpak package, then if the developers of a tool or any user want the features that flatpak provide they need to fix the tool or do a workaround to be compliant with flatpak sandbox,

Sure, but the underlying (VSCodium) tool isn't really well adapted for this isolation and fails in strange ways (like this very issue shows), which is totally understandable and normal :) So yes the experience is kind of "broken" in the sense that in order to have a working environment, one has to do all the research and fixing we are for example doing in this issue ^^. But that's okay, since that's what I'm/we are trying to improve here ;)

noonsleeper commented 3 days ago

Like a mention before, I think the best solution for your needs is to install the distribution package.