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

Can't locate python install with Conda environment #33

Open
2 of 5 tasks
makamto opened this issue Nov 12, 2024 · 4 comments
Open
2 of 5 tasks

Can't locate python install with Conda environment #33

makamto opened this issue Nov 12, 2024 · 4 comments

Comments

@makamto
Copy link

makamto commented Nov 12, 2024

Describe the bug

In Local Python Model Configuration, I changed Python path to ~/miniconda3/bin/python3, which can run the latex_ocr_server in terminal.

~/miniconda3/bin/python3 -m latex_ocr_server --version
latex_ocr_server 0.1.1

However, when I check status in Obsidian, it gives error message Couldn't locate python install

I also tried /home/linux/..., or home/linux/..., both failed.

To Reproduce
Steps to reproduce the behavior:

  1. Install Miniconda
  2. pip install latex-ocr-server
  3. Install Obsidian Latex OCR plugin
  4. Use local model
  5. Change Python path to ~/miniconda3/bin/python3
  6. Check status
  7. Error message `Couldn't locate python install

Environment
I am on:

  • MacOS
  • Windows
  • Linux

Using the model:

  • Local model with python
  • Inference API with Huggingface
@kripnerl
Copy link

The same issue here.

I noticed that when I inset path to env python executable, it automatically removes "/" on the begginign:

Image

"~" tilde for home does not work either.

Just for clarity, environment is well installed:

kripner@lathander:~$ /home/kripner/mambaforge/envs/latex-ocr-server/bin/python -m latex_ocr_server --version
latex_ocr_server 0.1.1

@kripnerl
Copy link

The issue is connected with usage of normalizePath from obsidian SDK in

https://github.com/lucasvanmol/obsidian-latex-ocr/blob/4e9d34d27339c6f60b3f3a301f0c4a26eed58070/src/settings.ts#L172C1-L191C20

Namely

this.plugin.settings.pythonPath = normalizePath(file);

and

this.plugin.settings.pythonPath = normalizePath(value);

according to https://forum.obsidian.md/t/normalizepath-removes-a-leading/24713'

normalizePath is for path normalization within the vault for system-wide check, normalize from fs is recommended to be used.

Therefore, a possible solution may be the creation of a virtual environment within the vault.

I also do not recommend installing latex-ocr-server in the base Python installation since it installs a large number of libraries, which may cause trouble with dependencies.

@lucasvanmol or @SubsequentlySneeds, please check this. I have no single line written in TypeScript, and it would take me ages to set up the environment to change that one import and then test it. So sorry for not opening the pull request.

@lucasvanmol
Copy link
Owner

Thanks for looking into this so thoroughly! Unfortunately I'm away on holiday for next week so this might take a while before I can get to this

@kripnerl
Copy link

Btw. I created Venv within the vault. And the error message remains. There is probably also issue with how the "python" command is executed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants