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

Plugin says server fails to start when installed in venv on Windows #398

Closed
ANP-Oxy opened this issue Mar 20, 2023 · 6 comments
Closed

Plugin says server fails to start when installed in venv on Windows #398

ANP-Oxy opened this issue Mar 20, 2023 · 6 comments
Milestone

Comments

@ANP-Oxy
Copy link

ANP-Oxy commented Mar 20, 2023

Description of your problem

What steps will reproduce the problem?

  1. create a python virtual environment
  2. install spyder with pip (latest version)
  3. install jupyter notebook with pip and install spyder-notebook extesion

What is the expected output? What do you see instead?
expected to be able to open jupyter notebooks inside spyder but it's not working

Please provide any additional information below (stack trace, screenshots, a gif, etc)
image

image

Versions and main components

  • Spyder Version: 5.4.2
  • Python Version: 3.11
  • Qt Version:
  • PyQt Version:
  • Jupyter Notebook Version:
  • Operating system: windows 10

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.10 (OK)
numpydoc >=0.6.0 : 1.5.0 (OK)
paramiko >=2.4.0 : 3.1.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.1 (OK)
qtpy >=2.1.0 : 2.3.0 (OK)
rtree >=0.9.7 : 1.0.1 (OK)
setuptools >=49.6.0 : 65.5.0 (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 : 3.0.0 (OK)
zmq >=22.1.0 : 25.0.2 (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_notebook.notebookplugin 0.4.0 : 0.4.0 (OK)

Please go to the menu entry Help > Optional Dependencies (or
Help > Dependencies), press the button Copy to clipboard
and paste the contents below:

@ccordoba12
Copy link
Member

Hey @ANP-Oxy, thanks for reporting. We really don't know what's happening in your case.

@jitseniesen, how is to possible to get the server logs in this case?

@jitseniesen
Copy link
Member

It looks like there are no more server logs. I'll try to reproduce the issue.

@jitseniesen
Copy link
Member

I treid on Windows 11 and I get the same server error message as ANP-Oxy and the notebook does not appear However, for me the "server info" does show some more messages, so I'm not totally sure it's the same error.

The error only appears when starting from a Python venv. If installing with pip in a conda virtual environment, the plugin works. Maybe the compiled JavaScript is installed in a different directory from what Spyder expects.

@ANP-Oxy Can you please answer the following:

  1. In your first step, "create a python virtual environment", do you mean with python venv?
  2. Here is something to try. After activating the virtual environment in which you installed spyder, Jupyter notebook and spyder-notebook, give the following command:
    python C:\Users\Anurag\spyder\Lib\site-packages\spyder_notebook\server\main.py path\to\notebook.ipynb
    
    Replace the last argument with the name of a notebook file. This should open a browser window with a notebook. Can you please tell me what happens?

@ANP-Oxy
Copy link
Author

ANP-Oxy commented Mar 25, 2023

@jitseniesen

  1. Yes I created the virtual environment with python venv
  2. In the Second step do you mean replace the "path\to\notebook.ipynb" with path of a existing jupyter notebook in my filesystem right?

I did that and it opened a a jupyter server on my browser.
image

But doesn't quiet look right
image

@jitseniesen
Copy link
Member

@ANP-Oxy Thank you. That's exactly the same as I am seeing, so it looks like I managed to reproduce the same issue as you are having.

I also have a hypothesis about the cause of the issue. Spyder starts another Python process using sys.executable which runs the Jupyter notebook server and then it uses the PID of that process to find the server info file. However, according to python/cpython#83086, on Windows in a venv sys.executable points to a redirector which starts the Python interpreter. This means that the PID of the process started with sys.executable is not the same as the PID of the Python process, and as a consequence Spyder does not find the Jupyter notebook server.

@jitseniesen jitseniesen changed the title the spyder notebook server failed to start Plugin says server fails to start when installed in venv on Windows Mar 25, 2023
@ccordoba12 ccordoba12 added this to the v0.4.1 milestone Mar 31, 2023
@ccordoba12
Copy link
Member

Fixed by #408.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants