robotframework-browser icon indicating copy to clipboard operation
robotframework-browser copied to clipboard

Change of default /usr/local/python3 from python3.8 to python3.12 breaks library imports

Open mika-b opened this issue 1 year ago • 4 comments

Describe the bug Python 3.12 installed from a PPA conflicts with libraries from the official repositories. If newer python is required, better solution would be to update the base image to v1.48.0-jammy or v1.48.0-noble.

To Reproduce Steps to reproduce the behavior:

  • Launch container and try to import urllib3 in python
docker run -ti --rm marketsquare/robotframework-browser:18.9.1 bash
Unable to find image 'marketsquare/robotframework-browser:18.9.1' locally
18.9.1: Pulling from marketsquare/robotframework-browser
Digest: sha256:065293e926afa8db99fb4248287ae65a41eeeda163ed2b6e80b338a4818c6f96
Status: Downloaded newer image for marketsquare/robotframework-browser:18.9.1

pwuser@5a76ff979f44:/$ python3
Python 3.12.7 (main, Oct  1 2024, 08:52:11) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/urllib3/__init__.py", line 7, in <module>
    from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 11, in <module>
    from .exceptions import (
  File "/usr/lib/python3/dist-packages/urllib3/exceptions.py", line 2, in <module>
    from six.moves.http_client import IncompleteRead as httplib_IncompleteRead
ModuleNotFoundError: No module named 'six.moves'
>>> 

Expected behavior import of urllib3 works when you explicitly use the python provided by the official Ubuntu repositories.

docker run -ti --rm marketsquare/robotframework-browser:18.9.1 bash
pwuser@9519c297bcbf:/$ python3.8 
Python 3.8.10 (default, Sep 11 2024, 16:02:53) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib3
>>> 

Additional context Was working fine with 18.8.0

mika-b avatar Oct 14 '24 09:10 mika-b

I don’t quite follow, what is actually broken? I see that urllib3 import failed, but as far I can see it’s not Browser library dependency. Therefore I don’t see what is actually broken?

aaltat avatar Oct 14 '24 10:10 aaltat

It's not a Browser library dependency but people use robotframework-browser container to run their test suites with their libraries and other tools. So the python version change breaks any user test library that tries to import for example urllib3.

mika-b avatar Oct 14 '24 10:10 mika-b

@allcontributors please add @mika-b for bugs

aaltat avatar Oct 14 '24 18:10 aaltat

@aaltat

I've put up a pull request to add @mika-b! :tada:

allcontributors[bot] avatar Oct 14 '24 18:10 allcontributors[bot]

@mika-b Sorry to play "bad cop" here.

But even if Python 3.12 would break urllib3, which it doesn't, Python 3.12 is an official release for over a year now. 3.13 is pretty new, but every maintained library should be compatible to 3.12 by now.

By the way urllib3 and six are compatible and i am convinced that this happens because there are old versions of libraries on the system.

We have to test, if this is something that we can control, or if this is in your projects dependencies. Something is not up to date.

Please verify if you are using maintained versions of your libraries. All hints in the search i did, do confirm that older versions were incompatible, but that this has been fixed.

Snooz82 avatar Nov 03 '24 22:11 Snooz82

Decided to fix it be removing the urllib3 and six from docker package.

aaltat avatar Nov 10 '24 11:11 aaltat