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

Linux AppImage Python extension path problem #253

Closed
bcm0 opened this issue Sep 9, 2019 · 17 comments
Closed

Linux AppImage Python extension path problem #253

bcm0 opened this issue Sep 9, 2019 · 17 comments
Labels
bug Something isn't working

Comments

@bcm0
Copy link

bcm0 commented Sep 9, 2019

Please confirm that this problem is VSCodium-specific

  • [x ] This bug doesn't happen if I use Microsoft's Visual Studio Code. It only happens in VSCodium.
    It is APPIMAGE specific!

Please confirm that the issue/resolution isn't already documented

  • [x ] I checked the Docs page and my issue is not mentioned there.

To Reproduce

  1. Install Microsoft's python extension.
  2. Try to run python from vscodium's terminal. It uses the local python installation.
    The error is "ModuleNotFoundError: No module named 'encodings'"
  3. "printenv | grep PYTHON" gives PYTHONHOME and PYTHONPATH located in /tmp

Expected behavior
Python works.

Temporary fix
Remove AppRun and replace it with a symlink to usr/bin/codium

@bcm0 bcm0 added the bug Something isn't working label Sep 9, 2019
@stripedpajamas
Copy link
Member

@probonopd would you have any insight here? I'm not familiar with what kind of isolation AppImage might be doing.

@probonopd
Copy link

AppRun exports a couple of paths, assuming that a private copy of Python is bundled inside the AppImage.

https://github.com/AppImage/AppImageKit/blob/fef038a6283701f6976589bf7becf975b020d453/src/AppRun.c#L169

https://github.com/AppImage/AppImageKit/blob/fef038a6283701f6976589bf7becf975b020d453/src/AppRun.c#L178

Do you want to use the Python that may or may not be on the system? Then do not use the AppRun binary but your own script or symlink.

@tyu1996
Copy link
Contributor

tyu1996 commented Oct 25, 2019

AppRun exports a couple of paths, assuming that a private copy of Python is bundled inside the AppImage.

I ran by using the command inside terminal:
./VSCodium.AppImage .

And it opened VSCodium which inspects its own mounted directory.
vscApp
From the screenshot above, is it there is no python link in /usr/bin caused this issue? Both Python2 & Python3 doesn't work as mentioned above.

@probonopd
Copy link

probonopd commented Oct 25, 2019

To the authors of VSCodium: Do you want to use the Python that may or may not be on the system, or do you want to bundle a private copy of Python?

@tyu1996
Copy link
Contributor

tyu1996 commented Oct 26, 2019

It's better to use the Python that exists in user's machine rather than packaging them inside the AppImage.

Removed two environment variables, PYTHONPATH and PYTHONHOME would fix the problem. Python interpreter and pip modules worked. Tried on my Ubuntu & Solus.

I used custom AppRun which not specify both env variables, but so far I have to explicitly use appimagetool to package the AppDir. Is there any way to use custom AppRun with pkg2appimage in one go?

@probonopd
Copy link

probonopd commented Oct 28, 2019

It's better to use the Python that exists in user's machine rather than packaging them inside the AppImage.

If you want to do this, then as you write you need to use an AppRun that does not set the environment variables PYTHONPATH and PYTHONHOME. pkg2appimage cannot do this at the moment, but you can run appimagetool on the AppDir it generates as you write.

@zombiepigdragon
Copy link

While I wait for the pull request to merge, is there a workaround? I can't debug c++ at the moment due to the same issue, and have a shortened time on my current project.

@stripedpajamas
Copy link
Member

@zombiepigdragon do you have to have VSCodium installed through AppImage? As far as I know, this is an AppImage specific issue we're running into.

@zombiepigdragon
Copy link

@stripedpajamas Unfortunately, yes, at least at this time.

@stripedpajamas
Copy link
Member

@tyu1996 might be able to help as I think they have created a working AppImage while crafting #277

@tyu1996
Copy link
Contributor

tyu1996 commented Nov 25, 2019

Apologise for the wait. I was able to get back to this few days ago. Now I'm trying to make pkg2appimage works with modified functions.sh included alongside instead of download the original functions.sh.

@tyu1996
Copy link
Contributor

tyu1996 commented Nov 25, 2019

The latest PR is here.
I messed up a lot with every commits out there. Unfamiliar with the workings of pkg2appimage tho.

@sambuccid
Copy link

Thanks so much for this fork and for have solved this issue, but in the last release the AppImage file it's not included in the "assets", is there any problem?

@stripedpajamas
Copy link
Member

stripedpajamas commented Nov 27, 2019

I think there is a bug in the AppImage logic; error during build:

+pwd
/home/travis/build/VSCodium/vscodium/VSCodium
+cp '../.build/linux/deb/amd64/deb/*.deb' .
cp: cannot stat ‘../.build/linux/deb/amd64/deb/*.deb’: No such file or directory

I'm not sure, but I'm thinking it should be cp ../vscode/.build/linux/deb/amd64/deb/*.deb .

What do you think @tyu1996

ref: https://travis-ci.com/VSCodium/vscodium/jobs/260726462

@tyu1996
Copy link
Contributor

tyu1996 commented Nov 28, 2019

I think there is a bug in the AppImage logic; error during build:

+pwd
/home/travis/build/VSCodium/vscodium/VSCodium
+cp '../.build/linux/deb/amd64/deb/*.deb' .
cp: cannot stat ‘../.build/linux/deb/amd64/deb/*.deb’: No such file or directory

I'm not sure, but I'm thinking it should be cp ../vscode/.build/linux/deb/amd64/deb/*.deb .

What do you think @tyu1996

ref: https://travis-ci.com/VSCodium/vscodium/jobs/260726462

I forgot to change back to '../vscode/.build/...' after I built it successfully on my local machine, my bad.

Changed back to '../vscode/.build/...', fixed that area, but it has another issue afterwards:
2105 Unable to guess the architecture of the AppDir source directory "./VSCodium.AppDir/"
2106 A valid architecture with the ARCH environmental variable should be provided
2107 e.g. ARCH=x86_64 appimagetool ...

This didn't happen on my machine, but on my fork the travis-ci has this issue.
@probonopd May I know what caused the appimagetool can't detect the system architecture in travis?

The reference build log: https://travis-ci.org/tyu1996/vscodium/jobs/618049483

@probonopd
Copy link

@probonopd May I know what caused the appimagetool can't detect the system architecture in travis?

Usually this means that files for more than one architecture are in the AppDir. Supplying ARCH=x86_64 as stated in the error message should resolve this easily.

@tyu1996
Copy link
Contributor

tyu1996 commented Dec 12, 2019

@stripedpajamas Thank you for helping to fix the appimage building bug.
The python, pylint and pipenv are all working now with my old Flask project. @adnion would you want to try the latest appimage build?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants