JetBrains DataSpell ModuleNotFoundError error when package is installed

Viewed 1265

I use ipynb-file. When I try to import prophet library I get this:

ModuleNotFoundError: No module named 'prophet'.

But this package is installed and it is in my current environment. Jupyter server's interpreter have prophet library. When I move cursor to name of library, DataSpell shows its info:

screenshot

If I execute from prophet import Prophet in python console everything is OK! I think problem is in Jupyter notebook, but can't find it.

1 Answers

Ran into this recently. This answer set me on the right track.

jupyter was also installed in one of my default Ubuntu python environments, and DataSpell was spinning up a server using that binary instead of the one installed in the environment I'd created in DataSpell.

(As a coincidence, that default environment also had common packages like pandas installed, so I didn't run into this till I installed a package in the DataSpell-managed environment that wasn't already in my Ubuntu default python environment.)

  • I found the default jupyter binary: which jupyter.
  • Inspected the script: nano /home/<user>/.local/bin/jupyter
  • Saw the python environment it was installed in: #!/usr/bin/python3.8 at the top of the script
  • Uninstalled jupyter from that environment: python3.8 -m pip uninstall jupyter

And then DataSpell used the correct jupyter binary (and all imports worked fine).

Related