jrkerns / pylinac

An image analysis library for medical physics
https://pylinac.readthedocs.io/en/latest/
MIT License
155 stars 98 forks source link

Error in setup.py and some test #97

Closed goodsave closed 6 years ago

goodsave commented 7 years ago

To development team of pylinac

【eg】: run setup.py error: .......... Maximum Collimator RMS deviation (mm): 0.87 Couch 2D isocenter diameter: 3.49mm Couch 2D iso->BB vector: Vector(x=1.31, y=-0.72, z=0.00) Maximum Couch RMS deviation (mm): 1.14 ........ ERROR: test_loading (core.test_image.TestDicomStack)

Traceback (most recent call last): File "e:\pythonproject\pylinac-master\tests\core\test_image.py", line 247, in test_loading with TemporaryZipDirectory(self.stack_location) as tmpzip: File "e:\pythonproject\pylinac-master\pylinac\core\io.py", line 27, in init zfiles = zipfile.ZipFile(zfile) File "D:\soft\python36\lib\zipfile.py", line 1090, in init self.fp = io.open(file, filemode) FileNotFoundError: [Errno 2] No such file or directory: 'e:\pythonproject\pylinac-master\tests\test_files\CBCT\CBCT_4.zip'

====================================================================== ERROR: test_mixed_studies (core.test_image.TestDicomStack)

Traceback (most recent call last): File "e:\pythonproject\pylinac-master\tests\core\test_image.py", line 256, in test_mixed_studies DicomImageStack.from_zip(mixed_study_zip) File "e:\pythonproject\pylinac-master\pylinac\core\image.py", line 918, in from_zip with TemporaryZipDirectory(zip_path) as tmpzip: File "e:\pythonproject\pylinac-master\pylinac\core\io.py", line 27, in init zfiles = zipfile.ZipFile(zfile) File "D:\soft\python36\lib\zipfile.py", line 1090, in init self.fp = io.open(file, filemode) FileNotFoundError: [Errno 2] No such file or directory: 'e:\pythonproject\pylinac-master\tests\test_files\CBCT\mixed_studies.zip'

====================================================================== ERROR: test_get_url (core.test_io.TestIO) Test the URL retreiver.

Traceback (most recent call last): File "e:\pythonproject\pylinac-master\tests\core\test_io.py", line 30, in test_get_url local_file = get_url(file_url) File "e:\pythonproject\pylinac-master\pylinac\core\io.py", line 139, in get_url raise e File "e:\pythonproject\pylinac-master\pylinac\core\io.py", line 135, in geturl filename, = urlretrieve(url, filename=destination, reporthook=my_hook(t)) File "D:\soft\python36\lib\urllib\request.py", line 248, in urlretrieve with contextlib.closing(urlopen(url, data)) as fp: File "D:\soft\python36\lib\urllib\request.py", line 223, in urlopen return opener.open(url, data, timeout) File "D:\soft\python36\lib\urllib\request.py", line 532, in open response = meth(req, response) File "D:\soft\python36\lib\urllib\request.py", line 642, in http_response 'http', request, response, code, msg, hdrs) File "D:\soft\python36\lib\urllib\request.py", line 570, in error return self._call_chain(args) File "D:\soft\python36\lib\urllib\request.py", line 504, in _call_chain result = func(args) File "D:\soft\python36\lib\urllib\request.py", line 650, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 403: Forbidden

====================================================================== ERROR: setUpClass (test_cbct.CBCT4)

Traceback (most recent call last): File "e:\pythonproject\pylinac-master\tests\test_cbct.py", line 97, in setUpClass cls.cbct = cls.catphan.from_zip(filename, use_classifier=cls.use_classifier) File "e:\pythonproject\pylinac-master\pylinac\ct.py", line 107, in from_zip with TemporaryZipDirectory(zip_file) as temp_zip: File "e:\pythonproject\pylinac-master\pylinac\core\io.py", line 27, in init zfiles = zipfile.ZipFile(zfile) File "D:\soft\python36\lib\zipfile.py", line 1090, in init self.fp = io.open(file, filemode) FileNotFoundError: [Errno 2] No such file or directory: 'e:\pythonproject\pylinac-master\tests\test_files\CBCT\CBCT_4.zip'

====================================================================== ERROR: test_consructor (test_cbct.CBCTLoading)

Traceback (most recent call last): File "e:\pythonproject\pylinac-master\tests\utils.py", line 69, in test_consructor self.klass(self.constructor_input, **self.kwargs) File "e:\pythonproject\pylinac-master\pylinac\ct.py", line 71, in init raise NotADirectoryError("Path given was not a Directory/Folder") NotADirectoryError: Path given was not a Directory/Folder

====================================================================== ERROR: test_from_zip (test_cbct.CBCTLoading)

Traceback (most recent call last): File "e:\pythonproject\pylinac-master\tests\utils.py", line 81, in test_from_zip self.klass.from_zip(self.zip, **self.kwargs) File "e:\pythonproject\pylinac-master\pylinac\ct.py", line 107, in from_zip with TemporaryZipDirectory(zip_file) as temp_zip: File "e:\pythonproject\pylinac-master\pylinac\core\io.py", line 27, in init zfiles = zipfile.ZipFile(zfile) File "D:\soft\python36\lib\zipfile.py", line 1090, in init self.fp = io.open(file, filemode) FileNotFoundError: [Errno 2] No such file or directory: 'e:\pythonproject\pylinac-master\tests\test_files\CBCT\CBCT_4.zip'

====================================================================== ERROR: setUpClass (test_cbct.CatPhan600_2)

Traceback (most recent call last): File "e:\pythonproject\pylinac-master\tests\test_cbct.py", line 97, in setUpClass cls.cbct = cls.catphan.from_zip(filename, use_classifier=cls.use_classifier) File "e:\pythonproject\pylinac-master\pylinac\ct.py", line 107, in from_zip with TemporaryZipDirectory(zip_file) as temp_zip: File "e:\pythonproject\pylinac-master\pylinac\core\io.py", line 27, in init zfiles = zipfile.ZipFile(zfile) File "D:\soft\python36\lib\zipfile.py", line 1090, in init self.fp = io.open(file, filemode) FileNotFoundError: [Errno 2] No such file or directory: 'e:\pythonproject\pylinac-master\tests\test_files\CBCT\zzCAT201602.zip'

====================================================================== ERROR: setUpClass (test_cbct.Elekta2)

Traceback (most recent call last): File "e:\pythonproject\pylinac-master\tests\test_cbct.py", line 97, in setUpClass cls.cbct = cls.catphan.from_zip(filename, use_classifier=cls.use_classifier) File "e:\pythonproject\pylinac-master\pylinac\ct.py", line 107, in from_zip with TemporaryZipDirectory(zip_file) as temp_zip: File "e:\pythonproject\pylinac-master\pylinac\core\io.py", line 27, in init zfiles = zipfile.ZipFile(zfile) File "D:\soft\python36\lib\zipfile.py", line 1090, in init self.fp = io.open(file, filemode) FileNotFoundError: [Errno 2] No such file or directory: 'e:\pythonproject\pylinac-master\tests\test_files\CBCT\Elekta_2.zip'

====================================================================== ERROR: test_save_axes (test_logs.TestDynalog)

Traceback (most recent call last): File "e:\pythonproject\pylinac-master\pylinac\core\utilities.py", line 73, in import_mpld3 import mpld3 File "D:\soft\python36\lib\site-packages\mpld3__init__.py", line 43, in from ._display import * File "D:\soft\python36\lib\site-packages\mpld3_display.py", line 4, in import jinja2 ModuleNotFoundError: No module named 'jinja2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "e:\pythonproject\pylinac-master\tests\test_logs.py", line 81, in test_save_axes save_file(method, interactive=True, as_file_object='str') File "e:\pythonproject\pylinac-master\tests\utils.py", line 26, in save_file method(t, *args, kwargs) File "e:\pythonproject\pylinac-master\pylinac\log_analyzer.py", line 316, in save_plot_actual self._save(filename, interactive, kwargs) File "e:\pythonproject\pylinac-master\pylinac\log_analyzer.py", line 350, in _save mpld3 = import_mpld3() File "e:\pythonproject\pylinac-master\pylinac\core\utilities.py", line 75, in import_mpld3 raise ImportError("The MPLD3 library must be installed to make interactive plots. See http://mpld3.github.io/index.html for info.") ImportError: The MPLD3 library must be installed to make interactive plots. See http://mpld3.github.io/index.html for info.

====================================================================== ERROR: test_save_axes (test_logs.TestTrajectoryLog)

Traceback (most recent call last): File "e:\pythonproject\pylinac-master\pylinac\core\utilities.py", line 73, in import_mpld3 import mpld3 File "D:\soft\python36\lib\site-packages\mpld3__init__.py", line 43, in from ._display import * File "D:\soft\python36\lib\site-packages\mpld3_display.py", line 4, in import jinja2 ModuleNotFoundError: No module named 'jinja2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "e:\pythonproject\pylinac-master\tests\test_logs.py", line 81, in test_save_axes save_file(method, interactive=True, as_file_object='str') File "e:\pythonproject\pylinac-master\tests\utils.py", line 26, in save_file method(t, *args, kwargs) File "e:\pythonproject\pylinac-master\pylinac\log_analyzer.py", line 316, in save_plot_actual self._save(filename, interactive, kwargs) File "e:\pythonproject\pylinac-master\pylinac\log_analyzer.py", line 350, in _save mpld3 = import_mpld3() File "e:\pythonproject\pylinac-master\pylinac\core\utilities.py", line 75, in import_mpld3 raise ImportError("The MPLD3 library must be installed to make interactive plots. See http://mpld3.github.io/index.html for info.") ImportError: The MPLD3 library must be installed to make interactive plots. See http://mpld3.github.io/index.html for info.

====================================================================== ERROR: test_saving_image (test_picketfence.TestPlottingSaving)

Traceback (most recent call last): File "e:\pythonproject\pylinac-master\pylinac\core\utilities.py", line 73, in import_mpld3 import mpld3 File "D:\soft\python36\lib\site-packages\mpld3__init__.py", line 43, in from ._display import * File "D:\soft\python36\lib\site-packages\mpld3_display.py", line 4, in import jinja2 ModuleNotFoundError: No module named 'jinja2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "e:\pythonproject\pylinac-master\tests\test_picketfence.py", line 58, in test_saving_image save_file(self.pf.save_analyzed_image, interactive=True) File "e:\pythonproject\pylinac-master\tests\utils.py", line 19, in save_file method(tmpfile, *args, **kwargs) File "e:\pythonproject\pylinac-master\pylinac\picketfence.py", line 406, in save_analyzed_image mpld3 = import_mpld3() File "e:\pythonproject\pylinac-master\pylinac\core\utilities.py", line 75, in import_mpld3 raise ImportError("The MPLD3 library must be installed to make interactive plots. See http://mpld3.github.io/index.html for info.") ImportError: The MPLD3 library must be installed to make interactive plots. See http://mpld3.github.io/index.html for info.

====================================================================== ERROR: test_process_files (test_scripts.TestProcess)

Traceback (most recent call last): File "e:\pythonproject\pylinac-master\tests\test_scripts.py", line 51, in setUp self.copy_files() File "e:\pythonproject\pylinac-master\tests\test_scripts.py", line 35, in copy_files shutil.copy(file, WATCHER_DIR) File "D:\soft\python36\lib\shutil.py", line 241, in copy copyfile(src, dst, follow_symlinks=follow_symlinks) File "D:\soft\python36\lib\shutil.py", line 120, in copyfile with open(src, 'rb') as fsrc: FileNotFoundError: [Errno 2] No such file or directory: 'e:\pythonproject\pylinac-master\tests\test_files\CBCT\CBCT_4.zip'

====================================================================== ERROR: test_from_urls (test_vmat.TestLoading)

Traceback (most recent call last): File "e:\pythonproject\pylinac-master\tests\test_vmat.py", line 44, in test_from_urls VMAT.from_url('https://s3.amazonaws.com/assuranceqa-staging/uploads/imgs/DRMLC.zip') # shouldn't raise File "e:\pythonproject\pylinac-master\pylinac\vmat.py", line 154, in from_url zfile = get_url(url) File "e:\pythonproject\pylinac-master\pylinac\core\io.py", line 139, in get_url raise e File "e:\pythonproject\pylinac-master\pylinac\core\io.py", line 135, in geturl filename, = urlretrieve(url, filename=destination, reporthook=my_hook(t)) File "D:\soft\python36\lib\urllib\request.py", line 248, in urlretrieve with contextlib.closing(urlopen(url, data)) as fp: File "D:\soft\python36\lib\urllib\request.py", line 223, in urlopen return opener.open(url, data, timeout) File "D:\soft\python36\lib\urllib\request.py", line 532, in open response = meth(req, response) File "D:\soft\python36\lib\urllib\request.py", line 642, in http_response 'http', request, response, code, msg, hdrs) File "D:\soft\python36\lib\urllib\request.py", line 570, in error return self._call_chain(args) File "D:\soft\python36\lib\urllib\request.py", line 504, in _call_chain result = func(args) File "D:\soft\python36\lib\urllib\request.py", line 650, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 403: Forbidden

====================================================================== ERROR: test_save_subimage (test_vmat.TestPlottingSaving)

Traceback (most recent call last): File "e:\pythonproject\pylinac-master\pylinac\core\utilities.py", line 73, in import_mpld3 import mpld3 File "D:\soft\python36\lib\site-packages\mpld3__init__.py", line 43, in from ._display import * File "D:\soft\python36\lib\site-packages\mpld3_display.py", line 4, in import jinja2 ModuleNotFoundError: No module named 'jinja2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "e:\pythonproject\pylinac-master\tests\test_vmat.py", line 103, in test_save_subimage save_file(self.vmat.save_analyzed_subimage, PROFILE, interactive=True) File "e:\pythonproject\pylinac-master\tests\utils.py", line 19, in save_file method(tmpfile, *args, *kwargs) File "e:\pythonproject\pylinac-master\pylinac\core\decorators.py", line 75, in wrapper return func(args, **kwargs) File "e:\pythonproject\pylinac-master\pylinac\vmat.py", line 321, in save_analyzed_subimage mpld3 = import_mpld3() File "e:\pythonproject\pylinac-master\pylinac\core\utilities.py", line 75, in import_mpld3 raise ImportError("The MPLD3 library must be installed to make interactive plots. See http://mpld3.github.io/index.html for info.") ImportError: The MPLD3 library must be installed to make interactive plots. See http://mpld3.github.io/index.html for info.

====================================================================== FAIL: test_dose_dmax (test_tg51.ACB5_2011_9E)

Traceback (most recent call last): File "e:\pythonproject\pylinac-master\tests\test_tg51.py", line 102, in test_dose_dmax self.assertAlmostEqual(self.dose_mu_dmax, self.tg51.dose_mu_dmax, delta=0.0005) AssertionError: 0.997 != 1.0013447124477075 within 0.0005 delta

====================================================================== FAIL: test_dose_dref (test_tg51.ACB5_2011_9E)

Traceback (most recent call last): File "e:\pythonproject\pylinac-master\tests\test_tg51.py", line 139, in test_dose_dref self.assertAlmostEqual(self.dose_mu_dref, self.tg51.dose_mu_dref, delta=0.0005) AssertionError: 0.997 != 1.0013447124477075 within 0.0005 delta

====================================================================== FAIL: test_dose_dmax (test_tg51.ACB5_2012_16E)

Traceback (most recent call last): File "e:\pythonproject\pylinac-master\tests\test_tg51.py", line 102, in test_dose_dmax self.assertAlmostEqual(self.dose_mu_dmax, self.tg51.dose_mu_dmax, delta=0.0005) AssertionError: 1.005 != 1.0091622899897719 within 0.0005 delta

====================================================================== FAIL: test_dose_dref (test_tg51.ACB5_2012_16E)

Traceback (most recent call last): File "e:\pythonproject\pylinac-master\tests\test_tg51.py", line 139, in test_dose_dref self.assertAlmostEqual(self.dose_mu_dref, self.tg51.dose_mu_dref, delta=0.0005) AssertionError: 1.0 != 1.0041164785398231 within 0.0005 delta

====================================================================== FAIL: test_dose_dmax (test_tg51.IMMC_TB_9E)

Traceback (most recent call last): File "e:\pythonproject\pylinac-master\tests\test_tg51.py", line 102, in test_dose_dmax self.assertAlmostEqual(self.dose_mu_dmax, self.tg51.dose_mu_dmax, delta=0.0005) AssertionError: 1.006 != 1.010820482552764 within 0.0005 delta

====================================================================== FAIL: test_dose_dref (test_tg51.IMMC_TB_9E)

Traceback (most recent call last): File "e:\pythonproject\pylinac-master\tests\test_tg51.py", line 139, in test_dose_dref self.assertAlmostEqual(self.dose_mu_dref, self.tg51.dose_mu_dref, delta=0.0005) AssertionError: 1.006 != 1.010820482552764 within 0.0005 delta


Ran 358 tests in 664.422s

FAILED (failures=6, errors=14)


【eg】: run test_scripts.py error : D:\soft\python36\python.exe "D:\soft\PyCharm\PyCharm 2016.3.2\helpers\pycharm\utrunner.py" E:\pythonproject\pylinac-master\tests\test_scripts.py::TestProcess true Testing started at 18:11 ... Files cleaned up

Error Traceback (most recent call last): File "E:\pythonproject\pylinac-master\tests\test_scripts.py", line 51, in setUp self.copy_files() File "E:\pythonproject\pylinac-master\tests\test_scripts.py", line 35, in copy_files shutil.copy(file, WATCHER_DIR) File "D:\soft\python36\lib\shutil.py", line 241, in copy copyfile(src, dst, follow_symlinks=follow_symlinks) File "D:\soft\python36\lib\shutil.py", line 120, in copyfile with open(src, 'rb') as fsrc: FileNotFoundError: [Errno 2] No such file or directory: 'E:\pythonproject\pylinac-master\tests\test_files\CBCT\CBCT_4.zip' ==--------------------------------------------------------------------------------------------------------- why there are two '\' in file path? is my reason? ==---------------------------------------------------------------------------------------------------------

【supplement】: my environment are win 10 64bit vc++ 14.0 python 3.6 32it and it can work if i install pylinac with '$ pip install pylinac' then run '$ pylinac gui' . but it catch above error if i install pylinac with 'setup.py ' in my PyCharm IDE ==--------------------------------------------------------------------------------------------------------- Honorable development team of pylinac, look forward to your reply,good day! ==---------------------------------------------------------------------------------------------------------

jrkerns commented 7 years ago

So the problem here is that running all the tests include using certain files that are not included when cloning the git repo. Due to privacy, I keep certain donated test files private, but still run tests on them.