Installing python 3.9 on Cloudera CDSW without sudo - python

I am trying to install Python 3.9 on Linux 4.4 in Cloudera Data Science Workbench (cdsw).. I do not have sudo rights and I wont be able to connect to any websites.
The current version of python is 3.6
Following the procedure as mentioned here.
However, on step "sudo make altinstall" I get the error "permission denied" on /usr/local/bin
Is there any workaround to make this step work?
This is the last step of the whole procedure.

You can use the method on top and install using apt... It's the best way to do it,
sudo apt update
sudo apt install software-properties-common
Followed by adding the repository,
sudo add-apt-repository ppa:deadsnakes/ppa
Accept the changes, then
sudo apt install python3.9
Now, whenever you want to use python3.9 you have to invoke python3.9 instead of python3.
If you are using cloudera, cdsw, you cannot get sudo rights, you need to follow this guide to install packages,
https://docs.cloudera.com/documentation/data-science-workbench/1-8-x/topics/cdsw_extensible_engines.html
Follow the guide above, then change the docker file like this
# Dockerfile
FROM docker.repository.cloudera.com/cdsw/engine:8
RUN rm /etc/apt/sources.list.d/*
RUN apt-get update
RUN apt install software-properties-common
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt install python3.9 python3-pip \
&& rm /etc/apt/sources.list.d/*
RUN pip install pandas numpy
Then follow the rest of the guide for steps 2-4, you should be able to get your desired outcome.

Related

upgrade python offline - ubuntu apt

I have an Ubuntu VM without internet access. It currently has Python 3.10 installed but I want to update to Python 3.11 (the latest at the time of this post).
On a machine with internet access, I used apt to download Python3.11.
mkdir python_3.11
apt-get --download-only -o Dir::Cache="./python_3.11/" -o Dir::Cache::archives="./python_3.11/" install python3.11
$ ls python_3.11
libpython3.11-minimal_3.11.0~rc1-1~22.04_amd64.deb pkgcache.bin
libpython3.11-stdlib_3.11.0~rc1-1~22.04_amd64.deb python3.11-minimal_3.11.0~rc1-1~22.04_amd64.deb
lock python3.11_3.11.0~rc1-1~22.04_amd64.deb
partial srcpkgcache.bin
After transferring the files onto the VM, I tried running sudo dpkg -i on each of the files. This eventually "installed" them but opening a python shell still shows the old 3.10 version. /usr/bin/python3 still points to /usr/bin/python3.10 and this is no /usr/bin/python3.11.
Another thing I've tried
# on the machine im trying to install
sudo apt-get update -oDir::Cache::archives="/path/to/downloaded/packages" --no-install-recommends --no-download
sudo apt-get -oDir::Cache::archives="/path/to/downloaded/packages" --no-install-recommends --no-download install python3.11-minimal
This ends up returning
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
I've since added the following to the download command. python3.11-minimal libpython3.11-stdlib python3.11 libpython3.11-minimal python3.11-venv python3.11-doc binfmt-support python3-pip-whl python3-setuptools-whl. During the install, I'm still getting the same error message on "Unable to fetch some archives".
There are 2 commands that need to be run. I'm not 100% sure the first one (the update) is necessary. It is important that the paths are absolute. Assuming the required packages have been downloaded, it should install.
apt-get -oDir::Cache::archives="/absolute/path/" -oDir::Cache="/absolute/path" --no-install-recommends --no-download update
apt-get -oDir::Cache::archives="/absolute/path/" -oDir::Cache="/absolute/path/" --no-install-recommends --no-download install python3.11

"E: Unable to locate package python-pip" on Ubuntu 18.04 [duplicate]

This question already has answers here:
Unable to install pip in ubuntu?
(2 answers)
Closed 1 year ago.
I am trying to install virtualenv on Ubuntu.
First it said command 'pip' not found, so I typed
sudo apt install python-pip
then it said
E: Unable to locate package python-pip
I tried to reset WSL, download using cmd but it doesn't work with Ubuntu. I don't know why. Even though I have downloaded python3, virtualenv, and pip using cmd. It doesn't work with Ubuntu 18.04. It also fails on Ubuntu 14.04.
aiki#LAPTOP-886AEJJG:~$ pip
Command 'pip' not found, but can be installed with:
sudo apt install python-pip
aiki#LAPTOP-886AEJJG:~$ sudo apt install python-pip
[sudo] password for aiki:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-pip
I'm trying to install jarvis and mycroft on win 10, but I need to use Ubuntu because it only works with Linux.
ls /bin/python*
Identify the highest version of python listed.
If the highest version is something like python2.7 then install python2-pip
If its something like python3.8 then install python3-pip
Example for python3.8:
sudo apt-get install python3-pip
Try following command sequence on Ubuntu terminal:
sudo apt-get install software-properties-common
sudo apt-add-repository universe
sudo apt-get update
sudo apt-get install python3-pip
Try the following commands in terminal, this will work better:
apt-get install curl
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
python get-pip.py
On some kind of Linux, like distros based on Debian, you might want to consider updating your 'apt-get' first, in case you are installing python-pip through it.
sudo apt-get update
This might help apt-get to update its indexes and locate the python-pip package.
After this, u might install it like this-
sudo apt-get install python-pip (Python2)
sudo apt-get install python3-pip (Python3)
You might have python 3 pip installed already. Instead of pip install you can use pip3 install.
To solve the problem of:
E: Unable to locate package python-pip
you should do this. This works with the python2.7 and you not going to get disappointed by it.
follow the steps that are mention below.
go to get-pip.py and copy all the code from it.
open the terminal using CTRL + ALT +T
vi get-pip.py
paste the copied code here and then exit from the vi editor by pressing
ESC then :wq => press Enter
lastly, now run the code and see the magic
sudo python get-pip.py
It automatically adds the pip command in your Linux.
you can see the output of my machine
I'm using WSL2 on Windows 10 and I had the same issue. Try the way which helped me to fix this. I assume that you are using python3.
python3 get-pip.py
sudo apt install python3-pip

How to install Python 3.5.5?

When I run apt-get -y install python3, it installs Python 3.5.2. How can I install Python 3.5.5?
Just to mention that I run these commands in Docker:
RUN apt-get update
RUN apt-get -y install python3 python3-pip wget default-jre
RUN pip3 install --upgrade pip
RUN pip3 install virtualenv
Thanks.
Two options:
You'll need to find a repository that has that version and add the repository in your container build script. There's a nice explanation of how to add a repository for apt-get on Ask Ubuntu
Build it from source, using the official repository. This is explained on Stack Overflow albeit for a different Python version
Also, if you may be able to find a docker image that already has Python 3.5.5 in it on Docker Hub. I didn't see one with a quick search, but it might be worth a closer look.

Why can't I install python3.6-dev on Ubuntu16.04

I am trying to install Python 3.6-dev with this command:
sudo apt-get install python3.6-dev
but I'm getting this error:
E: Unable to locate package python3.6-dev
E: Couldn't find any package by glob 'python3.6-dev'
E: Couldn't find any package by regex 'python3.6-dev'
Can anyone help? Why am I getting this error and what is the correct way to install the package?
sudo add-apt-repository ppa:deadsnakes/ppa \
&& sudo apt update \
&& sudo apt install python3.6
Edit:
The following PPA has been disabled, see discussion here and the new PPA here . So use the PPA mentioned above instead.
Original answer:
As mentioned by omajid the package is not availible in 16.04. But if you need it in 16.04 you can get it by adding for example the personal package repository of Felix Krull:
sudo add-apt-repository ppa:fkrull/deadsnakes
This ppa worked like a charm on ubuntu 16.04. Posting here for others.
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.6
For those who tried to install python-3.6 and got same error as that one above. This can help you as well us it helped me fix out the pb.
Open terminal then run command to add the PPA:
sudo add-apt-repository ppa:jonathonf/python-3.6
Then check updates and install Python 3.6 via commands:
sudo apt-get update
sudo apt-get install python3.6
Now to make sure you had install successufly just run python3.6-v or python3.6
For more details check here "How to Install Python 3.6.1 in Ubuntu 16.04 LTS"
Note: Linux 16.04 use python v 2.7 as default one if u needa use
python 3.6 in your project just set python-3.6 as default version for
this project. It's better then use sudo update-alternatives ...
command then your terminal will vanish :(.
The package is too new. It's not available in the older 16.04 release. It's available in the newer Ubuntu 16.10.
This ppa:jonathonf did not work for me.
ppa:deadsnakes
is working fine for now.
What worked was:
Open a terminal
Execute the following commands:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.6
sudo add-apt-repository ppa:deadsnakes/ppa
Guess they changed the name of repo.

Unable to locate package virtualenv in ubuntu-13 on a virtual-machine

When i try to run the command:
sudo apt-get install virtualenv
The error I get in response is:
E: Unable to locate package virtualenv
The Ubuntu package is called python-virtualenv, not "virtualenv".
Try This :
sudo apt-get install software-properties-common
sudo apt-add-repository universe
sudo apt-get update
sudo apt-get install virtualenv
It's also possible that you may not have run sudo apt-get update. It worked for me.
You need to add python before virtualenv because ubuntu package is
python-virtualenv not virtualenv.
sudo apt-get install python-virtualenv
you can install it with this instruction :
curl -O https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.10.1.tar.gz
tar xvfz virtualenv-1.10.1.tar.gz
cd virtualenv-1.10.1
sudo python setup.py install
sudo apt-get update
sudo apt-get install virtualenv
Yess, if any one wants to have a look at ( installing virtualenv: a basis for the installation of ) django installation, please run this command when the shell opens up in Ubuntu:
sudo apt-get install python-setuptools
sudo apt-get install python-easy_install virtualenv
and then run the commands to simply start the instructions followed on the following link(starting from the section "Setting up a new environment"):
http://www.django-rest-framework.org/tutorial/1-serialization/

Categories