Imported package not available in Jupyter-Python
Asked Answered
R

2

6

Importing pysftp into Jupyter Notebook

While importing pysftp into Jupyter Notebook, ModuleNotFoundError is shown.

JupyterSnapshot


Checking import of pysftp on device?

I have verified the package installation with

pip list and pip show pysftp

Had imported pysftp package(v0.2.9) and installed it in the below location

C:\users\xxxxxx\appdata\roaming\python\python37\site-packages

pysftp_lib

Check : Package installed OKAY


Check about package correct path linking from cmd prompt?

I'm using Python 3.7.0 on a WIN machine, verifyed the site package location using

import sys and sys.path

image confirms linking of PATH to correct location and the package is successfully executed when python is run through cmd prompt

Python Snapshot

Check : Path link and cmd run OKAY


Now could anyone help me solve why the package import in Jupyter Notebook is throwing an error?

Thank you


Edit 1: Check for different environment installed? added based on one of the answer

Conda Environment

Only one environment is present in the machine

Rhadamanthus answered 21/9, 2018 at 6:7 Comment(0)
O
1

I got the same. I solved by installing directly within Jupyter using the following command:

import sys
!{sys.executable} -m pip install dice-ml
Osteoporosis answered 7/1, 2021 at 17:54 Comment(0)
M
1

Are you running the notebook through a virtual environment?

You can try running the same commands as you did on CMD by preceding it with ! as follows:

!pip list

Ideally this should list the same contents as shown in CMD. However the results may be different if you are running Jupyter notebook in a virtual environment. If you are unable to see pysftp, you need to install it within the virtual environment. This can be done from within your notebook as:

!pip install pysftp

Missioner answered 21/9, 2018 at 6:58 Comment(2)
No virtual environment present. Checked for same on anaconda prompt. Updated snapshot in edits of the Qn. Could you now suggest an alternative solution.? -@anoopRhadamanthus
Could you do a pip list within the Anaconda Prompt window as seen in your Edit 1 screenshot (as against the earlier screenshots that were made directly in CMD)?Missioner
O
1

I got the same. I solved by installing directly within Jupyter using the following command:

import sys
!{sys.executable} -m pip install dice-ml
Osteoporosis answered 7/1, 2021 at 17:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.