[ 
https://issues.apache.org/jira/browse/CASSANDRA-18198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17681082#comment-17681082
 ] 

Brandon Williams edited comment on CASSANDRA-18198 at 1/26/23 7:05 PM:
-----------------------------------------------------------------------

What I was missing here is that the virtualenvs in the /env3.x locations are 
for cqlsh, and dtest creates its own venv from inside the docker image.  If I 
follow what that does, I end up in a venv like this:

{noformat}
(venv) cassandra@0b4fc44433d6:~$ python -c 'import py; 
print(py.io.get_terminal_width());'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'py' has no attribute 'io'
(venv) cassandra@0b4fc44433d6:~$ pip install py
Collecting py
  Using cached py-1.11.0-py2.py3-none-any.whl (98 kB)
Installing collected packages: py
Successfully installed py-1.11.0
WARNING: You are using pip version 22.0.4; however, version 22.3.1 is available.
You should consider upgrading via the '/home/cassandra/venv/bin/python -m pip 
install --upgrade pip' command.
(venv) cassandra@0b4fc44433d6:~$ 
{noformat}

this is because the virtualenv is created with the system python3.8 from 
/usr/bin/python3.8, which is missing the py module:

{noformat}
cassandra@9186bcbeb831:~$ /usr/bin/python3.8
Python 3.8.10 (default, Mar 15 2022, 12:22:08) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import py
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'py'
>>> 
{noformat}

The simplest solution is probably to declare it as a dependency in the dtests, 
as I did above 
[here|https://github.com/driftx/cassandra-dtest/tree/CASSANDRA-18198].


was (Author: brandon.williams):
What I was missing here is that the virtualenvs in the /env3.x locations are 
for cqlsh, and dtest create their own venv in the docker image.  If I follow 
what that does, I end up in venv like this:

{noformat}
(venv) cassandra@0b4fc44433d6:~$ python -c 'import py; 
print(py.io.get_terminal_width());'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'py' has no attribute 'io'
(venv) cassandra@0b4fc44433d6:~$ pip install py
Collecting py
  Using cached py-1.11.0-py2.py3-none-any.whl (98 kB)
Installing collected packages: py
Successfully installed py-1.11.0
WARNING: You are using pip version 22.0.4; however, version 22.3.1 is available.
You should consider upgrading via the '/home/cassandra/venv/bin/python -m pip 
install --upgrade pip' command.
(venv) cassandra@0b4fc44433d6:~$ 
{noformat}

this is because the virtualenv is created with the system python3.8 from 
/usr/bin/python3.8, which is missing the py module:

{noformat}
cassandra@9186bcbeb831:~$ /usr/bin/python3.8
Python 3.8.10 (default, Mar 15 2022, 12:22:08) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import py
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'py'
>>> 
{noformat}

The simplest solution is probably to declare it as a dependency in the dtests, 
as I did above 
[here|https://github.com/driftx/cassandra-dtest/tree/CASSANDRA-18198].

> "AttributeError: module 'py' has no attribute 'io'" reported in multiple tests
> ------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-18198
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-18198
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Test/dtest/python
>            Reporter: Claude Warren
>            Assignee: Brandon Williams
>            Priority: Normal
>
> {{title = 'Timeout'}}
> {{stream = <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>}}
> {{{}sep = '+'{}}}{{{}def write_title(title, stream=None, sep="~"):{}}}
> {{{}"""Write a section title.{}}}{{{}If *stream* is None sys.stderr will be 
> used, *sep* is used to{}}}
> {{draw the line.}}
> {{"""}}
> {{if stream is None:}}
> {{stream = sys.stderr}}
> {{> width = py.io.get_terminal_width()}}
> {{E AttributeError: module 'py' has no attribute 'io}}
>  
> is reported in multiple tests as noted below.
> possibly a class loader issue associated with CASSANDRA-18150
> 4.1
> [https://ci-cassandra.apache.org/job/Cassandra-4.1/256/testReport/dtest-offheap.repair_tests.incremental_repair_test/TestIncRepair/test_multiple_full_repairs_lcs]
> 3.11
> [https://ci-cassandra.apache.org/job/Cassandra-3.11/424/testReport/dtest.bootstrap_test/TestBootstrap/test_simultaneous_bootstrap/]
> 3.0
> [https://ci-cassandra.apache.org/job/Cassandra-3.0/328/testReport/dtest-upgrade.upgrade_tests.upgrade_supercolumns_test/TestSCUpgrade/test_upgrade_super_columns_through_all_versions/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to