Missing modules when running Examples

I am using conda and VS code. I followed the install directions for conda made sure VS Code was using the right interpreter and I still get this missing module error. How do I get this example working? Below is the terminal out when I run the example.

Blockquote
PS C:\Users\bearl\OneDrive\Documents\GitHub\opentps> & C:/Users/bearl/Coding/Anaconda/envs/CProtons/python.exe c:/Users/bearl/OneDrive/Documents/GitHub/opentps/opentps_core/opentps/core/examples/doseComputation/photonPlanCreationAndDoseCalculation.py
01/07/2025 01:28:43 PM - root - INFO - Loading logging configuration: C:\Users\bearl\Coding\Anaconda\envs\CProtons\lib\site-packages\opentps\core\config\logger\logging_config.json
01/07/2025 01:28:43 PM - opentps.core._loggingConfig - INFO - Log level set: INFO
01/07/2025 01:28:46 PM - opentps.core.processing.imageProcessing.cupyImageProcessing - WARNING - Cannot import Cupy module
01/07/2025 01:28:46 PM - opentps.core.processing.registration.registrationMorphons - WARNING - cupy not found.
01/07/2025 01:28:46 PM - opentps.core.processing.registration.morphonsCupy - WARNING - cupy not found.
01/07/2025 01:28:46 PM - opentps.core.processing.C_libraries.libInterp3_wrapper - WARNING - cupy not found.
Traceback (most recent call last):
File “c:\Users\bearl\OneDrive\Documents\GitHub\opentps\opentps_core\opentps\core\examples\doseComputation\photonPlanCreationAndDoseCalculation.py”, line 5, in
from opentps.core.processing.doseCalculation.photons.cccDoseCalculator import CCCDoseCalculator
ModuleNotFoundError: No module named ‘opentps.core.processing.doseCalculation.photons’

Dear Ben W,

It seems that we cannot reproduce your error; could you perhaps tell us which version of Python and OpenTPS you are using?

Off the top of my head, I would say that a quick fix would be to create an empty “__init__.py” file in the “doseCalculation” folder and in the “photons” folder as shown below.

└── doseCalculation/
    ├── __init__.py
    └── photons/
        ├── __init__.py
        └── cccDoseCalculator.py

If this solves your issue, please let us know so that we can fix the master branch of OpenTPS for other users.

Regards,
Eliot

I am using opentps version 1.1.2. on Python version 3.9.23. I searched, and I couldn’t find the photons folder under the dose calculation folder or anywhere in the core OpenTPS package folder.

Hello,

Photon plan optimization is not available in this version of OpenTPS. This feature has been added in OpenTPS v2.0.0. Please download the latest version from our GitLab if you wish to use photon plan optimization.

You may also upgrade your Python to version 3.11 for better compatibility, although this is not required.

Romain Schyns
OpenTPS team

I am still having trouble I started back from ground zero and cloned the opentps repository off the gitlab. On anaconda prompt I ran the “install_opentps_anaconda_windows.bat” file then the “start_opentps_anaconda_windows.bat” file but the application would not launch. I update to python 3.11 and I still get a modules error “ModuleNotFoundError: No module named ‘PyQt5.sip’” any help would be appreaciated.

Could you try uninstalling and reinstalling all PyQt-related libraries:

  • pyqt5
  • pyqt5-qt5
  • pyqt5-sip

If the issue persists, I recommend deleting the OpenTPS Conda environment and re-running the install_opentps_anaconda_windows.bat

I hope this will solve your problem.

Romain Schyns
OpenTPS team

Solution: Install psutil

I figured this out a little bit ago but thought it would be help for people to know. I don’t know if this is a issue specific to my software or an issue more broadly but I have seen others with similar issues maybe the opentps team(?) should add this to the download instructions.

1 Like