Python on Spyder: ”ModuleNotFoundError”- A Trick
Or how forcing imported modules with pip on the editor and get along with the error
by Norberto Cioffi
— -
A few days ago I wrote a basic script on Python to download some playlists from Youtube[1].
I used Spyder as developing environment.
But when launching the script I received the error: “ModuleNotFoundError”
It seems a common problem for many that, when importing via “pip install module_xxx” missing Python modules on a local machine, by default they are not linked with Spyder. Some references on how to structure and organize the job in a formal way can be found here[2].
Get Norberto CIOFFI’s stories in your inbox
Join Medium for free to get updates from this writer.
But today I am proposing a fast trick to get along with the issue for a basic and fast resolution. (Always easy when you know how to make it, right :) ?) Some references are here[3].
In fact, it is enough to set up on “Tool/PYTHONPATH manager” on Spyder the path of where your local machine is downloading and storing the installed modules via pip, save, close and re-launch Spyder.
Easy, no? :) Here some screenshots for guidance:
Hoping this will help people who got stuck as I was a few afternoons ago, while outside it was a sunny day and a perfect opportunity for a walk around the lake (of the city where I live).
Bye :)
— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
[1] Some references on the code can be found here https://pypi.org/project/pytube/ and here https://dev.to/spectrumcetb/download-a-whole-youtube-playlist-at-one-go-3331
[2] Here a wiki tutorial link: https://github.com/spyder-ide/spyder/wiki/Working-with-packages-and-environments-in-Spyder#installing-packages-into-the-same-environment-as-spyder
[3]Read all the Stackoverflow page, comments included: https://stackoverflow.com/questions/10729116/adding-a-module-specifically-pymorph-to-spyder-python-ide











