![]() |
#1 |
Member
![]() Posts: 17
Karma: 10
Join Date: May 2025
Device: Kindle
|
![]()
It feels like a catch-22, but if you use the calibre api it requires its own binary (calibre-debug) and yet to code in a virtual environment (venv), you also have to use a specific binary, in this case the python binary created in the venv. Is it possible to use the calibre database within python within a virtual environment? Am I missing something maybe?
Any help would be appreciated. |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,355
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Why do you want to use a venv? calibre contains its own isolated python already. Simply use it. If you want to import some other packages, then add the path to them to sys.path before importing them.
|
![]() |
![]() |
![]() |
#3 | |
Member
![]() Posts: 17
Karma: 10
Join Date: May 2025
Device: Kindle
|
Quote:
Again, I could be missing something. |
|
![]() |
![]() |
![]() |
#4 |
Member
![]() Posts: 17
Karma: 10
Join Date: May 2025
Device: Kindle
|
Say, for instance I wanted to use eBookLib. To insall that, I use pip, but to do that I need to be within a venv. Pip won't let me install system-wide unless I break with security.
|
![]() |
![]() |
![]() |
#5 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,355
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Why on earth would you want to use ebooklib with calibre, calibre contains far more capable code to read ebook formats. And no you dont need to install using venv, venv is just a crutch for people that dont take the time to understand how python importing works. Just download ebooklib wheel and add the path to the wheel to sys.path and then import it. Or unzip the whl file and add the path to the top level directory containing the top level __init__.py to sys.path and import it.
|
![]() |
![]() |
![]() |
#6 | |
Member
![]() Posts: 17
Karma: 10
Join Date: May 2025
Device: Kindle
|
Quote:
But yes, I understand. Just manually download and include the library in the project folder and then add to sys.path. That makes sense. I would argue though that pip isn't a crutch for the clueless, as you implied. It seems elegant and efficient to me. But thank you for the help. |
|
![]() |
![]() |
![]() |
#7 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,355
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
If you think the python packaging ecosystem is elegant I urge you to google problems with python packaging.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to debug calibredb error using Python tools? | plo233 | Development | 1 | 07-01-2019 12:39 PM |
3.34 calibre-debug runs the script code under Python 3 | EbokJunkie | Conversion | 2 | 11-20-2018 07:43 PM |
Python newbie, need help about print statement debug | TonyAn | Calibre | 3 | 05-17-2017 03:46 PM |
How to setup Python debug environment for Calibre Recipes | huang5307 | Recipes | 9 | 03-03-2016 02:35 PM |
win7-debug-python | jaapx | Calibre | 2 | 10-23-2015 12:11 AM |