spyder-ide / spyder-terminal

Run system terminals inside Spyder. Works on Linux, macOS and Windows.
MIT License
227 stars 77 forks source link

spyder_terminal - Problem when opening Preferences with local build on FreeBSD 13, Python 3.11 #342

Open spchamp opened 1 year ago

spchamp commented 1 year ago

Description

What steps will reproduce the problem?

I'm not certain how much of the following, if any of the following, may be related. Reviewing the backtrace in the details section, I'll try to take a look at the source code.

To install this Spyder IDE instance, I'd used the following general workflow. This is with a Spyder IDE installation via pip, on a FreeBSD 13.2 desktop, amd64 architecture, Python 3.11. Maybe any of the following could have produced any side effects that may have lead to the error.

I believe that I may have figured out the intial workflow for this installation. I'll try to reproduce this with a separate virtual environment for Python 3.10 on this machine

Traceback

Traceback (most recent call last):
  File "/usr/home/gimbal/wk/python_wk/spyder_sandbox/env/lib/python3.11/site-packages/spyder/plugins/preferences/plugin.py", line 276, in <lambda>
    lambda: self.open_dialog(main.prefs_dialog_size))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/home/gimbal/wk/python_wk/spyder_sandbox/env/lib/python3.11/site-packages/spyder/plugins/preferences/plugin.py", line 256, in open_dialog
    container.create_dialog(
  File "/usr/home/gimbal/wk/python_wk/spyder_sandbox/env/lib/python3.11/site-packages/spyder/plugins/preferences/widgets/container.py", line 58, in create_dialog
    page.initialize()
  File "/usr/home/gimbal/wk/python_wk/spyder_sandbox/env/lib/python3.11/site-packages/spyder/plugins/preferences/api.py", line 86, in initialize
    self.setup_page()
  File "/usr/home/gimbal/wk/python_wk/spyder_sandbox/env/lib/python3.11/site-packages/spyder_terminal/confpage.py", line 55, in setup_page
    if mac_ver >= LooseVersion('10.15.0'):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/home/gimbal/wk/python_wk/spyder_sandbox/env/lib/python3.11/site-packages/setuptools/_distutils/version.py", line 90, in __ge__
    c = self._cmp(other)
        ^^^^^^^^^^^^^^^^
  File "/usr/home/gimbal/wk/python_wk/spyder_sandbox/env/lib/python3.11/site-packages/setuptools/_distutils/version.py", line 350, in _cmp
    if self.version == other.version:
       ^^^^^^^^^^^^
AttributeError: 'LooseVersion' object has no attribute 'version'

Versions

Dependencies

# Mandatory:
atomicwrites >=1.2.0                 :  1.4.1 (OK)
chardet >=2.0.0                      :  5.1.0 (OK)
cloudpickle >=0.5.0                  :  2.2.1 (OK)
cookiecutter >=1.6.0                 :  2.1.1 (OK)
diff_match_patch >=20181111          :  20200713 (OK)
intervaltree >=3.0.2                 :  3.1.0 (OK)
IPython >=7.31.1;<9.0.0              :  8.11.0 (OK)
jedi >=0.17.2;<0.19.0                :  0.18.2 (OK)
jellyfish >=0.7                      :  0.9.0 (OK)
jsonschema >=3.2.0                   :  4.17.3 (OK)
keyring >=17.0.0                     :  23.13.1 (OK)
nbconvert >=4.0                      :  7.2.9 (OK)
numpydoc >=0.6.0                     :  1.5.0 (OK)
parso >=0.7.0;<0.9.0                 :  0.8.3 (OK)
pexpect >=4.4.0                      :  4.8.0 (OK)
pickleshare >=0.4                    :  0.7.5 (OK)
psutil >=5.3                         :  5.9.4 (OK)
pygments >=2.0                       :  2.14.0 (OK)
pylint >=2.5.0;<3.0                  :  2.17.0 (OK)
pylint_venv >=2.1.1                  :  3.0.1 (OK)
pyls_spyder >=0.4.0                  :  0.4.0 (OK)
pylsp >=1.7.1;<1.8.0                 :  1.7.1 (OK)
pylsp_black >=1.2.0                  :  1.2.1 (OK)
qdarkstyle >=3.0.2;<3.1.0            :  3.0.3 (OK)
qstylizer >=0.2.2                    :  0.2.2 (OK)
qtawesome >=1.2.1                    :  1.2.3 (OK)
qtconsole >=5.4.0;<5.5.0             :  5.4.0 (OK)
qtpy >=2.1.0                         :  2.3.0 (OK)
rtree >=0.9.7                        :  1.0.1 (OK)
setuptools >=49.6.0                  :  65.6.3 (OK)
sphinx >=0.6.6                       :  6.1.3 (OK)
spyder_kernels >=2.4.2;<2.5.0        :  2.4.2 (OK)
textdistance >=4.2.0                 :  4.5.0 (OK)
three_merge >=0.1.1                  :  0.1.1 (OK)
watchdog >=0.10.3                    :  2.3.1 (OK)
zmq >=22.1.0                         :  25.0.0 (OK)

# Optional:
cython >=0.21                        :  None (NOK)
matplotlib >=3.0.0                   :  None (NOK)
numpy >=1.7                          :  None (NOK)
pandas >=1.1.1                       :  None (NOK)
scipy >=0.17.0                       :  None (NOK)
sympy >=0.7.3                        :  None (NOK)

# Spyder plugins:
spyder_terminal.terminalplugin 1.2.2 :  1.2.2 (OK)

Environment

Environment ``` Package Version Editable project location ----------------------------- --------- ------------------------------------------------ alabaster 0.7.13 arrow 1.2.3 astroid 2.15.0 asttokens 2.2.1 atomicwrites 1.4.1 attrs 22.2.0 autopep8 1.6.0 Babel 2.12.1 backcall 0.2.0 beautifulsoup4 4.11.2 binaryornot 0.4.4 black 23.1.0 bleach 6.0.0 boto3 1.26.88 botocore 1.29.88 build 0.10.0 certifi 2022.12.7 chardet 5.1.0 charset-normalizer 3.1.0 click 8.1.3 cloudpickle 2.2.1 coloredlogs 15.0.1 comm 0.1.2 cookiecutter 2.1.1 debugpy 1.6.6 decorator 5.1.1 defusedxml 0.7.1 diff-match-patch 20200713 dill 0.3.6 distlib 0.3.6 docstring-to-markdown 0.11 docutils 0.19 entrypoints 0.4 executing 1.2.0 fastjsonschema 2.16.3 filelock 3.9.0 flake8 6.0.0 humanfriendly 10.0 idna 3.4 imagesize 1.4.1 importlib-metadata 6.0.0 inflection 0.5.1 intervaltree 3.1.0 ipykernel 6.21.3 ipython 8.11.0 ipython-genutils 0.2.0 isort 5.12.0 jaraco.classes 3.2.3 jedi 0.18.2 jellyfish 0.9.0 Jinja2 3.1.2 jinja2-time 0.2.0 jmespath 1.0.1 jsonschema 4.17.3 jupyter_client 7.4.9 jupyter_core 5.2.0 jupyterlab-pygments 0.2.2 keyring 23.13.1 lazy-object-proxy 1.9.0 MarkupSafe 2.1.2 matplotlib-inline 0.1.6 mccabe 0.7.0 mistune 2.0.5 more-itertools 9.1.0 mypy-extensions 1.0.0 nbclient 0.7.2 nbconvert 7.2.9 nbformat 5.7.3 nest-asyncio 1.5.6 numpydoc 1.5.0 packaging 23.0 pandocfilters 1.5.0 parso 0.8.3 pathspec 0.11.0 Paver 1.3.4 pexpect 4.8.0 pickleshare 0.7.5 pip 23.0.1 pip-tools 6.12.3 piprepo 0.1.3 platformdirs 3.1.0 pluggy 1.0.0 ply 3.11 prompt-toolkit 3.0.38 psutil 5.9.4 ptyprocess 0.7.0 pure-eval 0.2.2 pycodestyle 2.10.0 pydocstyle 6.2.3 pyflakes 3.0.1 Pygments 2.14.0 pylaborate-spydy-qt5 1.0.0 /usr/home/gimbal/wk/python_wk/spyder_sandbox/src pylint 2.17.0 pylint-venv 3.0.1 pyls-spyder 0.4.0 pyproject_hooks 1.0.0 PyQt-builder 1.14.1 PyQt5 5.15.7 PyQt5-sip 12.11.1 PyQtWebEngine 5.15.6 pyrsistent 0.19.3 python-dateutil 2.8.2 python-lsp-black 1.2.1 python-lsp-jsonrpc 1.0.0 python-lsp-server 1.7.1 python-slugify 8.0.1 pytoolconfig 1.2.5 PyYAML 6.0 pyzmq 25.0.0 QDarkStyle 3.0.3 qstylizer 0.2.2 QtAwesome 1.2.3 qtconsole 5.4.0 QtPy 2.3.0 requests 2.28.2 rope 1.7.0 Rtree 1.0.1 s3transfer 0.6.0 setuptools 65.6.3 sip 6.7.7 six 1.16.0 snowballstemmer 2.2.0 sortedcontainers 2.4.0 soupsieve 2.4 Sphinx 6.1.3 sphinxcontrib-applehelp 1.0.4 sphinxcontrib-devhelp 1.0.2 sphinxcontrib-htmlhelp 2.0.1 sphinxcontrib-jsmath 1.0.1 sphinxcontrib-qthelp 1.0.3 sphinxcontrib-serializinghtml 1.1.5 spyder 5.4.2 spyder-kernels 2.4.2 spyder-terminal 1.2.2 sqlite3 0.0.0 stack-data 0.6.2 terminado 0.17.1 text-unidecode 1.3 textdistance 4.5.0 three-merge 0.1.1 tinycss2 1.2.1 Tkinter 0.0.0 toml 0.10.2 tomlkit 0.11.6 tornado 6.2 traitlets 5.9.0 ujson 5.7.0 urllib3 1.26.14 virtualenv 20.20.0 watchdog 2.3.1 wcwidth 0.2.6 webencodings 0.5.1 whatthepatch 1.0.4 wheel 0.38.4 wrapt 1.15.0 wurlitzer 3.0.3 yapf 0.32.0 zipp 3.15.0 ```
spchamp commented 1 year ago

I've encountered this also with Python 3.10 on this platform. A similar backtrace, after activating the Tools / Preferences menu item:

Traceback (most recent call last):
  File "/usr/home/gimbal/wk/python_wk/spyder_sandbox/env3.10/lib/python3.10/site-packages/spyder/plugins/preferences/plugin.py", line 276, in <lambda>
    lambda: self.open_dialog(main.prefs_dialog_size))
  File "/usr/home/gimbal/wk/python_wk/spyder_sandbox/env3.10/lib/python3.10/site-packages/spyder/plugins/preferences/plugin.py", line 256, in open_dialog
    container.create_dialog(
  File "/usr/home/gimbal/wk/python_wk/spyder_sandbox/env3.10/lib/python3.10/site-packages/spyder/plugins/preferences/widgets/container.py", line 58, in create_dialog
    page.initialize()
  File "/usr/home/gimbal/wk/python_wk/spyder_sandbox/env3.10/lib/python3.10/site-packages/spyder/plugins/preferences/api.py", line 86, in initialize
    self.setup_page()
  File "/usr/home/gimbal/wk/python_wk/spyder_sandbox/env3.10/lib/python3.10/site-packages/spyder_terminal/confpage.py", line 55, in setup_page
    if mac_ver >= LooseVersion('10.15.0'):
  File "/usr/home/gimbal/wk/python_wk/spyder_sandbox/env3.10/lib/python3.10/site-packages/setuptools/_distutils/version.py", line 90, in __ge__
    c = self._cmp(other)
  File "/usr/home/gimbal/wk/python_wk/spyder_sandbox/env3.10/lib/python3.10/site-packages/setuptools/_distutils/version.py", line 349, in _cmp
    if self.version == other.version:
AttributeError: 'LooseVersion' object has no attribute 'version'

The Issue reporter window appears then.

This does not seem to otherwise affect the usability of the Syder IDE installation here. It's still usable, after closing the Issue reporter.

At the line listing a source file in spyder_terminal, it seems that it's checking a mac_ver string with this installation on FreeBSD. Perhaps the system may have resembled Darwin somehow.

spchamp commented 1 year ago

In spyder_terminal, it seems that the default shell setting might not have covered BSD systems yet. Maybe sh will do?

ccordoba12 commented 1 year ago

Hey @spchamp, thanks for reporting. This bug belongs to Spyder-terminal, so I'm moving it there.

In the future, please open related bugs there instead of here.