Issue
I have been using Jupyter notebook for a while now and its worked fine, I tried downloading Spyder today and a lot of the packages I installed on terminal won't work on Spyder, for example pandas_datareader works fine in Jupyter notebook but it won't work on Spyder I get a module not found error when I try to import it. I tried updating the packages as well as deleting then reinstalling and it still won't work. I downloaded Spyder from the spyder-ide.org website. Thanks for any help you can give.
Solution
It is common problem.
You may have two Pythons installed and you use Jupyter
with one Python but Spyder
may use other Python.
Different Pythons don't share modules.
Run in Spyder
and Jupyter
import sys
print( sys.executable )
to see full path to Python used in Spyder
and Jupyter
and then you can use
/full/path/to/python -m pip install ...
to install modules in correct Pythons.
You may also check in Spyder's settings if you can set path to Python used in project - this way you may change Python and use version which has installed modules. This way you can also use different Pythons (with different modules) in different projects (ie. use virtual environments in projects - venv
)
I assumed that Jupyter
doesn't means Google Colab which runs Jupyter
on Google's server and it install modules on this server - but Spyder runs on local computer.
Answered By - furas
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.