While importing pysftp into Jupyter Notebook, ModuleNotFoundError is shown.
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
Check : Package installed OKAY
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
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
Only one environment is present in the machine
Type in jupyter notebook in the terminal. Open a new notebook and import sys . The important step is to add the path of your virtual environment site packages to the system path. The ./ is a relative path and assumes that you are currently in your virtual environment directory.
To use python environments you've created on the command line in a Jupyter notebook, you'll need to create what is known as a 'kernel' for the environment. This allows Jupyter to see and use the corresponding environment.
I got the same. I solved by installing directly within Jupyter using the following command:
import sys
!{sys.executable} -m pip install dice-ml
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With