3

I'm working on a project and was trying to set up a jupyter notebook to have access to the virtual environment. I set up the virtual environment just using pipenv install pandas, and that created the pipfile and the pip lock file. I then imported pandas in the jupyter notebook and tried printing out the version number, and got a ModuleNotFoundError: No module named 'pandas' error, meaning that the notebook is not connected to the virtual environment. I'm editing jupyter notebooks in vscode, and was wondering how I could connect the notebook to the pipenv environment?

1 Answer 1

2

Regarding using a virtual environment in Jyputer in VS Code and checking the python modules in this environment, you could refer to the following:

  1. Please make sure that the upper right corner of Jupyter is using the python environment you need.

  2. Please use "pip show pandas" to check whether the module "pandas" has been installed in the current environment.

In addition, since the python environment used by Jupyter in VS Code can be different from the environment used by VS Code, please check the selection of the relevant environment, and check the python environment currently used when installing the module on the VS Code terminal. (python --version or pip --version)

enter image description here

Reference: Python environments and Jupyter in VS Code.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.