Bug 146277 - Python -m pip fails: AttributeError: module 'asyncio.base_futures' has no attribute 'InvalidStateError'
Summary: Python -m pip fails: AttributeError: module 'asyncio.base_futures' has no att...
Status: RESOLVED INVALID
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
7.0.5.2 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-17 02:27 UTC by Freda
Modified: 2024-09-04 11:40 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Freda 2021-12-17 02:27:05 UTC
Description:
Everyone who uses Python needs to install a package eventually.  pip (AFAIK) comes pre-installed with Python, which is why I am using pip to install a package. The above-mentioned format for pip should produce the help information.

Environment:
LO Python: 3.7.10 (default, Mar  2 2021, 22:35:41) [MSC v.1928 64 bit (AMD64)] on win32
Version: 7.0.5.2 (x64)
Build ID: 64390860c6cd0aca4beafafcfd84613dd9dfb63a
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: en-AU (en_AU); UI: en-GB
Calc: threaded

Steps to Reproduce:
1. cd C:\c:\Program Files\LibreOffice\program
2. python -m pip


Actual Results:
Traceback (most recent call last):
  File "c:\Program Files\LibreOffice\program\python-core-3.7.10\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\Program Files\LibreOffice\program\python-core-3.7.10\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Python\Python39\lib\site-packages\pip\__main__.py", line 29, in <module>
    from pip._internal.cli.main import main as _main
  File "C:\Python\Python39\lib\site-packages\pip\_internal\cli\main.py", line 9, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "C:\Python\Python39\lib\site-packages\pip\_internal\cli\autocompletion.py", line 10, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "C:\Python\Python39\lib\site-packages\pip\_internal\cli\main_parser.py", line 8, in <module>
    from pip._internal.cli import cmdoptions
  File "C:\Python\Python39\lib\site-packages\pip\_internal\cli\cmdoptions.py", line 23, in <module>
    from pip._internal.cli.parser import ConfigOptionParser
  File "C:\Python\Python39\lib\site-packages\pip\_internal\cli\parser.py", line 12, in <module>
    from pip._internal.configuration import Configuration, ConfigurationError
  File "C:\Python\Python39\lib\site-packages\pip\_internal\configuration.py", line 27, in <module>
    from pip._internal.utils.misc import ensure_dir, enum
  File "C:\Python\Python39\lib\site-packages\pip\_internal\utils\misc.py", line 38, in <module>
    from pip._vendor.tenacity import retry, stop_after_delay, wait_fixed
  File "C:\Python\Python39\lib\site-packages\pip\_vendor\tenacity\__init__.py", line 520, in <module>
    from pip._vendor.tenacity._asyncio import AsyncRetrying
  File "C:\Python\Python39\lib\site-packages\pip\_vendor\tenacity\_asyncio.py", line 19, in <module>
    from asyncio import sleep
  File "C:\Python\Python39\lib\asyncio\__init__.py", line 8, in <module>
    from .base_events import *
  File "C:\Python\Python39\lib\asyncio\base_events.py", line 40, in <module>
    from . import events
  File "C:\Python\Python39\lib\asyncio\events.py", line 786, in <module>
    from _asyncio import (_get_running_loop, _set_running_loop,
AttributeError: module 'asyncio.base_futures' has no attribute 'InvalidStateError'

Expected Results:
I have not supplied any (valid) pip arguments so I expect the help details to be displayed.

This is LO pip unit testing 101


Reproducible: Always


User Profile Reset: No



Additional Info:
Ultimately, I want to use sqlite3 in LO.  Preferably, I want to the the sqlite3 that I have already installed outside of LO.  But LO cannot find the already installed sqlite3 so PLAN B: install sqlite3 locally into the LO Python instance (sort of like a venv).
Comment 1 Julien Nabet 2021-12-18 11:38:05 UTC
Several things:
- LO 7.0 branch is EOL, you can try LO 7.1.8 or brand new 7.2.4
(see https://wiki.documentfoundation.org/ReleasePlan)
- There's no native connection to SQLite on LO yet but I suppose you can try using SQLite via ODBC or JDBC
- you have Python 3.9 installed and Python version included in LO 7.0.5 is 3.7.10 so I think it can be expected there's some pb using pip.
Remark: in recent LO version (from 7.3.0?), LO embeds Python 3.8.10
Comment 2 Freda 2021-12-18 12:42:05 UTC
Thanks Julien for the response.

I know I said that what I really wanted to do was use sqlite3 but the bug I am reporting is that running pip under LO Python fails.  pip is most certainly supported in Python 3.7.10

Once running pip works, which is a standard function of Python, I wall get access to sqlite3.
Comment 3 Julien Nabet 2021-12-18 12:46:23 UTC
If you just want to access SQLlite from Python, what's the relation with LibreOffice?
I mean in this case you can use pip from your already installed Python 3.9 ?
Comment 4 Freda 2021-12-18 14:21:57 UTC
Julien: If I had wanted to do that I would have used pip under python 3.9 installed elsewhere on my PC.


BUT, this is the LO bugs forum.  I thought you might have guessed by now that I want to use sqlite3 from Python from LO.

And, for the record, I may want to use other packages.  Oh - from Python from LO.
Comment 5 Julien Nabet 2021-12-18 14:33:35 UTC
(In reply to Freda from comment #4)
> Julien: If I had wanted to do that I would have used pip under python 3.9
> installed elsewhere on my PC.
> 
> 
> BUT, this is the LO bugs forum.  I thought you might have guessed by now
> that I want to use sqlite3 from Python from LO.
> 
> And, for the record, I may want to use other packages.  Oh - from Python
> from LO.

Obviously, I can't help here, certainly someone would => uncc myself.
Comment 6 Freda 2021-12-21 12:35:22 UTC
Hello All

Sorry - I should have made myself a little clearer in the original description.  I use Python in LO Calc for functions/macros.  I already have this working successfully.  Now, however, I want to do something a little more complex and have need of external packages.  Sqlite3 is one of them and I am sure there will be more.  Because the Python installed elsewhere on my PC is of a different version from that imbedded in LO, I feel that it would be better to be able to manually install any requisite external package (using pip).
Comment 7 sockseight 2022-12-03 03:48:04 UTC
Hello,

Thank you for reporting the bug. Can you please confirm if the issue still exists in the latest builds of sqlite3 - python - libreoffice?


Could you please try to reproduce it with a master build from https://dev-builds.libreoffice.org/daily/master/ ?
You can install it alongside the standard version.

I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' if the bug is still present in the master build.
Comment 8 Buovjaga 2022-12-03 12:24:04 UTC
From bug 59954 comment 1:

"sqlite (and all other python modules that have external dependencies) is intentionally disabled."

See also:
https://git.libreoffice.org/core/+/master/external/python3/ExternalPackage_python3.mk

# packages not shipped:
# dbm, sqlite3 - need some database stuff
# curses - need curses to build the C module
# idlelib, tkinter, turtledemo - need Tk to build the C module
# test - probably unnecessary? was explicitly removed #i116738#
# venv - why would we need virtual environments