Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions about setting up a local development environment #11

Open
ehmatthes opened this issue Sep 23, 2013 · 24 comments
Open

Questions about setting up a local development environment #11

ehmatthes opened this issue Sep 23, 2013 · 24 comments

Comments

@ehmatthes
Copy link
Owner

The readme is pretty sparse right now, so if you are trying to get involved and have any questions about setup, please feel free to ask them here.

ehmatthes added a commit that referenced this issue Sep 23, 2013
@akkartik
Copy link

I just followed the steps and ran the notebook. The index page looks good, but is this how it's supposed to look when I click on hello_world?

hello

@ehmatthes
Copy link
Owner Author

Here's what I see:

hello_world

I think you are using an older version of IPython Notebook than I am. I started the project using the standard Ubuntu 12.04 versions of ipython and ipython-notebook. That worked for the code that runs the same under 2.7 and 3.3. When I did the section on floats, I needed to run 3.3 in IPython Notebook.

At that point I installed ipython3, and ipython3-notebook. For most development on this project now, I run ipython3 notebook, and only run 2.7 when I am writing up specific examples about 2.7.

I have updated the readme to show how I installed ipython3-notebook on Ubuntu 12.04. I think if you install ipython3-notebook, or the appropriate version of that for your system, you will see what I see.

When I updated my versions of ipython-notebook and ipython3-notebook and then opened the notebooks for the first time, I got a message that the notebooks would no longer be compatible with older versions of ipython notebook.

Hope that helps, and please let me know how it turns out.

@akkartik
Copy link

Noooo, not python 3 again.. :(

@ehmatthes
Copy link
Owner Author

Noooo, not python 3 again.. :(

Ha ha! I'm not sure if you're saying that from a teacher, student, or developer perspective, but I'd be curious to hear.

Student perspective

I focused on Python 3 because I am building these notebooks for teaching people brand new to programming. The thinking is, people who are just starting to program are going to spend more time in Python 3 than Python 2. They don't have any legacy projects they need to maintain, and they don't have any packages they are trying to use that depend on Python 2. Anyone who can code in Python 3 is going to learn Python 2 syntax quickly and easily if they take on a project that requires Python 2.

So, with students I have them learn Python 3 until they find themselves needing Python 2. I am finding it's good to bring myself up to speed with Python 3 as well.

Contributing to this project

I think someone could contribute to this project without ever touching Python 3, because most of the code is compatible with Python 2. The project code might be different, but at that point it might be good to make separate dedicated notebooks for each project in Python 2 and Python 3.

If anyone is staying away from this project just because of Python 3 issues, please let me know and we'll see if there's a straightforward way to address your concerns.

Thanks!

@ehmatthes
Copy link
Owner Author

@akkartik, I think I just have a newer version of ipython notebook than you. I don't really think what you are seeing is a python 2/ python 3 issue.

@akkartik
Copy link

I think the problem might be that your instructions are in terms of apt-get, but my distro doesn't support the versions you indicate. It would suck to have to upgrade the OS just to install a tool to learn programming. Perhaps you could show how to install the right ipython-notebook in a virtualenv?

(I'm trying to figure this out as well. I've been stumped a few times by versioning issues, but hopefully I'll sort it out this time.)

@ehmatthes
Copy link
Owner Author

Thanks, I'll take a look at this shortly. What system/ distro are you on?

@akkartik
Copy link

I'm on ubuntu (12.04 precise). Pretty vanilla otherwise.

@ehmatthes
Copy link
Owner Author

All right, I just installed a fresh version of 12.04 in virtualbox, so I could test out the directions on a fresh install. These notebooks just require a later version of ipython and ipython notebook than the standard 12.04 packages. This should get you up and running:

$ sudo apt-get install ipython=0.13.2-1~ubuntu12.04.1
$ sudo apt-get install ipython-notebook=0.13.2-1~ubuntu12.04.1
$ git clone https://github.com/ehmatthes/intro_programming
$ cd intro_programming/notebooks
$ ipython notebook

You should not have to uninstall the current versions of ipython and ipython-notebook; this will update your versions of both packages. Can you let me know if that works? You shouldn't have to do anything with Python 3, except for one or two sections in the whole project.

@akkartik
Copy link

It worked!! Many thanks, Eric, and sorry for being grouchy. I look forward
to playing more with this.

@ehmatthes
Copy link
Owner Author

No matter, I've been meaning to get virtualbox set up for a while now. I'm happy to answer more questions, so please don't hesitate to ask.

@akkartik
Copy link

I had no idea you could install later versions than the default with apt-get (no tinkering with ppas, etc.) Thanks for the insight.

Oh well, I guess I'll punt on installing the right versions inside a virtualenv. One of these days I'll figure out how to do that.

@ehmatthes
Copy link
Owner Author

I got ipython notebook running in a virtualenv using Python 2.7:

$ git clone https://github.com/ehmatthes/intro_programming
$ cd intro_programming
$ virtualenv --distribute venv
$ source venv/bin/activate
$ pip install ipython[all]
$ cd notebooks
$ ipython notebook

This worked for me, and it was really interesting. This installs version 1.1.0 of ipython, which includes ipython-notebook. This is a newer version than what I have in the readme, and I like it better than the 0.13 release.

I did not get Python 3.3 running in the virtualenv.

I will look at updating the readme to use the 1.1.0 release of ipython. Thanks again for pushing this issue.

@bkamapantula
Copy link
Contributor

Hi @ehmatthes! I ran iPython using the comments you made in #11 (comment). It ran fine. I shutdown the server and try to run again but iPython wouldn't run.

I re-ran the commands again and iPython runs fine. Should iPython execute always in the virtualenv?

@ehmatthes
Copy link
Owner Author

I have just opened this project for the first time in several months. I activate my virtualenv before running ipython. So I think the answer is yes, but I'm not quite sure.

Do you want your ipython to be running python2.7 or python3?

Edit: I'm going to hit this project hard again in August/ September, the next time I teach a full Python class. One of my goals then is to update the project to IPython 2.x. I will do a full revision of the readme by then, if not earlier.

If anyone wants to work on introtopython and is having trouble getting a dev environment set up in the meantime, please don't hesitate to ask, and I will get on this sooner.

  • Eric

@bkamapantula
Copy link
Contributor

I am planning to shift to python3 completely (most of my development is still in 2.7). Hence, ipython with python3.

I tried using iPython before but not with much success. Hoping to improve my ipython skills with this project.

@ehmatthes
Copy link
Owner Author

IPython is pretty awesome, and it is under rapid development at this point. I'm happy to answer any questions you have, especially in regards to playing with this project.

I ran iPython using the comments you made in #11 (comment). It ran fine. I shutdown the server and try to run again but iPython wouldn't run.

I re-ran the commands again and iPython runs fine. Should iPython execute always in the virtualenv?

To be clear, yes I think you need an active virtualenv if you are taking the approach in #11. In this approach, IPython is installed into the virtualenv, and will only run when that virtualenv is active.

@bkamapantula
Copy link
Contributor

Thank you. I shall read more about IPython and virtualenv.

@karthikraman
Copy link

Amazing notebooks; thank you so much. I'll be using parts of this to teach a Data Structures course this semester...

@ehmatthes
Copy link
Owner Author

@karthikraman Thanks, that's good to know! If you have any questions or suggestions as you're using the notebooks, feel free to let me know. I'll probably be doing some significant work on the project again this fall when I'm teaching my next Python class. If there's anything you need before then, let me know.

What kind of students are you working with?

@karthikraman
Copy link

I am working with students who don't have a background in Python, but have been exposed briefly to C. The class itself is "Data Structures and Algorithms for Biology", but Python is the language of choice. I teach Python for about 5-6 classes, before introducing data structures, algos and how they're applied in biology. My class is a mix of students, mostly majoring in Biological engineering, but a few others as well (Chemical etc.). Your notes are brilliant. I am making a much more concise notebook, and pointing to your notes in many sections, for more details!

@glupyan
Copy link

glupyan commented Dec 28, 2017

Thanks so much Eric! Did you make the tables of contents for each notebook by hand or is there a handy script for it?

It looks like there is a Jupyter extension for making dynamics tables of contents, but using that extension breaks the ability to send the notebooks through your template. Thanks for your help!

@ehmatthes
Copy link
Owner Author

Hi @glupyan, I did write the toc for each notebook by hand. It never occurred to me to automate that!

I keep meaning to go back to this project, but I'm teaching way more math and science than programming these days and I haven't been able to make time for this. But I'm teaching a short Make Your Own PhotoFilter class this week and next, and I'm using jupyter notebooks to teach that class. Hopefully I can add that project notebook to this site. That was the original goal, to make it an easy place to collect interesting projects.

Thanks for reaching out!

@aryabhatta000
Copy link

Eric, Firstly, great job. I tried following your instructions word by word under section Using virtualenv to set up a development environment and it got me far along though with its unique set of challenges.

Hereby, I would like to list out some of the challenges, so that it can help others:

  1. "pip install virtualenv" latest version path - to activate virtual environment is now "source venv/scripts/activate".

  2. the paths_to_notebooks in python scripts file intro_programming/scripts/-file-.py had to be updated to ../notebooks such that script would run smoothly.. for my system was unable to find the other path "srv/projects/intro_programming...."

  3. after updating the paths, within the same python scripts file the next trouble I encountered was Codec: Charset Error some unicode error with file.readlines() method, which was easily fixed by updating immediately preceding filename.open() method with adding another parameter encoding=UTF-08, which has been done diligently in other parts of the code.

I wasn't sure if these were all bugs or intentionally like that, anyways I went ahead updated all the files and created a pull request, so its easier for next person tweaking with LocalHosting using your codes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants