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

Cannot import module/plugin with Spyder standalone installer #23111

Closed
JacksonPhoong opened this issue Nov 29, 2024 · 7 comments
Closed

Cannot import module/plugin with Spyder standalone installer #23111

JacksonPhoong opened this issue Nov 29, 2024 · 7 comments

Comments

@JacksonPhoong
Copy link

Description

What steps will reproduce the problem?

I recently just installed Spyder using the standalone installer. I want to say thank you and great job to the developers who are working hard on this project. Spyder is a great IDE to use.

My issue is that I cannot import the module "utility" in Spyder. I used pip to install the module into my virtual environment and have restarted Spyder. I did not run into this issue when I installed other modules such as cvxpy and pennylane.

Also, I would love to work with notebooks in Spyder. I have installed spyder-notebook plugin but Spyder is not detecting it. I read in a blog that this was an issue with Spyder 5 but plugins should work with Spyder 6. Any help with this is appreciated.

Versions

  • Spyder version: 6.0.2 (standalone)
  • Python version: 3.11.10 64-bit
  • Qt version: 5.15.8
  • PyQt5 version: 5.15.9
  • Operating System: Windows-10-10.0.19045-SP0

Dependencies

# Mandatory:
aiohttp >=3.9.3                  :  3.10.10 (OK)
asyncssh >=2.14.0,<3.0.0         :  2.18.0 (OK)
atomicwrites >=1.2.0             :  1.4.1 (OK)
chardet >=2.0.0                  :  5.2.0 (OK)
cloudpickle >=0.5.0              :  3.1.0 (OK)
cookiecutter >=1.6.0             :  2.6.0 (OK)
diff_match_patch >=20181111      :  20241021 (OK)
github >=2.3.0                   :  2.4.0 (OK)
importlib_metadata >=4.6.0       :  8.5.0 (OK)
intervaltree >=3.0.2             :  3.1.0 (OK)
IPython >=8.13.0,<9.0.0,!=8.17.1 :  8.29.0 (OK)
jedi >=0.17.2,<0.20.0            :  0.19.1 (OK)
jellyfish >=0.7                  :  1.1.0 (OK)
jsonschema >=3.2.0               :  4.23.0 (OK)
keyring >=17.0.0                 :  25.5.0 (OK)
nbconvert >=4.0                  :  7.16.4 (OK)
numpydoc >=0.6.0                 :  1.8.0 (OK)
parso >=0.7.0,<0.9.0             :  0.8.4 (OK)
pexpect >=4.4.0                  :  4.9.0 (OK)
pickleshare >=0.4                :  0.7.5 (OK)
psutil >=5.3                     :  6.1.0 (OK)
pygments >=2.0                   :  2.18.0 (OK)
pylint >=3.1,<4                  :  3.3.1 (OK)
pylint_venv >=3.0.2              :  3.0.4 (OK)
pyls_spyder >=0.4.0              :  0.4.0 (OK)
pylsp >=1.12.0,<1.13.0           :  1.12.0 (OK)
pylsp_black >=2.0.0,<3.0.0       :  2.0.0 (OK)
pyuca >=1.2                      :  1.2 (OK)
qdarkstyle >=3.2.0,<3.3.0        :  3.2.3 (OK)
qstylizer >=0.2.2                :  0.2.3 (OK)
qtawesome >=1.3.1,<1.4.0         :  1.3.1 (OK)
qtconsole >=5.6.1,<5.7.0         :  5.6.1 (OK)
qtpy >=2.4.0                     :  2.4.1 (OK)
rtree >=0.9.7                    :  1.3.0 (OK)
setuptools >=49.6.0              :  75.3.0 (OK)
sphinx >=0.6.6                   :  8.1.3 (OK)
spyder_kernels >=3.0.1,<3.1.0    :  3.0.1 (OK)
superqt >=0.6.2,<1.0.0           :  0.6.7 (OK)
textdistance >=4.2.0             :  4.6.2 (OK)
three_merge >=0.1.1              :  0.1.1 (OK)
watchdog >=0.10.3                :  5.0.3 (OK)
yarl >=1.9.4                     :  1.16.0 (OK)
zmq >=24.0.0                     :  26.2.0 (OK)

# Optional:
cython >=0.21                    :  3.0.11 (OK)
matplotlib >=3.0.0               :  3.9.2 (OK)
numpy >=1.7                      :  2.1.2 (OK)
pandas >=1.1.1                   :  2.2.3 (OK)
scipy >=0.17.0                   :  1.14.1 (OK)
sympy >=0.7.3                    :  1.13.3 (OK)

Environment

Environment
Package                       Version
----------------------------- --------------
aiohappyeyeballs              2.4.3
aiohttp                       3.11.7
aiosignal                     1.3.1
alabaster                     1.0.0
anyio                         4.6.2.post1
appdirs                       1.4.4
argon2-cffi                   23.1.0
argon2-cffi-bindings          21.2.0
arrow                         1.3.0
astroid                       3.3.5
asttokens                     2.4.1
async-lru                     2.0.4
asyncssh                      2.18.0
atomicwrites                  1.4.1
attrs                         24.2.0
autograd                      1.7.0
autopep8                      2.0.4
autoray                       0.7.0
babel                         2.16.0
beautifulsoup4                4.12.3
binaryornot                   0.4.4
black                         24.10.0
bleach                        6.2.0
cachetools                    5.5.0
certifi                       2024.8.30
cffi                          1.17.1
chardet                       5.2.0
charset-normalizer            3.4.0
clarabel                      0.9.0
click                         8.1.7
cloudpickle                   3.1.0
colorama                      0.4.6
comm                          0.2.2
contourpy                     1.3.0
cookiecutter                  2.6.0
cryptography                  43.0.3
cvxpy                         1.6.0
cycler                        0.12.1
Cython                        3.0.11
debugpy                       1.8.7
decorator                     5.1.1
defusedxml                    0.7.1
Deprecated                    1.2.15
diff-match-patch              20241021
dill                          0.3.9
docstring-to-markdown         0.15
docutils                      0.21.2
executing                     2.1.0
fastjsonschema                2.20.0
flake8                        7.1.1
fonttools                     4.54.1
fqdn                          1.5.1
frozenlist                    1.5.0
h11                           0.14.0
httpcore                      1.0.7
httpx                         0.27.2
idna                          3.10
imagesize                     1.4.1
importlib_metadata            8.5.0
inflection                    0.5.1
intervaltree                  3.1.0
ipykernel                     6.29.5
ipython                       8.29.0
isoduration                   20.11.0
isort                         5.13.2
jaraco.classes                3.4.0
jaraco.context                6.0.1
jaraco.functools              4.1.0
jedi                          0.19.1
jellyfish                     1.1.0
Jinja2                        3.1.4
json5                         0.9.28
jsonpointer                   3.0.0
jsonschema                    4.23.0
jsonschema-specifications     2024.10.1
jupyter_client                8.6.3
jupyter_core                  5.7.2
jupyter-events                0.10.0
jupyter-lsp                   2.2.5
jupyter_server                2.14.2
jupyter_server_terminals      0.5.3
jupyterlab                    4.2.6
jupyterlab_pygments           0.3.0
jupyterlab_server             2.27.3
keyring                       25.5.0
kiwisolver                    1.4.7
markdown-it-py                3.0.0
MarkupSafe                    3.0.2
matplotlib                    3.9.2
matplotlib-inline             0.1.7
mccabe                        0.7.0
mdurl                         0.1.2
mistune                       3.0.2
more-itertools                10.5.0
mpmath                        1.3.0
multidict                     6.1.0
mypy-extensions               1.0.0
nbclient                      0.10.0
nbconvert                     7.16.4
nbformat                      5.10.4
nest-asyncio                  1.6.0
networkx                      3.4.2
notebook                      7.2.2
notebook_shim                 0.2.4
numpy                         1.26.4
numpydoc                      1.8.0
osqp                          0.6.7.post3
overrides                     7.7.0
packaging                     24.1
pandas                        2.2.3
pandocfilters                 1.5.1
parso                         0.8.4
pathspec                      0.12.1
PennyLane                     0.38.0
PennyLane_Lightning           0.38.0
pexpect                       4.9.0
pickleshare                   0.7.5
pillow                        11.0.0
pip                           24.3.1
platformdirs                  4.3.6
pluggy                        1.5.0
prometheus_client             0.21.0
prompt_toolkit                3.0.48
propcache                     0.2.0
psutil                        6.1.0
ptyprocess                    0.7.0
pure_eval                     0.2.3
pycodestyle                   2.12.1
pycparser                     2.22
pydocstyle                    6.3.0
pyflakes                      3.2.0
PyGithub                      2.5.0
Pygments                      2.18.0
PyJWT                         2.10.0
pylint                        3.3.1
pylint-venv                   3.0.4
pyls-spyder                   0.4.0
PyNaCl                        1.5.0
pyparsing                     3.2.0
PyQt5                         5.15.11
PyQt5-Qt5                     5.15.2
PyQt5_sip                     12.15.0
PyQtWebEngine                 5.15.7
PyQtWebEngine-Qt5             5.15.2
python-dateutil               2.9.0.post0
python-json-logger            2.0.7
python-lsp-black              2.0.0
python-lsp-jsonrpc            1.1.2
python-lsp-server             1.12.0
python-slugify                8.0.4
pytoolconfig                  1.3.1
pytz                          2024.2
pyuca                         1.2
pywin32                       308
pywin32-ctypes                0.2.3
pywinpty                      2.0.14
PyYAML                        6.0.2
pyzmq                         26.2.0
QDarkStyle                    3.2.3
qdldl                         0.1.7.post4
qstylizer                     0.2.4
QtAwesome                     1.3.1
qtconsole                     5.6.1
QtPy                          2.4.2
referencing                   0.35.1
requests                      2.32.3
rfc3339-validator             0.1.4
rfc3986-validator             0.1.1
rich                          13.9.4
rope                          1.13.0
rpds-py                       0.21.0
Rtree                         1.3.0
rustworkx                     0.15.1
scipy                         1.14.1
scs                           3.2.7
Send2Trash                    1.8.3
setuptools                    75.6.0
six                           1.16.0
sniffio                       1.3.1
snowballstemmer               2.2.0
sortedcontainers              2.4.0
soupsieve                     2.6
Sphinx                        8.1.3
sphinxcontrib-applehelp       2.0.0
sphinxcontrib-devhelp         2.0.0
sphinxcontrib-htmlhelp        2.1.0
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          2.0.0
sphinxcontrib-serializinghtml 2.0.0
spyder                        6.0.2
spyder-kernels                3.0.1
spyder-notebook               0.6.1
stack-data                    0.6.3
superqt                       0.6.7
sympy                         1.13.3
tabulate                      0.9.0
terminado                     0.18.1
text-unidecode                1.3
textdistance                  4.6.3
three-merge                   0.1.1
tinycss2                      1.4.0
toml                          0.10.2
tomlkit                       0.13.2
tornado                       6.4.1
traitlets                     5.14.3
types-python-dateutil         2.9.0.20241003
typing_extensions             4.12.2
tzdata                        2024.2
ujson                         5.10.0
uri-template                  1.3.0
urllib3                       2.2.3
utility                       1.0
watchdog                      6.0.0
wcwidth                       0.2.13
webcolors                     24.11.1
webencodings                  0.5.1
websocket-client              1.8.0
whatthepatch                  1.0.7
wrapt                         1.17.0
yapf                          0.43.0
yarl                          1.18.0
zipp                          3.21.0

@dalthviz
Copy link
Member

Hi @JacksonPhoong thank you for the report! Seems like you have a virtual environment with Spyder and your dependencies installed and also Spyder from our standalone installers. If you want to use spyder-notebook and be able to use the packages mentioned I think you would need to launch Spyder from a cmd/terminal with your env activated. The standalone version of Spyder doesn't support plugins installations for the moment and although it comes with some base predefined packages installed, to use other packages like (utility) you will need to set a custom interpreter over the preferences pointing to the env you have the packages installed. For more info on that you can check the FAQ page of the Spyder docs page could be useful: https://docs.spyder-ide.org/current/faq.html#using-spyder

Let us know if the info above helps!

@JacksonPhoong
Copy link
Author

JacksonPhoong commented Dec 2, 2024

I launched Spyder from cmd with my env activated and I am able to use notebooks in Spyder now! Thank you @dalthviz for the fix. However, I am still unable to import the module "utility". I have set the custom interpreter to be pointing to my env with the installed packages. I could import other packages such as pennylane though.

As an aside, there's a slight issue when I use the shortcut Shift + Enter to run a cell and go to the next cell for the notebook. It works for the first time. After that, the shortcut does nothing when used. I have to click on the cell before using the shortcut again and then the issue repeats. If I click on the button instead, I do not face this issue.

@dalthviz
Copy link
Member

dalthviz commented Dec 2, 2024

However, I am still unable to import the module "utility". I have set the custom interpreter to be pointing to my env with the installed packages. I could import other packages such as pennylane though.

Do you see any error or traceback? What happens if you try to import that module from a Python interpreter outside Spyder with your env activated?

As an aside, there's a slight issue when I use the shortcut Shift + Enter to run a cell and go to the next cell for the notebook. It works for the first time. After that, the shortcut does nothing when used. I have to click on the cell before using the shortcut again and then the issue repeats. If I click on the button instead, I do not face this issue.

Checking the spyder-notebook issue tracker, seems like an issue that could be related is open (spyder-ide/spyder-notebook#477) If you want to provide further info on that please post it over the spyder-notebook issue tracker. In general, any other issue you experience with spyder-notebook please report it over the plugin repo (https://github.com/spyder-ide/spyder-notebook). Thank you!

@JacksonPhoong
Copy link
Author

Do you see any error or traceback? What happens if you try to import that module from a Python interpreter outside Spyder with your env activated?

I get the following error both in Spyder and from cmd, ModuleNotFoundError: No module named 'utility'.

Checking the spyder-notebook issue tracker, seems like an issue that could be related is open (spyder-ide/spyder-notebook#477) If you want to provide further info on that please post it over the spyder-notebook issue tracker. In general, any other issue you experience with spyder-notebook please report it over the plugin repo (https://github.com/spyder-ide/spyder-notebook). Thank you!

Alright, I will report the issue over the plugin repo.

@dalthviz
Copy link
Member

dalthviz commented Dec 3, 2024

I get the following error both in Spyder and from cmd, ModuleNotFoundError: No module named 'utility'

Thank you for the info! One possible think to check is if the package name corresponds with the way it should be imported. Sometimes a package can have one name but to import it requires to use something different than the package name. If that is the case I think not being able to import that module is not related with Spyder and there is not much we can do from the Spyder side, sorry :/

Alright, I will report the issue over the plugin repo.

Thank you!

@JacksonPhoong
Copy link
Author

No problem. Thank you for your help thus far.

@dalthviz
Copy link
Member

dalthviz commented Dec 4, 2024

Closing since there is no much we can do from the Spyder side

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

2 participants