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

Broken on system with python 3.13 - no module named 'pipes' #292

Closed
mickyabir opened this issue Oct 18, 2024 · 5 comments
Closed

Broken on system with python 3.13 - no module named 'pipes' #292

mickyabir opened this issue Oct 18, 2024 · 5 comments
Labels
C-bug Category: Bug L-python Language: Python
Milestone

Comments

@mickyabir
Copy link

mickyabir commented Oct 18, 2024

I tried installing ikos using homebrew on MacOS Sonoma (M3 MBP) and after installing and trying to run ikos, I got:

error: could not find ikos python module error: see TROUBLESHOOTING.md

Upon further investigation, I found the root problem:

Type "help", "copyright", "credits" or "license" for more information.
>>> import ikos
>>> import ikos.analyzer
Traceback (most recent call last):
  File "<python-input-1>", line 1, in <module>
    import ikos.analyzer
  File "/opt/homebrew/Cellar/ikos/3.4_1/libexec/lib/python3.13/site-packages/ikos/analyzer.py", line 48, in <module>
    import pipes
ModuleNotFoundError: No module named 'pipes'

Apparently this module has been removed in python3 3.13 (https://docs.python.org/3/whatsnew/3.13.html)

@ivanperez-keera
Copy link
Collaborator

ivanperez-keera commented Oct 18, 2024

Thanks for reporting this, @mickyabir .

I could be wrong but it's possible that pipes is only needed for this:

if hasattr(shlex, 'quote'):
sh_quote = shlex.quote
else:
sh_quote = pipes.quote

The documentation of subprocess, which is suggested in Python3 as an alternative to pipes, doesn't provide an alternative other than shlex.quote().

If this is a protection to make ikos compatible with older versions of Python, I think it's not needed: since we are already requiring Python >= 3.3 (as per #243, part of IKOS 3.2), I think it's safe to assume that shlex.quote is available, since the documentation of the method itself indicates that it was introduced in Python 3.3.

@arthaud Does removing that use of pipes.quote() and unconditionally using shlex.quote() sound right to you?

@ivanperez-keera ivanperez-keera added C-bug Category: Bug L-python Language: Python labels Oct 18, 2024
@arthaud
Copy link
Member

arthaud commented Oct 19, 2024

Yeah, I think we don't need this anymore. Feel free to submit a PR!

@ivanperez-keera
Copy link
Collaborator

ivanperez-keera commented Oct 19, 2024

@mickyabir if you want, it'd be great to have you contribute the change to IKOS :)

Would you like to submit a PR to remove the import of pipes and turn that if-then-else into an unconditional sh_quote = shlex.quote? It should be a very small patch.

FYI, we'll ask that you sign one of the two CLAs: https://github.com/NASA-SW-VnV/ikos/tree/master/doc/contribute and send it to [email protected], CC-ing [email protected]. I hate to do this for such a small change, but I have to, especially because we are in the process of changing licenses (to one that will be more permissive).

@tarikgta2
Copy link
Contributor

Hello everyone,

I’ve just encountered the same issue while using Python 3.13, and I noticed that a related issue has already been opened. I’ve fixed the problem in the "analyzer.py" file and tested it, and everything is now working smoothly.

I’ve submitted a pull request, but if you'd prefer the original reporter of the issue to handle it and/or to give them credit, I completely understand.

I wish everyone a nice weekend!

tarikgta2

@Vivraan
Copy link

Vivraan commented Nov 18, 2024

Hello everyone,

I’ve just encountered the same issue while using Python 3.13, and I noticed that a related issue has already been opened. I’ve fixed the problem in the "analyzer.py" file and tested it, and everything is now working smoothly.

I’ve submitted a pull request, but if you'd prefer the original reporter of the issue to handle it and/or to give them credit, I completely understand.

I wish everyone a nice weekend!

tarikgta2

Bumping, and referring #293 here!

ivanperez-keera pushed a commit to tarikgta2/ikos that referenced this issue Nov 26, 2024
).

The analyzer currently uses pipes in older versions of python, and shlex
only when it's available. A prior commit to IKOS required Python 3.3,
where shlex was introduced, so it is safe to assume that it's available
unconditionally. Additionally, the module pipes was deprecated in python
3.11 and finally removed in python 3.13. This is making ikos not work
with modern versions of Python.

This commit replaces uses of pipes' quote method with shlex's quote.
@ivanperez-keera ivanperez-keera added this to the ikos 3.5 milestone Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Bug L-python Language: Python
Projects
None yet
Development

No branches or pull requests

5 participants