conda-forge / cupy-feedstock

A conda-smithy repository for cupy.
BSD 3-Clause "New" or "Revised" License
5 stars 23 forks source link

No module named 'cupy' in JupyterLab version 3.2.1 #164

Closed ChenWuOtt closed 2 years ago

ChenWuOtt commented 2 years ago

Issue: I installed anacoda3, then create an environment, after that I installed cupy using conda install -c conda-forge cupy (see the conda list below). I start python, and import cupy as cp, it works well. Then I start Jupyter Lab, select right kernel, which relates to the environment just created. In the notebooks first cell has: import numpy as np import matplotlib.pyplot as plt import cupy as cp %matplotlib widget

I get:

ModuleNotFoundError Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_52572/2481984725.py in 1 import numpy as np 2 import matplotlib.pyplot as plt ----> 3 import cupy as cp 4 get_ipython().run_line_magic('matplotlib', ' widget') 5 import time

ModuleNotFoundError: No module named 'cupy'

I really do not know this is JupyterLab problem or Cupy problem?! can you help? I also ask the same question to JupyterLab. they suggested reinstall everything. I did remove anaconda and related environments, reinstall everything as I give above, but still get the same "No module named 'cupy' ". JupyterLab version is 3.2.1


Environment ( conda list:bzip2 1.0.8 h8ffe710_4 conda-forge ca-certificates 2021.10.8 h5b45459_0 conda-forge cudatoolkit 11.6.0 hc0ea762_10 conda-forge cupy 10.1.0 py310h782d1bb_1 conda-forge fastrlock 0.8 py310h8a704f9_1 conda-forge intel-openmp 2022.0.0 h57928b3_3663 conda-forge libblas 3.9.0 13_win64_mkl conda-forge libcblas 3.9.0 13_win64_mkl conda-forge libffi 3.4.2 h8ffe710_5 conda-forge liblapack 3.9.0 13_win64_mkl conda-forge libzlib 1.2.11 h8ffe710_1013 conda-forge mkl 2022.0.0 h0e2418a_796 conda-forge numpy 1.22.2 py310hcae7c84_0 conda-forge openssl 3.0.0 h8ffe710_2 conda-forge pip 22.0.3 pyhd8ed1ab_0 conda-forge python 3.10.2 hcf16a7b_3_cpython conda-forge python_abi 3.10 2_cp310 conda-forge setuptools 60.9.3 py310h5588dad_0 conda-forge sqlite 3.37.0 h8ffe710_0 conda-forge tbb 2021.5.0 h2d74725_0 conda-forge tk 8.6.12 h8ffe710_0 conda-forge tzdata 2021e he74cb21_0 conda-forge ucrt 10.0.20348.0 h57928b3_0 conda-forge vc 14.2 hb210afc_6 conda-forge vs2015_runtime 14.29.30037 h902a5da_6 conda-forge wheel 0.37.1 pyhd8ed1ab_0 conda-forge xz 5.2.5 h62dcd97_1 conda-forge):

``` - $ ```


Details about conda 4.10.3 and system ( active environment : cupyBFFT active env location : P:\anaconda3\envs\cupyBFFT shell level : 2 user config file : C:\Users\Chen.condarc populated config files : C:\Users\Chen.condarc conda version : 4.10.3 conda-build version : 3.21.6 python version : 3.9.7.final.0 virtual packages : cuda=11.5=0 win=0=0 __archspec=1=x86_64 base environment : P:\anaconda3 (writable) conda av data dir : P:\anaconda3\etc\conda conda av metadata url : None channel URLs : https://conda.anaconda.org/conda-forge/win-64 https://conda.anaconda.org/conda-forge/noarch https://repo.anaconda.com/pkgs/main/win-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/win-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/win-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/msys2/win-64 https://repo.anaconda.com/pkgs/msys2/noarch package cache : P:\anaconda3\pkgs C:\Users\Chen.conda\pkgs C:\Users\Chen\AppData\Local\conda\conda\pkgs envs directories : P:\anaconda3\envs C:\Users\Chen.conda\envs C:\Users\Chen\AppData\Local\conda\conda\envs platform : win-64 user-agent : conda/4.10.3 requests/2.26.0 CPython/3.9.7 Windows/10 Windows/10.0.19042 administrator : False netrc file : None offline mode : False ):

``` $ conda info ```
leofang commented 2 years ago

Most likely your Jupyter is installed in a different conda/python env from the one that has CuPy installed. This is definitely neither a CuPy nor a JupiterLab problem.

ChenWuOtt commented 2 years ago

leofang: many thanks for your comment. yes, I found https://github.com/jupyter/notebook/issues/1524 which tells the same problem, and gives solution.

jakirkham commented 2 years ago

This blogpost might also be a nice read