Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests module not accessible when opening new (default) console in Linux with IPython 7.34.0 #18840

Open
raymanP opened this issue Jul 27, 2022 · 4 comments

Comments

@raymanP
Copy link

raymanP commented Jul 27, 2022

Description

What steps will reproduce the problem?

I have a tests module in my python source, however, it is working only within the first console from stratup. When opening new console, the IPython tests extension is accessed. See error when loading directly in console:

from tests import test_helpers
Traceback (most recent call last):

  File "/tmp/ipykernel_18134/2426732088.py", line 1, in <cell line: 1>
    from tests import test_helpers

ImportError: cannot import name 'test_helpers' from 'tests' (/home/reimund/spyder-env/lib/python3.10/site-packages/IPython/extensions/tests/__init__.py)

This is on Linux (Ubuntu 22.04 with Wayland). Under macOS it works. Under Windows I don't know.

Thanks for the great Python-IDE :D

Versions

  • Spyder version: 5.3.2 (pip)
  • Python version: 3.10.4 64-bit
  • Qt version: 5.15.2
  • PyQt5 version: 5.15.6
  • Operating System: Linux 5.15.0-41-generic

Dependencies

# Mandatory:
atomicwrites >=1.2.0          :  1.4.0 (OK)
chardet >=2.0.0               :  4.0.0 (OK)
cloudpickle >=0.5.0           :  2.0.0 (OK)
cookiecutter >=1.6.0          :  1.7.3 (OK)
diff_match_patch >=20181111   :  20200713 (OK)
intervaltree >=3.0.2          :  3.1.0 (OK)
IPython >=7.31.1;<8.0.0       :  7.34.0 (OK)
jedi >=0.17.2;<0.19.0         :  0.18.1 (OK)
jellyfish >=0.7               :  0.9.0 (OK)
jsonschema >=3.2.0            :  4.4.0 (OK)
keyring >=17.0.0              :  23.5.0 (OK)
nbconvert >=4.0               :  6.5.0 (OK)
numpydoc >=0.6.0              :  1.3.1 (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.1 (OK)
pygments >=2.0                :  2.12.0 (OK)
pylint >=2.5.0;<3.0           :  2.14.5 (OK)
pyls_spyder >=0.4.0           :  0.4.0 (OK)
pylsp >=1.5.0;<1.6.0          :  1.5.0 (OK)
pylsp_black >=1.2.0           :  1.2.1 (OK)
qdarkstyle >=3.0.2;<3.1.0     :  3.0.3 (OK)
qstylizer >=0.1.10            :  0.2.1 (OK)
qtawesome >=1.0.2             :  1.1.1 (OK)
qtconsole >=5.3.0;<5.4.0      :  5.3.0 (OK)
qtpy >=2.1.0                  :  2.1.0 (OK)
rtree >=0.9.7                 :  1.0.0 (OK)
setuptools >=49.6.0           :  63.2.0 (OK)
sphinx >=0.6.6                :  5.1.0 (OK)
spyder_kernels >=2.3.2;<2.4.0 :  2.3.2 (OK)
textdistance >=4.2.0          :  4.2.2 (OK)
three_merge >=0.1.1           :  0.1.1 (OK)
watchdog >=0.10.3             :  2.1.7 (OK)
xdg >=0.26                    :  0.27 (OK)
zmq >=22.1.0                  :  23.2.0 (OK)

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

Environment

Environment
Package                       Version
----------------------------- -----------
alabaster                     0.7.12
anybadge                      1.9.0
appdirs                       1.4.4
arrow                         1.2.2
astroid                       2.11.6
asttokens                     2.0.5
atomicwrites                  1.4.0
attrs                         21.4.0
auditwheel                    5.1.2
autodocsumm                   0.2.6
autopep8                      1.6.0
Babel                         2.10.1
backcall                      0.2.0
beautifulsoup4                4.11.1
binaryornot                   0.4.4
bitstring                     3.1.9
black                         22.3.0
bleach                        5.0.0
certifi                       2021.10.8
cffi                          1.15.0
chardet                       4.0.0
charset-normalizer            2.0.12
click                         8.1.3
cloudpickle                   2.0.0
colorama                      0.4.5
colorlog                      6.6.0
cookiecutter                  1.7.3
coverage                      6.4.2
cryptography                  37.0.4
Cython                        0.29.30
debugpy                       1.6.0
decorator                     5.1.1
defusedxml                    0.7.1
diff-match-patch              20200713
dill                          0.3.4
docutils                      0.18.1
ecdsa                         0.18.0
entrypoints                   0.4
execnet                       1.9.0
executing                     0.8.3
extras                        1.0.0
fastjsonschema                2.15.3
fixtures                      4.0.0
flake8                        4.0.1
furo                          2022.6.21
idna                          3.3
imagesize                     1.3.0
importlib-metadata            4.11.3
importlib-resources           5.7.1
inflection                    0.5.1
iniconfig                     1.1.1
intervaltree                  3.1.0
ipykernel                     6.13.0
ipython                       7.34.0
ipython-genutils              0.2.0
isodate                       0.6.1
isort                         5.10.1
jedi                          0.18.1
jeepney                       0.8.0
jellyfish                     0.9.0
Jinja2                        3.0.3
jinja2-time                   0.2.0
jsonschema                    4.4.0
jupyter-client                7.3.4
jupyter-core                  4.10.0
jupyterlab-pygments           0.2.2
keyring                       23.5.0
lazy-object-proxy             1.7.1
MarkupSafe                    2.1.1
matplotlib-inline             0.1.3
mccabe                        0.6.1
miss-hit                      0.9.33
miss-hit-core                 0.9.33
mistune                       0.8.4
mypy-extensions               0.4.3
nbclient                      0.6.0
nbconvert                     6.5.0
nbformat                      5.3.0
nest-asyncio                  1.5.5
numpy                         1.23.1
numpydoc                      1.3.1
packaging                     21.3
pandocfilters                 1.5.0
parso                         0.8.3
pathspec                      0.9.0
pbr                           5.8.1
pexpect                       4.8.0
pickleshare                   0.7.5
Pillow                        9.1.0
pip                           22.2
pkg-about                     1.0.4
platformdirs                  2.5.2
pluggy                        1.0.0
poyo                          0.5.0
prettytable                   3.3.0
prompt-toolkit                3.0.29
psutil                        5.9.1
ptyprocess                    0.7.0
pure-eval                     0.2.2
py                            1.11.0
pyaes                         1.6.1
pyc-wheel                     1.2.7
pycodestyle                   2.8.0
pycparser                     2.21
pydocstyle                    6.1.1
pyelftools                    0.28
pyflakes                      2.4.0
Pygments                      2.12.0
pylint                        2.14.5
pylint-exit                   1.2.0
pyls-spyder                   0.4.0
pyparsing                     3.0.8
PyQt5                         5.15.6
PyQt5-Qt5                     5.15.2
PyQt5-sip                     12.10.1
PyQtWebEngine                 5.15.5
PyQtWebEngine-Qt5             5.15.2
pyrsistent                    0.18.1
pyserial                      3.5
pytest                        7.1.2
pytest-cov                    3.0.0
pytest-forked                 1.4.0
pytest-repeat                 0.9.1
pytest-xdist                  2.5.0
python-dateutil               2.8.2
python-lsp-black              1.2.1
python-lsp-jsonrpc            1.0.0
python-lsp-server             1.5.0
python-slugify                6.1.2
python-subunit                1.4.0
pytz                          2022.1
pyxdg                         0.27
PyYAML                        6.0
pyzmq                         23.2.0
QDarkStyle                    3.0.3
qstylizer                     0.2.1
QtAwesome                     1.1.1
qtconsole                     5.3.0
QtPy                          2.1.0
reportlab                     3.6.9
requests                      2.27.1
rope                          1.0.0
rst2pdf                       0.99
Rtree                         1.0.0
SecretStorage                 3.3.2
setuptools                    63.2.0
six                           1.16.0
smartypants                   2.0.1
snowballstemmer               2.2.0
sortedcontainers              2.4.0
soupsieve                     2.3.2.post1
Sphinx                        5.1.0
sphinx-basic-ng               0.0.1a11
sphinx-paramlinks             0.5.4
sphinx-tabs                   3.4.1
sphinxcontrib-applehelp       1.0.2
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
spyder                        5.3.2
spyder-kernels                2.3.2
stack-data                    0.2.0
testtools                     2.5.0
text-unidecode                1.3
textdistance                  4.2.2
three-merge                   0.1.1
tinycss2                      1.1.1
toml                          0.10.2
tomli                         2.0.1
tomlkit                       0.11.0
tornado                       6.1
traitlets                     5.1.1
ujson                         5.2.0
urllib3                       1.26.11
watchdog                      2.1.7
wcwidth                       0.2.5
webencodings                  0.5.1
whatthepatch                  1.0.2
wheel                         0.37.1
wrapt                         1.14.1
wurlitzer                     3.0.2
yapf                          0.32.0
zipp                          3.8.0

@dalthviz
Copy link
Member

Hi @raymanP thank you for the feedback and glad that Spyder is useful to you :) ! Regarding the issue, is your tests module installed in your env or you are setting its path in the PYTHONPATH to have access to it? Seems like for some reason the import in the following consoles instances collides with some module from IPython?

If I do import tests I'm getting an extension from IPython imported:

imagen

Maybe as a workaround you could change the name of your module?

Let us know!

@raymanP
Copy link
Author

raymanP commented Jul 29, 2022

I tried under macOS where is not such a problem, importing tests without own module in paths. Here the IPython extensions seems not to be included:

import tests
Traceback (most recent call last):

  Input In [1] in <cell line: 1>
    import tests

ModuleNotFoundError: No module named 'tests'

So something seems to be different. I try to find out more.

@raymanP
Copy link
Author

raymanP commented Jul 29, 2022

It is an older IPython version problem: see ipython/ipython#12892
Has been fixed since IPython 8.0
Spyder still installs IPython 7.34.0
After updating to latest IPython 8.4.0 (getting warning in Spyder) the tests module is working properly now.
So have to wait until IPython 8+ compatibility with Spyder. Hope will come soon, however, workaround exist, so nothing to hurry

@dalthviz
Copy link
Member

Thanks for the new info @raymanP ! Then I guess this is related to #18117

@dalthviz dalthviz changed the title tests module not accessible when opening new (default) console in Linux tests module not accessible when opening new (default) console in Linux with IPython 7.34.0 Jul 29, 2022
@dalthviz dalthviz added this to the v5.3.4 milestone Aug 18, 2022
@dalthviz dalthviz modified the milestones: v5.4.0, v5.4.1 Oct 11, 2022
@ccordoba12 ccordoba12 modified the milestones: v5.4.1, v5.4.2 Dec 6, 2022
@ccordoba12 ccordoba12 modified the milestones: v5.4.2, v5.4.3 Jan 5, 2023
@ccordoba12 ccordoba12 modified the milestones: v5.4.3, v6.0alpha2 Jan 20, 2023
@ccordoba12 ccordoba12 modified the milestones: v6.0alpha2, v6.0alpha3 Jun 8, 2023
@ccordoba12 ccordoba12 modified the milestones: v6.0alphaX, v6.1.0 Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants