6

How do I install Python Flask without using pip?

I do not have pip, virtualenv nor easy_install.

The context of this question is that I am on a tightly controlled AIX computer. I cannot install any compiled code without going through several layers of management. However, I can install python modules.

Python 2.7 is installed.

I have some existing python code that generates a report.

I want to make that report available on a web service using Flask.

I am using bottle, but I am going to want to use https, and support for https under Flask seems much more straight forward.

I would like to put the flask library (and its dependencies) into my project much like bottle is placed into the project.

What I tried: I downloaded the flask tarball and looked at it. It had quite a bit of stuff that I did not know what to do with. For instance, there was a makefile.

Be Kind To New Users
  • 9,672
  • 13
  • 78
  • 125
  • possible duplicate of [How to manually install a pypi module without pip/easy\_install?](http://stackoverflow.com/questions/13270877/how-to-manually-install-a-pypi-module-without-pip-easy-install) – rnevius Apr 21 '15 at 06:41

4 Answers4

9

Yes you can but it will be little difficult.

get flask source code from this and Extract it.

https://pypi.python.org/packages/source/F/Flask/Flask-0.10.1.tar.gz

There will be a file with name setup.py in that you can see dependencies , I listed them here. download those packages and install them first.

'Werkzeug>=0.7',    https://pypi.python.org/packages/source/W/Werkzeug/Werkzeug-0.10.4.tar.gz
'Jinja2>=2.4',  https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.7.3.tar.gz
'itsdangerous>=0.21' , https://pypi.python.org/packages/source/i/itsdangerous/itsdangerous-0.24.tar.gz
MarkupSafe==0.23 ,https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.23.tar.gz

download all those from pypi and install using python setup.py install for every module.

Now you can install flask by running python setup.py install in the flask source code folder.

Now you system is acquainted with flask.

:-)

manikantanr
  • 574
  • 3
  • 13
  • 2
    And note that installing `setuptools` (as mentioned in the previous comment) means that you can now use `easy_install`... – rnevius Apr 21 '15 at 07:17
  • Please note that you may need to install `MarkupSafe` before installing `Jinja2`. – Nuhman Feb 07 '20 at 11:14
2

On Debian-based systems you can install with Apt.

For Python 3.x use:

sudo apt-get install python3-flask

For Python 2.x use:

sudo apt-get install python-flask
davidism
  • 121,510
  • 29
  • 395
  • 339
Monk
  • 33
  • 6
0

One way to go around the problem is to use another machine with pip installed on which you can download all dependencies.

On this first machine you would then run these commands below

$ mkdir myapp
$ pip install flask --target ./myapp

Then transfer the myapp folder to the AIX machine.

Then develop your program inside the myapp folder as this is the only place flask will be accessible. Unless you setup the environment path accordingly.

Noel
  • 3,749
  • 3
  • 22
  • 21
-1

You can try with wheel pacakges .