Setup/Installation help

Good evening all. Trying to use pylinac to do WL tests. As a newbie, I cannot seem to get it to run. I believe I got everything installed. Any advice or help would be great. When I try to run the script, I get an import error.
Thanks

Hi,

could you be a bit more precise? What operating system do you use? What Python environment did you install? What is the exact error you get?

For example I am using windows here at work, and downloaded the full winpython package. (The latest Version can be downloaded here:
https://sourceforge.net/projects/winpython/files/WinPython_3.10/3.10.8.0/Winpython64-3.10.8.0.exe/download )

After extracting the files all I had to do to install pylinac was open the WinPython Command Prompt.exe and type “pip install pylinac”.
(if you are behind a proxy you might have to set an environment variable for that: set HTTPS_PROXY=http://yourproxy:8080)

For a simple test you could open the IPython Qt Console.exe and type:
import pylinac
pylinac.DRMLC.run_demo()

I hope that helps
Thomas

Thanks.

I’ve installed both anacona and python 3.8 (started with 3.11 but some of the dependencies not install)…using windows 11. with both programs, the pip install runs fine. Running now just says all says requirement is satisfied

If I try to type import pylinac from either CMD or powershell promt and get errors about it not knowing what “import is” See Below.

I’ll try the program you are using and see if I get a different result.

Thanks,
Steve

(base) C:\Users\Caitlin\Desktop\Pylinac\pylinac-qatrackplus-master\pylinac>install pylinac
‘install’ is not recognized as an internal or external command,
operable program or batch file.

or

(base) PS C:\Users\Caitlin\Desktop\Pylinac\pylinac-qatrackplus-master\pylinac> import pylinac
import : The term ‘import’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • import pylinac
  • CategoryInfo : ObjectNotFound: (import:String) , CommandNotFoundException
  • FullyQualifiedErrorId : CommandNotFoundException

You are trying to run Python in a CMD shell. You need to start a Python interpreter first by typing python in the CMD shell. Inside the interpreter you can then to import pylinac. However, I highly recommend you start with something like Jupyter so that you can write .py files so you can repeat your Python calls. You can read more here: https://jupyter.org/

Thanks. Typing python allowed me to run the demo…Moving forward.

I installed jupyter

I’m interested in doing Winston-Lutz…Where would I place my files to be analyzed? or am I thinking to window like

Think I got it…created a directory and ran it.

from pylinac import WinstonLutz
wl = WinstonLutz(“wl/image/directory”) # images are analyzed upon loading
wl.plot_summary()
print(wl.results())
wl.publish_pdf(‘my_wl.pdf’)

Trying to run the WL test for kV images. Trying to use open_field and/or low_density_bb arguments and get errors.

Am I using it wrong? copy/paste showing error below.

Thanks for your help

wl.analyze(bb_size_mm=7.5, open_field=True)
Traceback (most recent call last):
File “”, line 1, in
TypeError: analyze() got an unexpected keyword argument ‘open_field’

Which version of pylinac are you using? The open_field parameter wasn’t added until version 3.10.

Looks like version 3.9

How do I upgrade? I did pip install pylinac again and still has same version.

“Python 3.9.13 (main, Aug 25 2022, 23:51:50) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type “help”, “copyright”, “credits” or “license” for more information.”

pip install pylinac --upgrade