1

I have a simple python script which reads a text file and do some processing on it. I need to distribute this code. So any one with Ubuntu operating system could run it. I import some modules as follows.

import pandas
import httpbl
from prettytable import from_csv

etc...

My question is how to make these packages installable with my script in any other users machine(Ubuntu).

There are lot of questions asked and I found this as the closest match. But any way I do not have much knowledge on doing this.

asked Nov 8, 2013 at 6:09
4
  • ubuntu comes with python. just distribute the source code :) Commented Nov 8, 2013 at 6:13
  • @Raiyan Yes, Python is there,but other packages have to be installed? E.g.Pandas,prettytable etc. Commented Nov 8, 2013 at 6:16
  • How about making a folder for your work. Put the main python script there. Also copy the libraries into that folder. Than import the libraries in your main file from this new relative location. You can zip/gzip this entire folder and distribute your work. Commented Nov 8, 2013 at 6:18
  • Another possibility, put the entire project on github and tell you friends to download from there Commented Nov 8, 2013 at 6:18

1 Answer 1

1

You should checkout setuptools: http://pythonhosted.org/setuptools/ which can do exactly what you're looking for.

As an example (this is just a script in the same directory called "recat"):

from setuptools import setup
setup(
 name = 'recat',
 version = '0.1',
 packages = [],
 author = 'Name',
 author_email = 'email',
 description = 'Replay log files simply and easily',
 license = 'GPLv3',
 keywords = 'log replay',
 url = 'URL',
 scripts = ['recat']
)

You might also consider creating a Ubuntu package out of it. The FPM project can help you with that: https://github.com/jordansissel/fpm

answered Nov 8, 2013 at 7:09
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I'm trying on this post. stackoverflow.com/questions/9411494/…

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.