6

I have recently started studying Python, using a combination of Automate the Boring Stuff by Al Sweigart and Python Programming, an Introduction Into Computer Science by John M. Zelle, if I want a deeper look. I intend to find some more complete books once I've worked through these.

I have however stumbled into a problem. Automate the Boring Stuff explains how to add modules to python using the pip tool.

I however live in rural Tennessee, where they charge $150 per month for a 1.5 mbs DSL connection (can you tell I'm a bit salty?)

This means that my only Internet connection is the mobile data on my cellphone, and that only outside the house...

Can anyone give me instructions directed towards a novice on how I might be able to download the modules using my phone, and after transferring them to the PC, what commands I should run to add them to python? Any explanations of how and why it works that way is highly appreciated as well. It is a learning experience, after all.

Thanks for your help.

aschultz
  • 1,514
  • 3
  • 15
  • 24
  • 1
    You can simply `pip install package_file.tar.gz`, once it's on your computer. How to download files on your phone and how to transfer to your computer is a) unanswerable without knowing what your phone is, and b) off topic for this site (you can ask on the sister site, [su]). – Amadan Aug 15 '19 at 04:24
  • 1
    One option could be to possibly download the module files to your mobile device from [PyPi](https://pypi.org/project/beautifulsoup4/#files) (The link is for the module `BeautifulSoup`). Then, you would have to sync your phone to your computer using an adapter to transfer the files. This process, however, may be [more difficult](https://www.maketecheasier.com/download-files-directly-into-your-iphone/) if you are using iOS. Instead of PyPi, you could also go to the Github repo of the module and download the source to your device. – Ajax1234 Aug 15 '19 at 04:27
  • 1
    Do you have a public library or Starbucks w Wifi and a laptop or one you can borrow? That seems like an easier knot to help you untangle. – JL Peyret Aug 15 '19 at 06:42
  • You might want to have a look at https://stackoverflow.com/questions/11091623/python-packages-offline-installation – Sagar Gupta Aug 15 '19 at 07:14
  • Using 'wheels' (https://pythonwheels.com/) is also an option. – Sagar Gupta Aug 15 '19 at 07:15
  • 1
    By downloading the tar files of pypi and then running them in the command line, I managed to get all the modules installed. Be warned for anyone deciding to go thia route though, it's a pain, since any dependent modules need downloaded and installed first, which for me meant a lot of running out, downloading. Plugging the phone back in and transferring... – Frank Connor Aug 15 '19 at 09:30
  • Only 2 modules wouldn't cooperate. Pyzmail requires distribute. Distribute in turn is a wrapper,for the module setuptools. Since I already have setuptools, distribute throws an error and wont install, hence no Pyzmail. The other is python-docs, which needs visual build tools. Since my computer has no internet connection, visual build tools can't be installed (the installer itself downloads the files). – Frank Connor Aug 15 '19 at 09:33
  • This might be difficult to carry out as a beginner, but further down the line there are ways to set up your own pypi server. https://www.linode.com/docs/applications/project-management/how-to-create-a-private-python-package-repository/ Again, this is more in line with downloading to another computer. And, to be honest, loading packages into that server will itself be a hassle so not sure how much this will help you and you seem to have found your own ways. More FYI. Best of luck and hats off for perseverance. – JL Peyret Aug 16 '19 at 05:36
  • Book wise, *Fluent Python* by Ramalho is a pretty good read. So is *Grokking Algorithms* which is more about algos than Python. If you’re on a budget, come Xmas/ New Year, Packt Publishing sells _everything_ for $5. Their quality is ... highly variable. Some are great, some not so much. But for $5, well worth it overall. – JL Peyret Aug 16 '19 at 05:44
  • @JL Peyret I finally managed to get both pyzmail and python-docs working, Pyzmail by making setuptools a requirement instead of distribute (since they are in essence the same thing) the other by installing it through a wheel, which meant I no longer required visual build tools to compile. I am indeed on a budget, but will keep an eye out for the books you recommended. – Frank Connor Aug 19 '19 at 03:15

1 Answers1

0

Here's a summary of the above comment thread for anyone visiting this question.

You can download the wheel files (.whl) or the archive files (.tar.gz) from pypi.org.

Once you have a wheel or an archive, you can run:

pip install name_of_wheel.whl # installs a wheel named `name_of_wheel.whl`

or, to install from an archive:

pip install archive.tar.gz # installs an archive named `archive.tar.gz`
sayan
  • 1,418
  • 16
  • 32