Monday, 25 April 2022

2022 -> 2024 (how to install docker-compose) Install python 3.10, ptyhon pip, docker, docker-compose installation , including upgrade python and common errors (installation)

 #Install python3.10

# https://linuxize.com/post/how-to-install-python-3-7-on-ubuntu-18-04/


sudo apt update

sudo apt install software-properties-common


sudo add-apt-repository ppa:deadsnakes/ppa

sudo apt install python3.10




python3 --version



#upgrade existing python to python3.10 

https://cloudbytes.dev/snippets/upgrade-python-to-latest-version-on-ubuntu-linux




# Install pip (package manager for python like composer for php)

#https://linuxhint.com/install_django_ubuntu/

 sudo apt install python3-pip python3-venv

 

 

# Install djagon(framework like laravel for php using pip)

# https://linuxhint.com/install_django_ubuntu/

# https://www.djangoproject.com/download/

pip install Django=4.04


# Do not run sudo pip, cause python is open source, sudo gives no permission control for install viral packages

# pip: no module named _internal (https://stackoverflow.com/questions/49940813/pip-no-module-named-internal)

python3 -m pip install --upgrade pip

# If this did not fix the issue, it will show location of pip  /usr/local/lib/python3.10/dist-packages (22.0.4)

# cd /usr/local/lib/python3.10/dist-packages/pip (Check permission )

# need chmod -R 755 /usr/local/lib/python3.10



#install docker-compose (cmd line tool to manage docker (Creates VM like containers to run application - dokcer containers)

# https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-20-04


# Install docker, docker-compose

Digital Ocean: 

Install docker:

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04

Run docker without sudo :

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04


Install docker-compose

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-20-04 (if docker-compose link does not work use the below guide)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

If the above link does not work, use the below command to download latest release, as of 2022
latest is 2.1.1, can go to release to check if newer releases are out:
(I.E if it gives cmd not found error) :
(2.24.0 is latest as of jan 17 2024)
sudo curl -L "https://github.com/docker/compose/releases/download/v2.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

continune .......
docker compose executable will be located in /usr/local/bin/docker-compose
but it need to haver docker group permission to be executable :

https://stackoverflow.com/questions/59265190/permission-denied-in-docker-compose-on-linux

sudo chmod +x /usr/local/bin/docker-compose
---------------------------------------------------------
to run docker-compose without sudo 

In addition to the comments provided in the question

sudo usermod -aG docker $USER                  # to add myself to docker group 
(this step should already been done
 if u wana to run docker without sudo in docker installation guide above)


sudo chgrp docker /usr/local/bin/docker-compose     # to give docker-compose to docker group,
sudo chmod 750 /usr/local/bin/docker-compose   # to allow docker group users to execute it

to test  run docker-compose --version



Offical documentation :

# https://docs.docker.com/compose/install

https://docs.docker.com/compose/install/compose-plugin/#install-using-the-repository

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-20-04

# Install docker compose 

https://docs.docker.com/compose/install/


# Running docker without sudo permission denied :


https://github.com/circleci/circleci-docs/issues/1323

curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-`uname -s`-`uname -m` > ~/docker-compose
chmod +x ~/docker-compose
sudo mv ~/docker-compose /usr/local/bin/docker-compose
docker-compose run test


# Python 3 apt_pkg not found issue :

// https://askubuntu.com/questions/1301461/modulenotfounderror-no-module-named-apt-pkg-whilst-running-apt-update


$ cd /usr/lib/python3/dist-packages

$ ls -la | grep "apt_pkg.cpython"

$ sudo cp apt_pkg.cpython-<what_ever_shown_in_previous>-x86_64-linux-gnu.so apt_pkg.so



#Python ImportError: cannot import name '_gi' from partially initialized module 'gi' (most likely due to a circular import)

# https://stackoverflow.com/questions/59838238/importerror-cannot-import-name-gi-from-partially-initialized-module-gi-mo

cd /usr/lib/python3/dist-packages/gi

# Local _gi.cpythin -- package 

sudo ln -s _gi.cpython-36m-x86_64-linux-gnu.so _gi.so

#cpython-36 refer to python 3.6


#Symbolic link shorthand : 

sudo ln -s apt_pkg.cpython-{35m,38m}-x86_64-linux-gnu.so


#https://askubuntu.com/questions/480908/problem-with-update-manager-no-module-named-apt-pkg-in-ubuntu-13-10-having-i

craete a symbolic link at current dir name : apt_pkg.cpython-38m-x86_64-linux-gnu.so and refer to 35m










 

 





No comments:

Post a Comment