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

No module named 'logic' #8

Open
jamesobutler opened this issue Jul 27, 2022 · 3 comments
Open

No module named 'logic' #8

jamesobutler opened this issue Jul 27, 2022 · 3 comments

Comments

@jamesobutler
Copy link

Is this leftover example code or are you actually trying to utilize this logic package from PyPI? I'm observing when running the CLIs No module named 'logic'.


pip_install('logic')

@Maxlo24
Copy link
Collaborator

Maxlo24 commented Jul 28, 2022

I don't know how to fix it, one Librairie is using logic. When the module was tested on MAC the code crashed with No module named 'logic' error. I had to run this line to remove the error

Maybe there is a better solution you're aware of.
Thanks

@jamesobutler
Copy link
Author

The "No module named 'logic'" is an issue with trying to import Slicer infrastructure stuff from within PythonSlicer.exe which is what runs the CLI script.

PS C:\Users\JamesButler\AppData\Local\NA-MIC\Slicer 5.0.3\bin> ./PythonSlicer.exe
Python 3.9.10 (main, Jul  8 2022, 02:32:50) [MSC v.1930 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import slicer.util
No module named 'logic'

https://discourse.slicer.org/t/how-to-import-slicer-in-python-cli/8083/3?u=jamesobutler

Generally, CLIs are not intended to have direct access to the Slicer scene / infrastructure. They are meant for non-interactive data processing with non-slicer libraries. If you want to work within the Slicer environment, you should keep the code within a python scripted module.

I've generally not seen the attempted pip_install of packages from a python scripted Slicer CLI like below.

try:
import torch
except ImportError:
pip_install('torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113')
import torch

Typically a Slicer scripted loadable module will either:

@luciacev
Copy link
Contributor

Thank you for your input.
The module runs properly despite this error message that @Jeanneclre is working to address.

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

3 participants