1

I have developed a tool that my team can use after running the setup.py script. The tool requires this library: https://github.com/c2nes/javalang

How can I make my python setup script install this library on their computer regardless of what OS they are on. They can't run my tool without that library (Some people are on windows, mac, and linux.)

3
  • Why not include it as a requirement (install_requires) in your setup.py? Commented Oct 31, 2016 at 22:56
  • @jonrsharpe This is my first time doing this, I didn't even know about the requirements.txt file for specifying requirements and then feeding it into pip install. I didn't know you could do that - that's cool. But what if they don't have pip? Commented Oct 31, 2016 at 22:57
  • ...then they can install pip? It comes with most versions of Python (3.4 onwards), or you can run get-pip.py. Commented Oct 31, 2016 at 22:58

1 Answer 1

1

pip can install projects on Github as a dependency too!

All you need to do is, in your requirements.txt, add a line like following:

..
git+https://github.com/c2nes/javalang.git

then install the dependency using:

$ pip install -r requirements.txt

What you are looking for exists on PyPI. Instead of git+https://.. line above, just say: javalang. Oh and BTW, unless they are running old versions of Python, they should already have pip installed. If they don't use your operating systems package manager or get-pip.py as you said.

Sign up to request clarification or add additional context in comments.

4 Comments

What if they don't have pip? Is that going to be a problem.
It's on PyPI, no need to hit GitHub: pypi.python.org/pypi/javalang
So you're saying I can just say python get-pip.py if they don't have pip and then just run pip install javalang? How can I determine whether or not it's necessary to run the first command. I.e., maybe they already have pip.
@jonrsharpe: I assumed it didn't exist on pypi. I'll edit my answer. Thanks!

Your Answer

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.