Telecominfraproject / oopt-gnpy

Optical Route Planning Library, Based on a Gaussian Noise Model
http://telecominfraproject.com
BSD 3-Clause "New" or "Revised" License
204 stars 88 forks source link

Issues after installation of new GNPy SW on VM during the pytest of gnpy: Wrong release for xlrd and issue with import of Element Tree #505

Open filip-nikolic opened 5 months ago

filip-nikolic commented 5 months ago

I performed installation of new GNPy on VM and I want to share my findings with you. I hope that it will be useful :)

Installation of GNPy was done on new Linux VM. OS is ubuntu 22.04.

As a precondition I did installation of anaconda3 python distribution. After installation this is the status:

(base) user@GNPy:~$ pip show xlrd Name: xlrd Version: 1.2.0 Summary: Library for developers to extract data from Microsoft Excel (tm) spreadsheet files Home-page: http://www.python-excel.org/ Author: John Machin Author-email: sjmachin@lexicon.net License: BSD Location: /home/infinera/anaconda3/lib/python3.11/site-packages Requires: Required-by: gnpy

user@GNPy:~$ pip show pandas Name: pandas Version: 2.1.4 Summary: Powerful data structures for data analysis, time series, and statistics Home-page: https://pandas.pydata.org Author: Author-email: The Pandas Development Team pandas-dev@python.org License: BSD 3-Clause License

user@GNPy:~$ python -V Python 3.11.7

And installation of anaconda3 distribution. image

Installation of GNPy is run according to: pip install --editable .

After installation I run test of gnpy.

(base) user@GNPy:~$ python -c 'import gnpy' (base) user@GNPy:~$ pytest

The result of test was:

oopt-gnpy/tests/test_amplifier.py ................................................................................................................. [ 21%] oopt-gnpy/tests/test_automaticmodefeature.py . [ 22%] oopt-gnpy/tests/test_disjunction.py ............................ [ 27%] oopt-gnpy/tests/test_equalization.py ................................................................................................................................ [ 52%] oopt-gnpy/tests/test_gain_mode.py ......... [ 54%] oopt-gnpy/tests/test_info.py . [ 54%] oopt-gnpy/tests/test_invocation.py ................. [ 57%] oopt-gnpy/tests/test_logger.py ...FF...........FFFFFFFFFF [ 62%] oopt-gnpy/tests/test_network_functions.py .............................. [ 68%] oopt-gnpy/tests/test_parameters.py .. [ 69%] oopt-gnpy/tests/test_parser.py F..F.................................. [ 76%] oopt-gnpy/tests/test_propagation.py ......................... [ 81%] oopt-gnpy/tests/test_roadm_restrictions.py .............................. [ 87%] oopt-gnpy/tests/test_science_utils.py ..... [ 88%] oopt-gnpy/tests/test_spectrum_assignment.py ............................................................. [100%]

====================================================================================== FAILURES =======================================================================================

_ test_wrong_xls_service[wrong_service.xlsx-testTopology.xls-Service error: Request Id: 0 - could not find tsp : 'Voyager' with mode: 'Mode 10' in eqpt library \nComputation stopped.]

Please check the logs for complete output of errors in attachment.

Logs_after_installation.txt

By help of Esther Lerouzic we successfully manage to fix the issues in two steps.

  1. Wrong release for xlrd, we coudn't use excel input.

This issue was fixed by adding of lines in convert.py and service_sheet.py (just before "from xlrd import open_workbook.......")

Lines are:

image

  1. After this only issue was warning:

======================================================================================= warnings summary ======================================================================================== anaconda3/lib/python3.11/site-packages/xlrd/xlsx.py:39 /home/user/anaconda3/lib/python3.11/site-packages/xlrd/xlsx.py:39: DeprecationWarning: defusedxml.cElementTree is deprecated, import from defusedxml.ElementTree instead. try: import defusedxml.cElementTree as ET

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ================================================================================ 514 passed, 1 warning in 50.92s ================================================================================

We solved this by editing of xlsx.py file in folder /home/user/anaconda3/lib/python3.11/site-packages/xlrd/

In file xlsx.py we replaced cElementTree with ElementTree

Before change: image

After change:

image

After this i run the pytest again and it was successful.