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

2.2.1 - ModuleNotFoundError: No module named 'rtslib' #207

Open
pcisol opened this issue Jan 30, 2025 · 7 comments
Open

2.2.1 - ModuleNotFoundError: No module named 'rtslib' #207

pcisol opened this issue Jan 30, 2025 · 7 comments

Comments

@pcisol
Copy link

pcisol commented Jan 30, 2025

Looks like 2.2.1 has some dangling bond.

My system:
Python 3.12.4:
pip list:
rtslib-fb 2.2.1

Python 3.12.4 (main, Oct 14 2024, 11:02:32) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import rtslib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'rtslib'
>>> import rtslib_fb
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/xxxxxx/.pyenv/versions/3.12.4/lib/python3.12/site-packages/rtslib_fb.py", line 14, in <module>
    import rtslib
ModuleNotFoundError: No module named 'rtslib'
>>> 
@maurizio-lombardi
Copy link
Collaborator

Thanks for the report, I will immediately work to fix this

@martinhoyer
Copy link
Contributor

martinhoyer commented Feb 3, 2025

We need this bit in here as well, as it's using the same "workarounds":
https://github.com/open-iscsi/configshell-fb/blob/7088593241b4fe8b0990e790fc91b804d960d0c2/pyproject.toml#L36C1-L40C2

btw, looking forward to have some CI in place, hehe.

@bobpaul
Copy link

bobpaul commented Feb 9, 2025

Same or at least similar issue on 2.2.2:

$ python -m venv test/
$ source test/bin/activate
$ pip install rtslib-fb
Collecting rtslib-fb
  Downloading rtslib_fb-2.2.2-py3-none-any.whl.metadata (2.4 kB)
Collecting pyudev~=0.18 (from rtslib-fb)
  Downloading pyudev-0.24.3-py3-none-any.whl.metadata (4.6 kB)
Downloading rtslib_fb-2.2.2-py3-none-any.whl (48 kB)
Downloading pyudev-0.24.3-py3-none-any.whl (62 kB)
Installing collected packages: pyudev, rtslib-fb
Successfully installed pyudev-0.24.3 rtslib-fb-2.2.2

[notice] A new release of pip is available: 24.3.1 -> 25.0.1
[notice] To update, run: pip install --upgrade pip
(test) [tmp]$ ipython
/usr/lib/python3.13/site-packages/IPython/core/interactiveshell.py:937: UserWarning: Attempting to work
 in a virtualenv. If you encounter problems, please install IPython inside the virtualenv.
  warn(
Python 3.13.1 (main, Dec  4 2024, 08:01:33) [GCC 14.2.1 20240910]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.31.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import rtslib

In [2]: import rtslib.utils

In [3]: import rtslib_fb

In [4]: import rtslib_fb.utils
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[4], line 1
----> 1 import rtslib_fb.utils

ModuleNotFoundError: No module named 'rtslib_fb.utils'; 'rtslib_fb' is not a package

targetcli-fb has some from rtslib_fb.utils import ___ statements which aren't working. Does the compatibility "module" need to be a folder with an __init__.py maybe?

@martinhoyer
Copy link
Contributor

Hi @bobpaul, thanks for this.

@maurizio-lombardi it's been some time, do you remember what were the requirements for the 'legacy compatibility layer'? For some reason I thought targetcli is no longer using the _fb. Would you be up for updating it?

Here we would have to do some sort of sys.modules mapping, which imho could cause even more pain with no benefit.

@martinhoyer
Copy link
Contributor

Looking at it now. Not sure how to make everything happy to be honest.
rtslib is explicitly, directly re-exporting the classes from submodules, see https://github.com/open-iscsi/rtslib-fb/blob/master/rtslib/__init__.py

So, while from rtslib_fb.utils import foo won't work, from rtslib_fb import foo will. I don't know was the reasoning for this, but it was kept during the refactoring as no-harm-done compatibility.

IMHO, targetcli should be updated with a simple patch removing the _fb suffix and released with rtslib>=2.2.2 dependency.

@bobpaul
Copy link

bobpaul commented Feb 17, 2025

For my use, a deprecation warning would have been sufficient. Anytime someone import rtslib_fb (and if possible any of the submodule imports that are working like import rtslib_.utils) show a logger.warning() that "importing rtslib_fb is deprecated as of v2.2.0. Import rtslib instead". Downstream projects can always depend on <2.2.0 if they need to delay migrating.

I still would have gotten module not found but the first thing I did to troubleshoot was tried import rtslib_fb in a repl and a warning at that point would have been helpful.

@maurizio-lombardi
Copy link
Collaborator

For my use, a deprecation warning would have been sufficient. Anytime someone import rtslib_fb (and if possible any of the submodule imports that are working like import rtslib_.utils) show a logger.warning() that "importing rtslib_fb is deprecated as of v2.2.0

This sounds reasonable to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants