This year I've been working with IntelliJ so much that I decided to pay a little more and get the "All Packs" edition so I could use JetBrains IDEs with Python and .Net. When I completed a Coursera course on Machine Learning, I wanted to have the Jupyter notebooks on my laptop so I'd have access to the materials in case I stopped my Coursera subscription. The Jupyter notebooks for the course are a very good resource as I develop my own products that use machine learning, and I wanted them available on my Mac and Pycharm.
Below are the steps and resources I used to: download the Jupyter notebooks and execute them on my MacBook. Mac or Windows won't impact the steps much. The I also included references to the resources I used work out what I needed to do but viewing them are not necessary as I'm showing the steps. It took an hour to work out how to do this so hopefully this article will speed you along.
Tool chain: Web browser, Pycharm. (Community edition of Pycharm doesn't allow execution of notebooks. I have the paid/Pro edition, which isn't very much for an individual developer.)
1) Download the entire lab files necessary to run the notebook
It's possible to just download and run a notebook but in my case, each notebook had dependencies with files outside of the notebook file (.ipynb file). This required me to downloaded all the lab files. This is likely a common situation so you'll probably need to do this too. You'll know this is your case if when you look at the import statements in your notebook, you'll see items it's getting from custom modules that are available only as part of the notebook environment and cannot be pip installed later.
![]() |
An example of a notebook using custom modules |
The following steps will produce a Zip file of the lab. Unzip the files to a location where you wish to keep this work.
Optional Reading:
2) Create a Pycharm project at that location. I used the "create venv" for interpreter.
![]() |
Expanded the Zip file and moved the contents of the Files directory up one level. |
Create the Pycharm project
Optional viewing:
3) Add dependencies that you know of into the Requirements.txt
![]() |
This is an alternative to hand editing the Requirements.txt file. |
4) Operate the notebook
![]() |
This is an example. |
No comments:
Post a Comment