MediumPython on Spyder: ”ModuleNotFoundError”- A Trick | by Norberto CIOFFI | Analytics Vidhya | Medium
Sitemap
Analytics Vidhya

Analytics Vidhya is a community of Generative AI and Data Science professionals. We are building the next-gen data science ecosystem https://www.analyticsvidhya.com

Press enter or click to view image in full size

Python on Spyder: ”ModuleNotFoundError”- A Trick

3 min readDec 29, 2020

--

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].

Press enter or click to view image in full size

I used Spyder as developing environment.

Press enter or click to view image in full size

But when launching the script I received the error: “ModuleNotFoundError”

Press enter or click to view image in full size

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:

Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size

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

--

--

Norberto CIOFFI
Norberto CIOFFI

Written by Norberto CIOFFI

Engineer and Business Analyst living in Geneva (CH). Working on Data Analysis and AI & ML. Passionate about Space

Analytics Vidhya
Analytics Vidhya

Published in Analytics Vidhya

Analytics Vidhya is a community of Generative AI and Data Science professionals. We are building the next-gen data science ecosystem https://www.analyticsvidhya.com