nanovna-saver icon indicating copy to clipboard operation
nanovna-saver copied to clipboard

bug: ns-0.6.3 can't install on Ubuntu 22.04

Open kzembower opened this issue 1 year ago • 5 comments

Bug Report

NanoVNA-Saver version: 0.6.3

commit: d3216d2 (I think)

Current behavior:

Trying to follow installation instruction in docs/INSTALLTION.md "Running on Linux without installation." Get error:

~/Downloads/nanovna-saver-0.6.3/nanovna-saver$ python3 nanovna-saver.py 
Traceback (most recent call last):
  File "/home/kevin/Downloads/nanovna-saver-0.6.3/nanovna-saver/nanovna-saver.py", line 32, in <module>
    import NanoVNASaver.__main__
  File "/home/kevin/Downloads/nanovna-saver-0.6.3/nanovna-saver/src/NanoVNASaver/__main__.py", line 31, in <module>
    from PyQt6 import QtWidgets
ImportError: /home/kevin/.local/lib/python3.10/site-packages/PyQt6/QtCore.abi3.so: undefined symbol: _ZN14QReadWriteLock16destroyRecursiveEP21QReadWriteLockPrivate, version Qt_6_PRIVATE_API
~/Downloads/nanovna-saver-0.6.3/nanovna-saver$ 

Expected behavior:

Expected installation.

Other information:

~/Downloads/nanovna-saver-0.6.3/nanovna-saver$ pip3 list
Package                  Version
------------------------ ----------------
...
NanoVNASaver             0.6.3
...
numpy                    1.26.0
...
packaging                21.3
...
pip                      23.3.1
pipx                     1.0.0
...
pyparsing                2.4.7
PyQt5                    5.15.6
PyQt5-sip                12.9.1
PyQt6                    6.6.0
PyQt6-Qt6                6.6.1
PyQt6-sip                13.6.0
pyRFC3339                1.1
pyserial                 3.5
python-apt               2.4.0+ubuntu2
python-dateutil          2.8.2
python-debian            0.1.43+ubuntu1.1
python-rtmidi            1.4.7
...
setuptools               69.0.2
setuptools-scm           8.0.4
...
tomli                    2.0.1
...
wheel                    0.42.0
...
:~/Downloads/nanovna-saver-0.6.3/nanovna-saver$ 

kzembower avatar Nov 30 '23 21:11 kzembower

Yes i have same bug: image

a45804 avatar Dec 02 '23 00:12 a45804

Sounds like you're missing the Qt6 libraries.

Can you try installing them: sudo apt install qt6-base-dev

rjordans avatar Jan 17 '24 14:01 rjordans

I've been trying off and on for several days to get the code running. Any hints would be appreciated.

I have been using Python + pyenv for several years, but not PyScaffold. It is now installed. I then git clone'd the current version of the code. The web pages say that Python >= 3.8 is needed, however, when trying 3.8.1 it ran into "Type" errors, so I installed 3.9.18.

Note that I've tried the following by creating a pyenv virtual environment (called nanovna-saver, with python version 3.9.18), and separately (when the former repeatedly failed), using python -m venv venv. Both appeared to work with the next step, python setup -r requirements.txt. This installed PyQt6, updated the scmtools, etc., At this point, various websites indicated that it should be possible to then run nanovna-saver from this (the base of the cloned git tree. Note, the various .gitxxx files and folders exist and are populated). (NO references found to "build" the software on those pages or in the documents retrieved as part of the git clone). Attempting "python nanovna-saver" fails with the following:

Traceback (most recent call last): File "/home/john/bin/nanovna-saver/nanovna-saver.py", line 32, in import NanoVNASaver.main File "/home/john/bin/nanovna-saver/src/NanoVNASaver/main.py", line 34, in from NanoVNASaver.NanoVNASaver import NanoVNASaver File "/home/john/bin/nanovna-saver/src/NanoVNASaver/NanoVNASaver.py", line 30, in from .Windows import ( File "/home/john/bin/nanovna-saver/src/NanoVNASaver/Windows/init.py", line 2, in from .AnalysisWindow import AnalysisWindow File "/home/john/bin/nanovna-saver/src/NanoVNASaver/Windows/AnalysisWindow.py", line 24, in from NanoVNASaver.Analysis.AntennaAnalysis import MagLoopAnalysis File "/home/john/bin/nanovna-saver/src/NanoVNASaver/Analysis/AntennaAnalysis.py", line 26, in from NanoVNASaver.Analysis.VSWRAnalysis import VSWRAnalysis File "/home/john/bin/nanovna-saver/src/NanoVNASaver/Analysis/VSWRAnalysis.py", line 25, in from NanoVNASaver.Formatting import format_frequency, format_vswr File "/home/john/bin/nanovna-saver/src/NanoVNASaver/Formatting.py", line 57, in def format_frequency_inputs(freq: Number | str) -> str: TypeError: unsupported operand type(s) for |: 'ABCMeta' and 'type'

Reviewing the setup.py file it indicated a "build" option is available. Running python setup.py build created and populated a build directory. However, re-trying python nanovna-saver from the base of the git clone still fails (as above), and cd'ing into build/lib/NanoVNASaver and attempting to run with python NanoVNASaver.py also fails, with:

Traceback (most recent call last): File "/home/john/bin/nanovna-saver/build/lib/NanoVNASaver/NanoVNASaver.py", line 29, in from NanoVNASaver import Defaults File "/home/john/bin/nanovna-saver/build/lib/NanoVNASaver/NanoVNASaver.py", line 29, in from NanoVNASaver import Defaults ImportError: cannot import name 'Defaults' from partially initialized module 'NanoVNASaver' (most likely due to a circular import) (/home/john/bin/nanovna-saver/build/lib/NanoVNASaver/NanoVNASaver.py)

Again, I've tried all of the above (several times) using both pyenv and python -m virtual environments, and checking the shims, etc. it appears all the required packages are installed and at the proper version level (for python 3.9.18). At this point, I suspect I'm missing a step, or that there is something about PyScaffold that has to be initialized or otherwise setup, or that a much newer version of python is required but the config and/or requirements tests for python >=3.8 need updating, but I haven't been able to find build-from-source instructions.

If somebody can spot what I'm doing wrong, I would appreciate it.

jdr53 avatar Feb 29 '24 18:02 jdr53

Update to my post above. I've now tried removing python 3.8.1 and 3.9.18 (since "Type" errors seem to indicate a code problem, not a configuration problem). While going through the code, I also noticed functions passing "unioned" arguments do not work (and, the "|" operator should perhaps be replaced with "Union" (uppercase) instead. I haven't tried this yet. When flushing prior attempted python versions, I've also removed the items listed in the requirements.txt from previous attempts just as a belt-and-suspenders way to avert conflicts.

Steps attempted so far, in various flavors of virtual environments (python -m, pyenv) too, are:

  1. installed different versions of Python (currently trying 3.11.8, but none have helped) under pyenv
  2. declared the python version with pyenv local 3.11.8, and verified with python -V
  3. freshly git-download the code from https://github.com/NanoVNA-Saver/nanovna-saver
  4. setup virtualized environment with python -m venv venv or with pyenv
  5. activated the virtualized environment with pyenv activate or using source venv/bin/activate
  6. reinstalled the NanoVNA-save requirements using python install -r requirements.txt, and checked the installed versions in the appropriate environment (remember, this has been repeated many times now, with a clean sweep between attempts. I do not mix pyenv and python -m virtualized environments.)
  7. tried launching the application within the current directory (at least one other website this would be possible at this point, using python nanovna-saver but that doesn't work either)
  8. tried running with more attention to the active virtual environment, by trying no fewer than three different commands (all fail): a) python nanosaver.py (fails with: ModuleNotFoundError: No module named 'NanoVNASaver._version') b) python src/NanoVNA-Saver/NanoVNA-saver (fails at: from NanoVNASaver import Defaults ImportError: cannot import name 'Defaults' from partially initialized module 'NanoVNASaver' (most likely due to a circular import) (/home/john/bin/nanovna-saver/src/NanoVNASaver/NanoVNASaver.py) c) each of the above again, after attempting python setup.py build, which includes, for example, all of the PyQt6 code under venv/lib/python3.11/site-packages (over 471 MB of installed items from the -r requirements line)
  9. Also tried python setup.py build followed by python setup.py install, which claims to have installed into the build subdirectory, but attempting the above several ways to run nanovna-saver, etc., and now adding python build/lib/NanoVNASaver/NanoVNASaver.py to that list, none of them work.

All of this fiddling around has done something else: it has broken NanoVNASaver version 0.5.5.

I hate to ask, it's probably something that I've done wrong, but is the current code actually usable? Could somebody post a specific set of commands that will result in a successful build? Could that be added to the README too?

jdr53 avatar Mar 02 '24 01:03 jdr53

RJordans, I followed the links to your (0.5.4) version of nanovna-saver, git-cloned it, ran the python -m venv venv, activated it with source venv/bin/activate, ran pip install -r requirements.txt, and was immediately able to run your older version (based on PyQt5, etc.). This is the way I would have expected the current code to build (but as evidenced by all the attempts listed above, it doesn't). So I'm at a loss (we won't count the db ;-) as to what's wrong. Were you able to get the current PyQt6 code to build and run (I notice from git that you're ahead by a few commits and well behind on others. But you also recognized the potential problem with PyQt6 installation in a previous post.) The good news for now is, though I've fallen back from 0.5.5 to 0.5.4 (your version), at least the app is usable again.

jdr53 avatar Mar 02 '24 01:03 jdr53