Cannot run Notebook from within VS Code "Running cells with 'Python 3.8.0 64-bit' requires notebook."

Hi,

I have a VS Code installation where I open a jupyter notebook I have previously created in jupyter lab. When I opened it I needed to install a python extension. I can edit cells, but when I try to run anything I get an error message:
image
When I click “Install” a lot of text comes up in my VS Code terminal, but it seems to fail. It includes a message:

  ----------------------------------------
  Failed building wheel for pyzmq
  Running setup.py clean for pyzmq
Failed to build pyzmq

and ends with

    ************************************************
    Fatal: Cython-generated file 'zmq/backend/cython/_device.c' not found.
                    Cython >= 0.29 is required to compile pyzmq from a development branch.
                    Please install Cython or download a release package of pyzmq.
    
    
    ----------------------------------------
Command "/usr/bin/python3.8 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-3sj_1tuk/pyzmq/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-p58xjw9m-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-3sj_1tuk/pyzmq/
Traceback (most recent call last):
  File "/home/username/.vscode/extensions/ms-python.python-2021.8.1105858891/pythonFiles/shell_exec.py", line 26, in <module>
    subprocess.check_call(shell_args, stdout=sys.stdout, stderr=sys.stderr)
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python3.8', '-m', 'pip', 'install', '-U', 'notebook']' returned non-zero exit status 1.

I really don’t know what this means.
(I could include more if useful, but there’s a lot of it)

Either way, this process seems to fail, and when I try to run something again, the result is similar. Clicking “Change interpreter” gives me various python options, but none seem to help. There is some indicator suggesting I am running the notebook in Julia 1.6.1.

I run VS Code 1.59, and have the Julia, Jupyter, and Python extensions isntalled.

Some suggestions.
Create a blah.jl file to trigger vs-code to fire-up Julia. It then may know enough to find the Julia kernel for the notebook.

Or, exit vs-code and start the REPL from the command-line like

PYTHON=“” julia 

Which disables your environment’s Python, and causes Julia to install its own conda virtual environment when required by PyCall

Activate a local environment from the package manager
] activate .
Within the REPL package manager

] add PyCall, IJulia

If you exit the REPL and then, from the command line, start vscode local to your working directory
% code .
I think it will activate the environment you created above, which should have everything.

This is a bit of a thought experiment, and I’m not at a terminal, so no guarantees

Unfortunately it didn’t work, but thanks for the help still :slight_smile:

1 Like