Installing Python 2.7 Without Root

How to install Python 2.7.10 installation without root/sudo permission and internet connection?

Use miniconda to install a standalone python. Then create environments as needed using the miniconda tool (conda).

See this answer for example usage.

If you already have a python installed (maybe the system python), you can skip downloading miniconda and use virtualenv to create standalone environments instead.

You can then use pip to install the packages that you need.

How to build Python 3.5.2 from source without root

I have found a solution. You should install all packages in common directory

sqlite3 installation:

./configure --prefix=/path/to/python/installation/homedir
make -j && make install

tcl installation:

./configure --prefix=/path/to/python/installation/homedir
make -j && make install

tk installation:

./configure --prefix=/path/to/python/installation/homedir --with-tcl=/path/to/tcl/source/tcl8.6.8/unix
make -j && make install

Before Python installation you should set environment variables:

export LD_LIBRARY=/path/to/python/installation/homedir/lib
export TK_LIBRARY=/path/to/python/installation/homedir/lib

Edit setup.py file and add path to sqlite3 lib to array:

sqlite_inc_paths = [ '/usr/include',
'/usr/include/sqlite',
'/usr/include/sqlite3',
'/usr/local/include',
'/usr/local/include/sqlite',
'/usr/local/include/sqlite3',
'/path/to/python/installation/homedir/include',
]

And Python installation:

./configure \
--prefix=path/to/python/installation/homedir \
make -j && make install

After that all should make correct.

Could not install packages due to an EnvironmentError: [Errno 13]

If you want to use python3+ to install the packages you need to use pip3 install package_name

And to solve the errno 13 you have to add --user at the end

pip3 install package_name --user

EDIT:

For any project in python it's highly recommended to work on a Virtual enviroment, is a tool that helps to keep dependencies required by different projects separate by creating isolated python virtual environments for them.

In order to create one with python3+ you have to use the following command:

virtualenv enviroment_name -p python3

And then you work on it just by activating it:

source enviroment_name/bin/activate

Once the virtual environment is activated, the name of your virtual environment will appear on left side of terminal. This will let you know that the virtual environment is currently active.
Now you can install dependencies related to the project in this virtual environment by just using pip.

pip install package_name

How to install python 2.7 in linux in local directory without admin rights?

Try: ./configure prefix=/x/y and then make install.

Then add the path /x/y/bin in .bashrc as:

PYTHONPATH=/home/something/python/bin
export PATH=$PYTHONPATH:$PATH

How to install python modules without root access?

In most situations the best solution is to rely on the so-called "user site" location (see the PEP for details) by running:

pip install --user package_name

Below is a more "manual" way from my original answer, you do not need to read it if the above solution works for you.


With easy_install you can do:

easy_install --prefix=$HOME/local package_name

which will install into

$HOME/local/lib/pythonX.Y/site-packages

(the 'local' folder is a typical name many people use, but of course you may specify any folder you have permissions to write into).

You will need to manually create

$HOME/local/lib/pythonX.Y/site-packages

and add it to your PYTHONPATH environment variable (otherwise easy_install will complain -- btw run the command above once to find the correct value for X.Y).

If you are not using easy_install, look for a prefix option, most install scripts let you specify one.

With pip you can use:

pip install --install-option="--prefix=$HOME/local" package_name

Issues installing Python library with binary dependency in virtualenv without sudo

You need to pass custom location of installed headers & shared objects when pip installing the python bindings:

$ CPPFLAGS='-I/home/ec2-user/environment/my_env/include' \
LDFLAGS='-L/home/ec2-user/environment/my_env/lib' pip install ta-lib

How to install PIP on Python 3.6?

pip is bundled with Python > 3.4

On Unix-like systems use:

python3.6 -m pip install [Package_to_install]

On a Windows system use:

py -m pip install [Package_to_install]

(On Windows you may need to run the command prompt as administrator to be able to write into python installation directory)

Python 2.7 No module named _sqlite3 (no root access to machine, python is locally installed)?

This happened me recently. You need to apt-get install libsqlite3-dev (on debian - sqlite-devel possibly elsewhere) and recompile python.



Related Topics



Leave a reply



Submit