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

Jupyter notebook not able to run on Conda environments #6393

Closed
sravanpannala opened this issue Jun 27, 2021 · 5 comments
Closed

Jupyter notebook not able to run on Conda environments #6393

sravanpannala opened this issue Jun 27, 2021 · 5 comments
Assignees
Labels
info-needed Issue requires more information from poster

Comments

@sravanpannala
Copy link

Issue Type: Bug

I installed Ipykernel and jupyter packages in a Conda environment. I then selected that environment as Kernel. I tried to run a simple code in a cell

x = 5
y = 4
x+y 

The kernel does load and I get this error:

Kernel died with exit code 1. C:\Users\spannala\AppData\Roaming\Python\Python39\site-packages\traitlets\traitlets.py:2196: FutureWarning: Supporting extra quotes around Unicode is deprecated in traitlets 5.0. Use 'hmac-sha256' instead of '"hmac-sha256"' – or use CUnicode.
warn(
C:\Users\spannala\AppData\Roaming\Python\Python39\site-packages\traitlets\traitlets.py:2151: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use 'f87c5fd3-18f2-4a8c-bac4-41774c9a79b3' instead of 'b"f87c5fd3-18f2-4a8c-bac4-41774c9a79b3"'.
warn(
Traceback (most recent call last):
File "C:\Users\spannala\Miniconda3\envs\NDS\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\spannala\Miniconda3\envs\NDS\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\spannala\AppData\Roaming\Python\Python39\site-packages\ipykernel_launcher.py", line 16, in
app.launch_new_instance()
File "C:\Users\spannala\AppData\Roaming\Python\Python39\site-packages\traitlets\config\application.py", line 844, in launch_instance
app.initialize(argv)
File "C:\Users\spannala\AppData\Roaming\Python\Python39\site-packages\traitlets\config\application.py", line 87, in inner
return method(app, *args, **kwargs)
File "C:\Users\spannala\AppData\Roaming\Python\Python39\site-packages\ipykernel\kernelapp.py", line 577, in initialize
self.write_connection_file()
File "C:\Users\spannala\AppData\Roaming\Python\Python39\site-packages\ipykernel\kernelapp.py", line 230, in write_connection_file
write_connection_file(cf, ip=self.ip, key=self.session.key, transport=self.transport,
File "C:\Users\spannala\AppData\Roaming\Python\Python39\site-packages\jupyter_client\connect.py", line 136, in write_connection_file
with secure_write(fname) as f:
File "C:\Users\spannala\Miniconda3\envs\NDS\lib\contextlib.py", line 117, in enter
return next(self.gen)
File "C:\Users\spannala\AppData\Roaming\Python\Python39\site-packages\jupyter_core\paths.py", line 461, in secure_write
win32_restrict_file_to_user(fname)
File "C:\Users\spannala\AppData\Roaming\Python\Python39\site-packages\jupyter_core\paths.py", line 387, in win32_restrict_file_to_user
import win32api
ImportError: DLL load failed while importing win32api: The specified procedure could not be found.

VS Code version: Code - Insiders 1.58.0-insider (49e1f9919880c1c96004f9b6ad91bcee7a94a1bd, 2021-06-25T05:14:20.119Z)
OS version: Windows_NT x64 10.0.17134
Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Xeon(R) CPU E3-1245 v3 @ 3.40GHz (8 x 3392)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.94GB (7.28GB free)
Process Argv --crash-reporter-id 6fbbf8cb-b568-4b3b-9ae7-493a124a6e21
Screen Reader no
VM 0%
Extensions (14)
Extension Author (truncated) Version
gitlens eam 11.5.1
vsc-material-theme Equ 33.2.2
vsc-material-theme-icons equ 2.0.10
vscode-pull-request-github Git 0.27.1
git-graph mhu 1.30.0
gather ms- 2021.6.0
python ms- 2021.7.969414671-dev
vscode-pylance ms- 2021.6.4-pre.1
jupyter ms- 2021.7.970869158
vscode-github-issue-notebooks ms- 0.0.102
best-dark-themes-pack the 1.0.2
vscodeintellicode Vis 1.2.14
vscode-icons vsc 11.5.0
material-theme zhu 3.10.14

(11 theme extensions excluded)

A/B Experiments
vsliv695:30137379
vsins829:30139715
vsliv368:30146709
vsreu685:30147344
python383:30185418
pythonvspyt602:30291494
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt639:30291487
pythontb:30258533
pythonvspyt551:30291412
vspre833:30321513
pythonptprofiler:30281269
vshan820:30294714
pythondataviewer:30285072
vscus158:30321503
pythonvsuse255:30319630
vscorehov:30301224
vscod805cf:30301675
pythonvspyt200:30323110
vscextlangct:30310089
vsccppwt:30312692

@sravanpannala
Copy link
Author

sravanpannala commented Jun 28, 2021

The same error is occurring with poetry virtual environments This is now fixed after totally removing Conda from the system. It seems the problem lies in conda itself.

@rebornix rebornix transferred this issue from microsoft/vscode Jun 28, 2021
@claudiaregio
Copy link
Contributor

@sravanpannala Have you tried following some of the fixes mentioned on this issue? mhammond/pywin32#1431

@claudiaregio claudiaregio added the info-needed Issue requires more information from poster label Jun 29, 2021
@sravanpannala
Copy link
Author

@claudiaregio I will take a look, but the issue here is I'm trying to use conda but VS Code is trying to load win32api from the base python. Using base python works in Jupyter notebooks, also using other virtual environments. I'm not very good at diagnosing errors so I don't understand what is going on here.

@sravanpannala
Copy link
Author

I figured out the problem. Miniconda's base python is 3.9.1, but creating a new env resulted in installing python 3.9.5. I think this is causing the problem in ipython-kernel. Restricting the python version to 3.8 while creating a new env solved the issue.

@claudiaregio
Copy link
Contributor

@sravanpannala great! Glad you were able to get that fixed :) Closing as resolved

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

4 participants